Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_panel.c
| Show First 20 Lines • Show All 480 Lines • ▼ Show 20 Lines | static void reorder_instanced_panel_list(bContext *C, ARegion *region, Panel *drag_panel) | ||||
| if (move_to_index == start_index) { | if (move_to_index == start_index) { | ||||
| /* In this case, the reorder was not changed, so don't do any updates or call the callback. */ | /* In this case, the reorder was not changed, so don't do any updates or call the callback. */ | ||||
| return; | return; | ||||
| } | } | ||||
| /* Set the bit to tell the interface to instanced the list. */ | /* Set the bit to tell the interface to instanced the list. */ | ||||
| drag_panel->flag |= PNL_INSTANCED_LIST_ORDER_CHANGED; | 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. */ | /* Finally, move this panel's list item to the new index in its list. */ | ||||
| drag_panel->type->reorder(C, drag_panel, move_to_index); | drag_panel->type->reorder(C, drag_panel, move_to_index); | ||||
| CTX_store_set(C, NULL); | |||||
| } | } | ||||
| /** | /** | ||||
| * Recursive implementation for #panel_set_expansion_from_list_data. | * Recursive implementation for #panel_set_expansion_from_list_data. | ||||
| * | * | ||||
| * \return Whether the closed flag for the panel or any sub-panels changed. | * \return Whether the closed flag for the panel or any sub-panels changed. | ||||
| */ | */ | ||||
| static bool panel_set_expand_from_list_data_recursive(Panel *panel, short flag, short *flag_index) | static bool panel_set_expand_from_list_data_recursive(Panel *panel, short flag, short *flag_index) | ||||
| ▲ Show 20 Lines • Show All 1,954 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| panel->runtime.custom_data_ptr = custom_data; | panel->runtime.custom_data_ptr = custom_data; | ||||
| LISTBASE_FOREACH (Panel *, child_panel, &panel->children) { | LISTBASE_FOREACH (Panel *, child_panel, &panel->children) { | ||||
| ui_panel_custom_data_set_recursive(child_panel, custom_data); | ui_panel_custom_data_set_recursive(child_panel, custom_data); | ||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * 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) | void UI_panel_custom_data_set(Panel *panel, PointerRNA *custom_data) | ||||
| { | { | ||||
| BLI_assert(panel->type != NULL); | BLI_assert(panel->type != NULL); | ||||
| /* Free the old custom data, which should be shared among all of the panel's sub-panels. */ | /* Free the old custom data, which should be shared among all of the panel's sub-panels. */ | ||||
| if (panel->runtime.custom_data_ptr != NULL) { | if (panel->runtime.custom_data_ptr != NULL) { | ||||
| MEM_freeN(panel->runtime.custom_data_ptr); | MEM_freeN(panel->runtime.custom_data_ptr); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 160 Lines • Show Last 20 Lines | |||||