Merge branch 'blender-v2.92-release'

This commit is contained in:
Hans Goudey 2021-01-22 11:28:59 -06:00
commit e91b59b589
2 changed files with 26 additions and 2 deletions

View File

@ -583,7 +583,7 @@ static void set_panels_list_data_expand_flag(const bContext *C, const ARegion *r
/** \name Panels
* \{ */
static bool panel_use_active_highlight(const Panel *panel)
static bool panel_custom_data_active_get(const Panel *panel)
{
/* The caller should make sure the panel is active and has a type. */
BLI_assert(UI_panel_is_active(panel));
@ -599,6 +599,21 @@ static bool panel_use_active_highlight(const Panel *panel)
return false;
}
static void panel_custom_data_active_set(Panel *panel)
{
/* Since the panel is interacted with, it should be active and have a type. */
BLI_assert(UI_panel_is_active(panel));
BLI_assert(panel->type != NULL);
if (panel->type->active_property[0] != '\0') {
PointerRNA *ptr = UI_panel_custom_data_get(panel);
BLI_assert(RNA_struct_find_property(ptr, panel->type->active_property) != NULL);
if (ptr != NULL && !RNA_pointer_is_null(ptr)) {
RNA_boolean_set(ptr, panel->type->active_property, true);
}
}
}
/**
* Set flag state for a panel and its sub-panels.
*/
@ -1342,7 +1357,7 @@ void ui_draw_aligned_panel(const uiStyle *style,
region_search_filter_active);
}
if (panel_use_active_highlight(panel)) {
if (panel_custom_data_active_get(panel)) {
panel_draw_highlight_border(panel, rect, &header_rect);
}
}
@ -2169,6 +2184,12 @@ static void ui_handle_panel_header(const bContext *C,
ui_panel_drag_collapse_handler_add(C, UI_panel_is_closed(panel));
}
/* Set panel custom data (modifier) active when expanding subpanels, but not top-level
* panels to allow collapsing and expanding without setting the active element. */
if (is_subpanel) {
panel_custom_data_active_set(panel);
}
set_panels_list_data_expand_flag(C, region);
panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
return;
@ -2607,6 +2628,8 @@ static void panel_activate_state(const bContext *C, Panel *panel, const uiHandle
}
if (state == PANEL_STATE_DRAG) {
panel_custom_data_active_set(panel);
panel_set_flag_recursive(panel, PNL_SELECT, true);
panel_set_runtime_flag_recursive(panel, PANEL_IS_DRAG_DROP, true);

View File

@ -460,6 +460,7 @@ PanelType *modifier_subpanel_register(ARegionType *region_type,
BLI_strncpy(panel_type->label, label, BKE_ST_MAXNAME);
BLI_strncpy(panel_type->context, "modifier", BKE_ST_MAXNAME);
BLI_strncpy(panel_type->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA, BKE_ST_MAXNAME);
BLI_strncpy(panel_type->active_property, "is_active", BKE_ST_MAXNAME);
panel_type->draw_header = draw_header;
panel_type->draw = draw;