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. | |||||
| * VSE sequences need special handling since there is no context member for active sequence. */ | |||||
| if (BLI_str_startswith(umi_pr->context_data_path, "scene.sequence_editor.sequences_all")) { | |||||
| Scene *scene = CTX_data_scene(C); | |||||
| Sequence *seq = SEQ_select_active_get(scene); | |||||
| RNA_pointer_create(&scene->id, &RNA_Sequence, seq, &ptr); | |||||
| data_path = NULL; | |||||
| } | |||||
| else { | |||||
campbellbarton: No need to move `PointerRNA ptr;` declaration up. | |||||
| 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); | ||||
| 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) { | ||||
| *data_path = '.'; | *data_path = '.'; | ||||
| data_path += 1; | data_path += 1; | ||||
| } | } | ||||
| } | |||||
| bool ok = false; | bool ok = false; | ||||
| if (ptr.type != NULL) { | if (ptr.type != NULL) { | ||||
| PropertyRNA *prop = NULL; | PropertyRNA *prop = NULL; | ||||
| PointerRNA prop_ptr = ptr; | PointerRNA prop_ptr = ptr; | ||||
| if ((data_path == NULL) || | if ((data_path == NULL) || | ||||
| RNA_path_resolve_full(&ptr, data_path, &prop_ptr, NULL, NULL)) { | RNA_path_resolve_full(&ptr, data_path, &prop_ptr, NULL, NULL)) { | ||||
| prop = RNA_struct_find_property(&prop_ptr, umi_pr->prop_id); | prop = RNA_struct_find_property(&prop_ptr, umi_pr->prop_id); | ||||
| ▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines | |||||
No need to move PointerRNA ptr; declaration up.