Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_buttons/buttons_context.c
| Context not available. | |||||
| if (buttons_context_path_object(path)) { | if (buttons_context_path_object(path)) { | ||||
| ob = path->ptr[path->len - 1].data; | ob = path->ptr[path->len - 1].data; | ||||
| if (ob && ELEM(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_LATTICE)) | if (ob && ELEM(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_LATTICE, OB_GPENCIL)) | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| Context not available. | |||||
| ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace); | ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace); | ||||
| ID *id; | ID *id; | ||||
| int found; | int found; | ||||
| Object *ob = CTX_data_active_object(C); | |||||
| memset(path, 0, sizeof(*path)); | memset(path, 0, sizeof(*path)); | ||||
| path->flag = flag; | path->flag = flag; | ||||
| Context not available. | |||||
| found = buttons_context_path_particle(path); | found = buttons_context_path_particle(path); | ||||
| break; | break; | ||||
| case BCONTEXT_MATERIAL: | case BCONTEXT_MATERIAL: | ||||
| /* the colors of grease pencil are not real materials, but to keep UI consistency, we | |||||
| simulate and generate a path */ | |||||
| if (ob && ob->type == OB_GPENCIL) { | |||||
| found = buttons_context_path_data(path, -1); | |||||
| break; | |||||
| } | |||||
| found = buttons_context_path_material(path); | found = buttons_context_path_material(path); | ||||
| break; | break; | ||||
| case BCONTEXT_TEXTURE: | case BCONTEXT_TEXTURE: | ||||
| Context not available. | |||||
| if (a == BCONTEXT_DATA) { | if (a == BCONTEXT_DATA) { | ||||
| ptr = &path->ptr[path->len - 1]; | ptr = &path->ptr[path->len - 1]; | ||||
| if (ptr->type) | if (ptr->type) { | ||||
| sbuts->dataicon = RNA_struct_ui_icon(ptr->type); | sbuts->dataicon = RNA_struct_ui_icon(ptr->type); | ||||
| else | } | ||||
| sbuts->dataicon = ICON_EMPTY_DATA; | else { | ||||
| Object *ob = CTX_data_active_object(C); | |||||
| if (ob->type == OB_GPENCIL) { | |||||
| sbuts->dataicon = ICON_GREASEPENCIL; | |||||
| } | |||||
| else { | |||||
| sbuts->dataicon = ICON_EMPTY_DATA; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||