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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/UI_interface.h6
-rw-r--r--source/blender/editors/interface/interface.c11
-rw-r--r--source/blender/editors/interface/interface_intern.h1
-rw-r--r--source/blender/editors/interface/interface_layout.c49
-rw-r--r--source/blender/editors/interface/interface_panel.c4
-rw-r--r--source/blender/editors/screen/area.c1
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c5
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c6
-rw-r--r--source/blender/makesdna/DNA_space_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_space.c19
10 files changed, 61 insertions, 45 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 1d56cbb782d..a3fc66484d0 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -159,6 +159,9 @@ enum {
UI_BLOCK_SHOW_SHORTCUT_ALWAYS = 1 << 23,
/** All items have been removed from the block by the search filter. */
UI_BLOCK_FILTERED_EMPTY = 1 << 24,
+ /** The block is only used during the layout process and will not be drawn,
+ * for the case of a subpanel of a closed panel. */
+ UI_BLOCK_SEARCH_ONLY = 1 << 25,
};
/** #uiPopupBlockHandle.menuretval */
@@ -674,7 +677,8 @@ enum {
void UI_block_theme_style_set(uiBlock *block, char theme_style);
char UI_block_emboss_get(uiBlock *block);
void UI_block_emboss_set(uiBlock *block, char dt);
-bool UI_block_has_search_filter(uiBlock *block);
+bool UI_block_has_search_filter(const uiBlock *block);
+bool UI_block_is_search_only(const uiBlock *block);
void UI_block_set_search_only(uiBlock *block, bool search_only);
void UI_block_free(const struct bContext *C, uiBlock *block);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 0401e493f98..b8c0199cd28 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3369,7 +3369,7 @@ uiBlock *UI_block_begin(const bContext *C, ARegion *region, const char *name, sh
block->dt = dt;
block->evil_C = (void *)C; /* XXX */
- /* Set the search filter in the properties editor. */
+ /* Set the search filter for the properties editor. */
if ((region && region->regiontype == RGN_TYPE_WINDOW) &&
(area && area->spacetype == SPACE_PROPERTIES)) {
SpaceProperties *sbuts = CTX_wm_space_properties(C);
@@ -3425,14 +3425,19 @@ void UI_block_theme_style_set(uiBlock *block, char theme_style)
block->theme_style = theme_style;
}
-bool UI_block_has_search_filter(uiBlock *block)
+bool UI_block_has_search_filter(const uiBlock *block)
{
return block->search_filter != NULL && block->search_filter[0] != '\0';
}
+bool UI_block_is_search_only(const uiBlock *block)
+{
+ return block->flag & UI_BLOCK_SEARCH_ONLY;
+}
+
void UI_block_set_search_only(uiBlock *block, bool search_only)
{
- block->search_only = search_only;
+ SET_FLAG_FROM_TEST(block->flag, search_only, UI_BLOCK_SEARCH_ONLY);
}
static void ui_but_build_drawstr_float(uiBut *but, double value)
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index c080bea9a29..582be87a36b 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -465,7 +465,6 @@ struct uiBlock {
char display_device[64];
char *search_filter;
- bool search_only;
struct PieMenuData pie_data;
};
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 3ac38a4465e..37d45d6283b 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -85,6 +85,9 @@ typedef struct uiLayoutRoot {
int type;
int opcontext;
+ /** If true, the root will be removed as part of the property search process.
+ * Necessary for cases like searching the contents of closed panels, where the
+ * block-level tag isn't enough because there might be buttons in the header. */
bool search_only;
int emw, emh;
@@ -828,7 +831,8 @@ static void ui_item_enum_expand_exec(uiLayout *layout,
* this doubles the icon_only parameter.
* - we *never* draw (i.e. really use) the enum label uiname, it is just used as a mere flag!
*
- * Unfortunately, fixing this implies an API "soft break", so better to defer it for later... :/
+ * Unfortunately, fixing this implies an API "soft break", so better to defer it for later...
+ * :/
* - mont29
*/
@@ -1990,8 +1994,8 @@ static uiBut *ui_layout_heading_label_add(uiLayout *layout,
*/
static uiLayout *ui_item_prop_split_layout_hack(uiLayout *layout_parent, uiLayout *layout_split)
{
- /* Tag item as using property split layout, this is inherited to children so they can get special
- * treatment if needed. */
+ /* Tag item as using property split layout, this is inherited to children so they can get
+ * special treatment if needed. */
layout_parent->item.flag |= UI_ITEM_INSIDE_PROP_SEP;
if (layout_parent->item.type == ITEM_LAYOUT_ROW) {
@@ -2017,9 +2021,9 @@ void uiItemFullR(uiLayout *layout,
char namestr[UI_MAX_NAME_STR];
const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0);
const bool inside_prop_sep = ((layout->item.flag & UI_ITEM_INSIDE_PROP_SEP) != 0);
- /* Columns can define a heading to insert. If the first item added to a split layout doesn't have
- * a label to display in the first column, the heading is inserted there. Otherwise it's inserted
- * as a new row before the first item. */
+ /* Columns can define a heading to insert. If the first item added to a split layout doesn't
+ * have a label to display in the first column, the heading is inserted there. Otherwise it's
+ * inserted as a new row before the first item. */
uiLayout *heading_layout = ui_layout_heading_find(layout);
/* Although checkboxes use the split layout, they are an exception and should only place their
* label in the second column, to not make that almost empty.
@@ -3277,7 +3281,8 @@ uiBut *uiItemL_respect_property_split(uiLayout *layout,
if (layout->item.flag & UI_ITEM_PROP_SEP) {
uiBlock *block = uiLayoutGetBlock(layout);
uiPropertySplitWrapper split_wrapper = uiItemPropertySplitWrapperCreate(layout);
- /* Further items added to 'layout' will automatically be added to split_wrapper.property_row */
+ /* Further items added to 'layout' will automatically be added to split_wrapper.property_row
+ */
label_but = uiItemL_(split_wrapper.label_column, text, icon);
UI_block_layout_set_current(block, split_wrapper.property_row);
@@ -5167,6 +5172,7 @@ void uiLayoutRootSetSearchOnly(uiLayout *layout, bool search_only)
* \{ */
// #define PROPERTY_SEARCH_USE_TOOLTIPS
+// #define PROPERTY_SEARCH_USE_PANEL_LABELS
#define DEBUG_LAYOUT_ROOTS
static void ui_layout_free(uiLayout *layout);
@@ -5527,11 +5533,13 @@ static bool ui_block_search_layout(uiBlock *block)
/* Also search based on panel labels. */
bool panel_label_matches = false;
- // if ((block->panel != NULL) && (block->panel->type != NULL)) {
- // if (BLI_strcasestr(block->panel->type->label, block->search_filter)) {
- // panel_label_matches = true;
- // }
- // }
+#ifdef PROPERTY_SEARCH_USE_PANEL_LABELS
+ if ((block->panel != NULL) && (block->panel->type != NULL)) {
+ if (BLI_strcasestr(block->panel->type->label, block->search_filter)) {
+ panel_label_matches = true;
+ }
+ }
+#endif
/* Apply search filter. */
if (!panel_label_matches) {
@@ -5550,20 +5558,21 @@ static bool ui_block_search_layout(uiBlock *block)
}
}
- /* Change layouts to the single column search layout. */
- if (!all_roots_empty && !block->search_only) {
+ /* Replace label button strings with RNA property names. */
+ if (!all_roots_empty && !UI_block_is_search_only(block)) {
ui_block_replace_labels(block);
}
/* Set empty flags. */
- if (block->search_only) {
+ if (UI_block_is_search_only(block)) {
/* Make sure all of the block's buttons are hidden. They might not have
* been hidden if a layout wasn't searched. */
LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
but->flag |= UI_HIDDEN;
}
}
- SET_FLAG_FROM_TEST(block->flag, all_roots_empty || block->search_only, UI_BLOCK_FILTERED_EMPTY);
+ SET_FLAG_FROM_TEST(
+ block->flag, all_roots_empty || UI_block_is_search_only(block), UI_BLOCK_FILTERED_EMPTY);
if (block->panel != NULL) {
ui_panel_set_search_filtered(block->panel, all_roots_empty);
}
@@ -5577,7 +5586,7 @@ static bool ui_block_search_layout(uiBlock *block)
}
#endif
- return all_roots_empty || block->search_only;
+ return all_roots_empty || UI_block_is_search_only(block);
}
/** \} */
@@ -6118,9 +6127,9 @@ static void ui_paneltype_draw_impl(bContext *C, PanelType *pt, uiLayout *layout,
panel->layout = NULL;
}
- /* draw_header() is often used to add a checkbox to the header. If we add the label like below
- * the label is disconnected from the checkbox, adding a weird looking gap. As workaround, let
- * the checkbox add the label instead. */
+ /* draw_header() is often used to add a checkbox to the header. If we add the label like
+ * below the label is disconnected from the checkbox, adding a weird looking gap. As
+ * workaround, let the checkbox add the label instead. */
if (!ui_layout_has_panel_label(row, pt)) {
uiItemL(row, CTX_IFACE_(pt->translation_context, pt->label), ICON_NONE);
}
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index bbe3668e756..bde7fc47ff7 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1689,14 +1689,14 @@ void UI_panels_draw(const bContext *C, ARegion *region)
* and we need child panels to draw on top. */
LISTBASE_FOREACH_BACKWARD (uiBlock *, block, &region->uiblocks) {
if (block->active && block->panel && !(block->panel->flag & PNL_SELECT) &&
- !block->search_only && !UI_panel_is_search_filtered(block->panel)) {
+ !UI_block_is_search_only(block) && !UI_panel_is_search_filtered(block->panel)) {
UI_block_draw(C, block);
}
}
LISTBASE_FOREACH_BACKWARD (uiBlock *, block, &region->uiblocks) {
if (block->active && block->panel && (block->panel->flag & PNL_SELECT) &&
- !block->search_only && !UI_panel_is_search_filtered(block->panel)) {
+ !UI_block_is_search_only(block) && !UI_panel_is_search_filtered(block->panel)) {
UI_block_draw(C, block);
}
}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 881e53b1985..95f5bdbc394 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -2519,7 +2519,6 @@ void ED_region_panels_layout_ex(const bContext *C,
const bool vertical,
const char *category_override)
{
- // printf("ED_REGION_PANELS_LAYOUT_EX\n");
/* collect panels to draw */
WorkSpace *workspace = CTX_wm_workspace(C);
LinkNode *panel_types_stack = NULL;
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 87a56a9e7de..5ca5a3400ca 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -1105,7 +1105,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
static bool buttons_panel_context_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceProperties *sbuts = CTX_wm_space_properties(C);
- return (sbuts->mainb != BCONTEXT_TOOL);
+ return sbuts->mainb != BCONTEXT_TOOL;
}
static void buttons_panel_context_draw(const bContext *C, Panel *panel)
@@ -1174,9 +1174,6 @@ static void buttons_panel_context_draw(const bContext *C, Panel *panel)
}
}
}
-
- // UI_but_flag_disable(but, UI_BUT_UNDO); /* skip undo on screen buttons */
- // UI_but_func_set(but, pin_cb, NULL, NULL);
}
void buttons_context_register(ARegionType *art)
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 9c2ef613ba4..514b72d90da 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -54,7 +54,7 @@
#include "buttons_intern.h" /* own include */
/********************** filter operator *********************/
-/* Note: almost duplicate of file browser operator. */
+/* Note: Almost a duplicate of the file browser operator. */
static int buttons_start_filter_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -72,12 +72,12 @@ static int buttons_start_filter_exec(bContext *C, wmOperator *UNUSED(op))
void BUTTONS_OT_start_filter(struct wmOperatorType *ot)
{
- /* identifiers */
+ /* Identifiers. */
ot->name = "Filter";
ot->description = "Start entering filter text";
ot->idname = "BUTTONS_OT_start_filter";
- /* api callbacks */
+ /* Callbacks. */
ot->exec = buttons_start_filter_exec;
ot->poll = ED_operator_buttons_active;
}
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index c265eedab2b..565844f0f27 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -148,6 +148,8 @@ typedef struct SpaceProperties {
/** Context tabs. */
short mainb, mainbo, mainbuser;
+ /** Bitfield flag (in the same order as the tabs) for whether each tab has properties
+ * that match the search filter. Only valid when #search_string is set. */
int context_search_filter_active;
/** Preview is signal to refresh. */
short preview;
@@ -160,7 +162,7 @@ typedef struct SpaceProperties {
int pathflag, dataicon;
ID *pinid;
- /* For filtering properties displayed in the space. */
+ /** For filtering properties displayed in the space. */
char search_string[64];
void *texuser;
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 73a54c8eb09..2df36f73397 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -4455,15 +4455,6 @@ static void rna_def_space_properties(BlenderRNA *brna)
RNA_def_property_update(
prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_context_update");
- prop = RNA_def_property(srna, "context_search_filter_active", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, buttons_context_items);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_enum_funcs(
- prop, NULL, "rna_SpaceProperties_context_set", "rna_SpaceProperties_context_itemf");
- RNA_def_property_ui_text(prop, "", "");
- RNA_def_property_update(
- prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_context_update");
-
/* pinned data */
prop = RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "pinid");
@@ -4479,6 +4470,16 @@ static void rna_def_space_properties(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT);
RNA_def_property_ui_text(prop, "Pin ID", "Use the pinned context");
+ /* Property search. */
+ prop = RNA_def_property(srna, "context_search_filter_active", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, buttons_context_items);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_enum_funcs(
+ prop, NULL, "rna_SpaceProperties_context_set", "rna_SpaceProperties_context_itemf");
+ RNA_def_property_ui_text(prop, "", "");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_context_update");
+
prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "search_string");
RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string");