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-10-03 19:25:13 +0300
committerHans Goudey <h.goudey@me.com>2020-10-03 19:25:13 +0300
commitcb6234fccf7dfd3e09555cac18357427d802be1d (patch)
tree7d7b97232f84b0cce218e7b8635032ed67875eb5 /source/blender/editors/interface/interface_button_group.c
parent724370b2f9727c007b911c036183b844dbc2ab59 (diff)
Property Search: Set panel expansion when tab changes
This commit makes the panel expansion set based on the search results when the active tab in the properties editor changes. The multi-tab search patch (D8859) actually doesn't handle this because it uses a different code path. This feature uncovered a subtle but fairly significant issue with the implementation of property search (More details in T81113). Basically, the search needed multiple redraws to properly display the expansion of panels based on the search results. Because there is no animation of panel expansion when switching tabs, the problem was exposed only now. With this commit, hiding of "search only" buttons and panel size calculation happens in a single final step of the panel layout pass. The "search only" layout root flag is removed. Instead every button inside a panel header is in a single "uiButtonGroup" marked with a specific "in header" flag, an idea which could be generalized in the future. Differential Revision: https://developer.blender.org/D9006
Diffstat (limited to 'source/blender/editors/interface/interface_button_group.c')
-rw-r--r--source/blender/editors/interface/interface_button_group.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_button_group.c b/source/blender/editors/interface/interface_button_group.c
index 455a3c6a69c..1f544831982 100644
--- a/source/blender/editors/interface/interface_button_group.c
+++ b/source/blender/editors/interface/interface_button_group.c
@@ -32,17 +32,26 @@
* Every function that adds a set of buttons must create another group,
* then #ui_def_but adds buttons to the current group (the last).
*/
-void ui_block_new_button_group(uiBlock *block)
+void ui_block_new_button_group(uiBlock *block, short flag)
{
+ /* Don't create a new group if there is a "lock" on new groups. */
+ if (!BLI_listbase_is_empty(&block->button_groups)) {
+ uiButtonGroup *last_button_group = block->button_groups.last;
+ if (last_button_group->flag & UI_BUTTON_GROUP_LOCK) {
+ return;
+ }
+ }
+
uiButtonGroup *new_group = MEM_mallocN(sizeof(uiButtonGroup), __func__);
BLI_listbase_clear(&new_group->buttons);
+ new_group->flag = flag;
BLI_addtail(&block->button_groups, new_group);
}
void ui_button_group_add_but(uiBlock *block, uiBut *but)
{
if (BLI_listbase_is_empty(&block->button_groups)) {
- ui_block_new_button_group(block);
+ ui_block_new_button_group(block, 0);
}
uiButtonGroup *current_button_group = block->button_groups.last;