diff options
author | Campbell Barton <campbell@blender.org> | 2022-05-20 07:30:17 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-05-26 05:16:35 +0300 |
commit | 3f3d82cfe9cefe4bfd9da3d283dec4a1923ec22d (patch) | |
tree | 532de0110686d29f63c550c4784f8d2acc86e110 /source/blender/makesrna/RNA_define.h | |
parent | 11480763b62e6ca72ae869391b8e5495e57410a6 (diff) |
UI support for showing candidates for string properties
Currently strings are used for cases where a list of identifiers would
be useful to show.
Add support for string properties to reference a callback to populate
candidates to show when editing a string. The user isn't prevented from
typing in text not found in this list, it's just useful as a reference.
Support for expanding the following strings has been added:
- Operator, menu & panel identifiers in the keymap editor.
- WM operators that reference data-paths expand using the
Python-consoles auto-complete functionality.
- Names of keying sets for insert/delete keyframe operators.
Details:
- `bpy.props.StringProperty` takes an option `search` callback.
- A new string callback has been added, set via
`RNA_def_property_string_search_func` or
`RNA_def_property_string_search_func_runtime`.
- Addresses usability issue highlighted by T89560,
where setting keying set identifiers as strings isn't practical.
- Showing additional right-aligned text in the search results is
supported but disabled by default as the text is too cramped in most
string search popups where the feature would make sense. It could be
enabled as part of other layout tweaks.
Reviewed By: brecht
Ref D14986
Diffstat (limited to 'source/blender/makesrna/RNA_define.h')
-rw-r--r-- | source/blender/makesrna/RNA_define.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 13a5ec66a16..0389d1b3b16 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -446,6 +446,9 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set); +void RNA_def_property_string_search_func(PropertyRNA *prop, + const char *search, + eStringPropertySearchFlag search_flag); void RNA_def_property_pointer_funcs( PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll); void RNA_def_property_collection_funcs(PropertyRNA *prop, @@ -490,6 +493,9 @@ void RNA_def_property_string_funcs_runtime(PropertyRNA *prop, StringPropertyGetFunc getfunc, StringPropertyLengthFunc lengthfunc, StringPropertySetFunc setfunc); +void RNA_def_property_string_search_func_runtime(PropertyRNA *prop, + StringPropertySearchFunc search_fn, + eStringPropertySearchFlag search_flag); void RNA_def_property_translation_context(PropertyRNA *prop, const char *context); |