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-09-15 19:25:49 +0300
committerHans Goudey <h.goudey@me.com>2020-09-15 19:25:49 +0300
commit8bcdcab659fb688d976a50d892dcb4285ff2a180 (patch)
treed85178a6bda0ca80bc62ae6d85428d6f0ed12c5a /source/blender/makesrna
parent7a0a60dde8b4bf120ab7977e476bf5c82b2a63ad (diff)
UI: Single tab property search
This adds a search bar to the properties editor. The full search for every tab isn't included in this patch, but the interaction with panels, searching behavior, UI, region level, and DNA changes are included here. The block-level search works by iterating over the block's button groups and checking whether they match the search. If they do, they are tagged with a flag, and the block's panel is tagged too. For every update (text edit), the panel's expansion is set to whether the panel has a result or not. The search also checks for matching strings inside enums and in panel labels. One complication to this that isn't immediately apparent is that closed panel's subpanels have to be searched too. This adds some complexity to the area-level panel layout code. Possible Future Improvements: - Use the new fuzzy search in BLI - Reset panels to their expansion before the search started if the user escape out of the text box. - Open all child panels of a panel with expansion. Differential Revision: https://developer.blender.org/D8856
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_space.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 317759ce418..d33939724ef 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1817,6 +1817,18 @@ static void rna_SpaceProperties_context_update(Main *UNUSED(bmain),
}
}
+static void rna_SpaceProperties_search_filter_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
+{
+ ScrArea *area = rna_area_from_space(ptr);
+
+ /* Update the search filter flag for the main region with the panels. */
+ ARegion *main_region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
+ BLI_assert(main_region != NULL);
+ ED_region_search_filter_update(area, main_region);
+}
+
/* Space Console */
static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
{
@@ -4482,6 +4494,14 @@ static void rna_def_space_properties(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
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, "search_filter", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "runtime->search_string");
+ RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string");
+ RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_search_filter_update");
}
static void rna_def_space_image(BlenderRNA *brna)