Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/screen_user_menu.c
| Show All 38 Lines | |||||
| #include "BKE_blender_user_menu.h" | #include "BKE_blender_user_menu.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "SEQ_select.h" | |||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| ▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (bUserMenuItem *, umi, &um->items) { | ||||
| SNPRINTF(label, "Missing: %s", umi_mt->mt_idname); | SNPRINTF(label, "Missing: %s", umi_mt->mt_idname); | ||||
| uiItemL(menu->layout, label, ICON_NONE); | uiItemL(menu->layout, label, ICON_NONE); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if (umi->type == USER_MENU_TYPE_PROP) { | else if (umi->type == USER_MENU_TYPE_PROP) { | ||||
| bUserMenuItem_Prop *umi_pr = (bUserMenuItem_Prop *)umi; | bUserMenuItem_Prop *umi_pr = (bUserMenuItem_Prop *)umi; | ||||
| char *data_path = strchr(umi_pr->context_data_path, '.'); | char *data_path; | ||||
| PointerRNA ptr; | |||||
| /* Determine active RNA pointer and property to edit. */ | |||||
| data_path = strchr(umi_pr->context_data_path, '.'); | |||||
| if (data_path) { | if (data_path) { | ||||
| *data_path = '\0'; | *data_path = '\0'; | ||||
| } | } | ||||
| PointerRNA ptr = CTX_data_pointer_get(C, umi_pr->context_data_path); | ptr = CTX_data_pointer_get(C, umi_pr->context_data_path); | ||||
campbellbarton: No need to move `PointerRNA ptr;` declaration up. | |||||
| if (ptr.type == NULL) { | if (ptr.type == NULL) { | ||||
| PointerRNA ctx_ptr; | PointerRNA ctx_ptr; | ||||
| RNA_pointer_create(NULL, &RNA_Context, (void *)C, &ctx_ptr); | RNA_pointer_create(NULL, &RNA_Context, (void *)C, &ctx_ptr); | ||||
| if (!RNA_path_resolve_full(&ctx_ptr, umi_pr->context_data_path, &ptr, NULL, NULL)) { | if (!RNA_path_resolve_full(&ctx_ptr, umi_pr->context_data_path, &ptr, NULL, NULL)) { | ||||
| ptr.type = NULL; | ptr.type = NULL; | ||||
| } | } | ||||
| } | } | ||||
| if (data_path) { | if (data_path) { | ||||
| ▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines | |||||
No need to move PointerRNA ptr; declaration up.