diff options
author | Julian Eisel <julian@blender.org> | 2021-11-23 20:35:56 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-11-23 20:35:56 +0300 |
commit | c09e8a35904d5c58882cbe93c5086e5f2450c80e (patch) | |
tree | be47fdedd56de6129052af7f8918f463ecbf031e /source/blender/editors/interface | |
parent | c0a2b2174415af228ecc27659d7cfb5148143a7f (diff) | |
parent | 792badcfefcb92aadc16346f0dc11299a8da0ced (diff) |
Merge branch 'blender-v3.0-release'
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 15 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 7 |
2 files changed, 21 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 6acbaf03476..8d47b8a1011 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -486,8 +486,12 @@ static void reorder_instanced_panel_list(bContext *C, ARegion *region, Panel *dr /* Set the bit to tell the interface to instanced the list. */ drag_panel->flag |= PNL_INSTANCED_LIST_ORDER_CHANGED; + CTX_store_set(C, drag_panel->runtime.context); + /* Finally, move this panel's list item to the new index in its list. */ drag_panel->type->reorder(C, drag_panel, move_to_index); + + CTX_store_set(C, NULL); } /** @@ -2458,6 +2462,17 @@ static void ui_panel_custom_data_set_recursive(Panel *panel, PointerRNA *custom_ } } +/** + * Set a context for this entire panel and its current layout. This should be used whenever panel + * callbacks that are called outside of regular drawing might require context. Currently it affects + * the #PanelType.reorder callback only. + */ +void UI_panel_context_pointer_set(Panel *panel, const char *name, PointerRNA *ptr) +{ + uiLayoutSetContextPointer(panel->layout, name, ptr); + panel->runtime.context = uiLayoutGetContextStore(panel->layout); +} + void UI_panel_custom_data_set(Panel *panel, PointerRNA *custom_data) { BLI_assert(panel->type != NULL); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index b30a86c5fcf..cbd57176a31 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2727,7 +2727,12 @@ static void draw_constraint_header(uiLayout *layout, Object *ob, bConstraint *co PointerRNA ptr; RNA_pointer_create(&ob->id, &RNA_Constraint, con, &ptr); - uiLayoutSetContextPointer(layout, "constraint", &ptr); + if (block->panel) { + UI_panel_context_pointer_set(block->panel, "constraint", &ptr); + } + else { + uiLayoutSetContextPointer(layout, "constraint", &ptr); + } /* Constraint type icon. */ uiLayout *sub = uiLayoutRow(layout, false); |