Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-06-10 18:16:55 +0300
committerHans Goudey <h.goudey@me.com>2020-06-10 18:16:55 +0300
commita9dfad831b8b616c7f7c6b17c2764f8610926ddb (patch)
tree9531b00041d06330ee586b254853a641f1eb9078 /source/blender/editors/interface
parentb0ac7a89b0ed4494e81520d8f02ab60c861be002 (diff)
Fix T77694: Start panel animation when expansion data changes
During normal drawing there is a rather complicated method to check whether the panels should be animating. It's not set up to deal with the panel expansion changing from outside the UI, which is now possible with the panel expansion connected to the modifier's show_expanded property. The solution is to activate panel animation if setting the expansion property has changed.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_panel.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 33f600f30a1..a83f1cc44db 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -486,10 +486,13 @@ static void reorder_instanced_panel_list(bContext *C, ARegion *region, Panel *dr
/**
* Recursive implementation for #UI_panel_set_expand_from_list_data.
+ *
+ * \return Whether the closed flag for the panel or any subpanels changed.
*/
-static void 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)
{
bool open = (flag & (1 << *flag_index));
+ bool changed = (open == (bool)(panel->flag & PNL_CLOSEDY));
if (open) {
panel->flag &= ~PNL_CLOSEDY;
}
@@ -498,8 +501,9 @@ static void panel_set_expand_from_list_data_recursive(Panel *panel, short flag,
}
LISTBASE_FOREACH (Panel *, child, &panel->children) {
*flag_index = *flag_index + 1;
- panel_set_expand_from_list_data_recursive(child, flag, flag_index);
+ changed |= panel_set_expand_from_list_data_recursive(child, flag, flag_index);
}
+ return changed;
}
/**
@@ -518,7 +522,11 @@ void UI_panel_set_expand_from_list_data(const bContext *C, Panel *panel)
short expand_flag = panel->type->get_list_data_expand_flag(C, panel);
short flag_index = 0;
- panel_set_expand_from_list_data_recursive(panel, expand_flag, &flag_index);
+
+ /* Start panel animation if the open state was changed. */
+ if (panel_set_expand_from_list_data_recursive(panel, expand_flag, &flag_index)) {
+ panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
+ }
}
/**