diff options
author | Hans Goudey <h.goudey@me.com> | 2020-09-15 19:25:49 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-09-15 19:25:49 +0300 |
commit | 8bcdcab659fb688d976a50d892dcb4285ff2a180 (patch) | |
tree | d85178a6bda0ca80bc62ae6d85428d6f0ed12c5a /source/blender/editors/space_buttons | |
parent | 7a0a60dde8b4bf120ab7977e476bf5c82b2a63ad (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/editors/space_buttons')
-rw-r--r-- | source/blender/editors/space_buttons/space_buttons.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 25f8fecbf26..59723fb1926 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -109,20 +109,31 @@ static void buttons_free(SpaceLink *sl) BLI_freelistN(&ct->users); MEM_freeN(ct); } + + MEM_SAFE_FREE(sbuts->runtime); } /* spacetype; init callback */ -static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(area)) +static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *area) { + SpaceProperties *sbuts = (SpaceProperties *)area->spacedata.first; + + if (sbuts->runtime == NULL) { + sbuts->runtime = MEM_mallocN(sizeof(SpaceProperties_Runtime), __func__); + sbuts->runtime->search_string[0] = '\0'; + } } static SpaceLink *buttons_duplicate(SpaceLink *sl) { + SpaceProperties *sfile_old = (SpaceProperties *)sl; SpaceProperties *sbutsn = MEM_dupallocN(sl); /* clear or remove stuff from old */ sbutsn->path = NULL; sbutsn->texuser = NULL; + sbutsn->runtime = MEM_dupallocN(sfile_old->runtime); + sbutsn->runtime->search_string[0] = '\0'; return (SpaceLink *)sbutsn; } |