[Bf-blender-cvs] [34c5245c328] property-search-ui: Property Search: Support heading labels
Hans Goudey
noreply at git.blender.org
Wed Jul 1 21:16:51 CEST 2020
Commit: 34c5245c328fb02051c2a05d4954b14237b6816f
Author: Hans Goudey
Date: Wed Jul 1 15:16:44 2020 -0400
Branches: property-search-ui
https://developer.blender.org/rB34c5245c328fb02051c2a05d4954b14237b6816f
Property Search: Support heading labels
===================================================================
M source/blender/editors/interface/interface_layout.c
M source/blender/editors/interface/interface_panel.c
===================================================================
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 4ff4f23bd89..c9958386b34 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1920,28 +1920,34 @@ static uiLayout *ui_layout_heading_find(uiLayout *cur_layout)
return NULL;
}
-static void ui_layout_heading_label_add(uiLayout *layout,
- uiLayout *heading_layout,
- bool right_align,
- bool respect_prop_split)
+/**
+ * \return The label button added.
+ */
+static uiBut *ui_layout_heading_label_add(uiLayout *layout,
+ uiLayout *heading_layout,
+ bool right_align,
+ bool respect_prop_split)
{
const int prev_alignment = layout->alignment;
+ uiBut *label_but = NULL;
if (right_align) {
uiLayoutSetAlignment(layout, UI_LAYOUT_ALIGN_RIGHT);
}
if (respect_prop_split) {
- uiItemL_respect_property_split(layout, heading_layout->heading, ICON_NONE, NULL);
+ label_but = uiItemL_respect_property_split(layout, heading_layout->heading, ICON_NONE, NULL);
}
else {
- uiItemL(layout, heading_layout->heading, ICON_NONE);
+ label_but = uiItemL_(layout, heading_layout->heading, ICON_NONE);
}
/* After adding the heading label, we have to mark it somehow as added, so it's not added again
* for other items in this layout. For now just clear it. */
heading_layout->heading[0] = '\0';
layout->alignment = prev_alignment;
+
+ return label_but;
}
/**
@@ -2146,7 +2152,7 @@ void uiItemFullR(uiLayout *layout,
layout = uiLayoutColumn(layout_row ? layout_row : layout, true);
layout->space = 0;
if (heading_layout) {
- ui_layout_heading_label_add(layout, heading_layout, false, false);
+ label_but = ui_layout_heading_label_add(layout, heading_layout, false, false);
}
}
else {
@@ -2205,7 +2211,7 @@ void uiItemFullR(uiLayout *layout,
}
if (!label_added && heading_layout) {
- ui_layout_heading_label_add(layout_sub, heading_layout, true, false);
+ label_but = ui_layout_heading_label_add(layout_sub, heading_layout, true, false);
label_added = true;
}
@@ -2254,7 +2260,7 @@ void uiItemFullR(uiLayout *layout,
else if (heading_layout) {
/* Could not add heading to split layout, fallback to inserting it to the layout with the
* heading itself. */
- ui_layout_heading_label_add(heading_layout, heading_layout, false, false);
+ label_but = ui_layout_heading_label_add(heading_layout, heading_layout, false, false);
}
/* array property */
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 4a30a9d0cdb..2d53d72d84c 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -185,15 +185,17 @@ static bool panel_active_animation_changed(ListBase *lb, Panel **pa_animation, b
}
/* Detect search filter flag changes */
- if ((panel->runtime_flag & PNL_WAS_SEARCH_FILTERED) &&
- !(panel->runtime_flag & PNL_SEARCH_FILTERED)) {
- *pa_animation = panel;
- return false;
- }
- if (!(panel->runtime_flag & PNL_WAS_SEARCH_FILTERED) &&
- (panel->runtime_flag & PNL_SEARCH_FILTERED)) {
- *pa_animation = panel;
- return false;
+ if (!(panel->flag & PNL_NEW_ADDED)) {
+ if ((panel->runtime_flag & PNL_WAS_SEARCH_FILTERED) &&
+ !(panel->runtime_flag & PNL_SEARCH_FILTERED)) {
+ *pa_animation = panel;
+ return false;
+ }
+ if (!(panel->runtime_flag & PNL_WAS_SEARCH_FILTERED) &&
+ (panel->runtime_flag & PNL_SEARCH_FILTERED)) {
+ *pa_animation = panel;
+ return false;
+ }
}
if ((panel->runtime_flag & PNL_ACTIVE) && !(panel->flag & PNL_CLOSED)) {
@@ -272,6 +274,7 @@ static Panel *UI_panel_add_instanced_ex(ScrArea *area,
panel->runtime.list_index = list_index;
panel->runtime.custom_data_ptr = custom_data;
+ panel->runtime_flag |= PNL_NEW_ADDED;
/* Add the panel's children too. Although they aren't instanced panels, we can still use this
* function to create them, as UI_panel_begin does other things we don't need to do. */
More information about the Bf-blender-cvs
mailing list