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:
authorJulian Eisel <julian@blender.org>2020-05-11 18:14:15 +0300
committerJulian Eisel <julian@blender.org>2020-05-11 18:14:15 +0300
commit6f5bc1fc2b4b3cea6d23ae86a44dfd06848b642e (patch)
tree54c787b796cec7c0ba8a8d75b3bbe27f041c4d27 /source/blender/editors/interface/interface_utils.c
parentccf97e10137e5f0fcff79f3a62b77ff92edf820c (diff)
parent249ccab111ac05158064d20ba0fbd1f618f9aa92 (diff)
Merge branch 'blender-v2.83-release'
Diffstat (limited to 'source/blender/editors/interface/interface_utils.c')
-rw-r--r--source/blender/editors/interface/interface_utils.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 895d3033cc9..4013e962ce5 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -408,6 +408,11 @@ void ui_rna_collection_search_update_fn(const struct bContext *C,
int i = 0, iconid = 0, flag = RNA_property_flag(data->target_prop);
ListBase *items_list = MEM_callocN(sizeof(ListBase), "items_list");
CollItemSearch *cis;
+ const bool is_ptr_target = (RNA_property_type(data->target_prop) == PROP_POINTER);
+ /* For non-pointer properties, UI code acts entirely based on the item's name. So the name has to
+ * match the RNA name exactly. So only for pointer properties, the name can be modified to add
+ * further UI hints. */
+ const bool requires_exact_data_name = !is_ptr_target;
const bool skip_filter = data->search_but && !data->search_but->changed;
char name_buf[UI_MAX_DRAW_STR];
char *name;
@@ -422,7 +427,7 @@ void ui_rna_collection_search_update_fn(const struct bContext *C,
}
/* use filter */
- if (RNA_property_type(data->target_prop) == PROP_POINTER) {
+ if (is_ptr_target) {
if (RNA_property_pointer_poll(&data->target_ptr, data->target_prop, &itemptr) == 0) {
continue;
}
@@ -432,10 +437,15 @@ void ui_rna_collection_search_update_fn(const struct bContext *C,
if (itemptr.type && RNA_struct_is_ID(itemptr.type)) {
iconid = ui_id_icon_get(C, itemptr.data, false);
- BKE_id_full_name_ui_prefix_get(name_buf, itemptr.data);
- BLI_STATIC_ASSERT(sizeof(name_buf) >= MAX_ID_FULL_NAME_UI,
- "Name string buffer should be big enough to hold full UI ID name");
- name = name_buf;
+ if (requires_exact_data_name) {
+ name = RNA_struct_name_get_alloc(&itemptr, name_buf, sizeof(name_buf), NULL);
+ }
+ else {
+ BKE_id_full_name_ui_prefix_get(name_buf, itemptr.data);
+ BLI_STATIC_ASSERT(sizeof(name_buf) >= MAX_ID_FULL_NAME_UI,
+ "Name string buffer should be big enough to hold full UI ID name");
+ name = name_buf;
+ }
}
else {
name = RNA_struct_name_get_alloc(&itemptr, name_buf, sizeof(name_buf), NULL);