diff options
author | Julian Eisel <julian@blender.org> | 2020-06-29 18:19:43 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-06-29 18:28:37 +0300 |
commit | 937d89afba36ea0f22ad929d2c8bdf8a853dc7d8 (patch) | |
tree | d2e70cf1d6bdd00d203784a196116a8c9ce4070e /source/blender/blenkernel | |
parent | 5024c5427140c2d23b1c4c21853becd23c39cd57 (diff) |
UI: Show library status icons in search menus, rather than letter prefix
Rather than a `L` (linked), `O` (overridden) or `M` (missing) prefix for the
name, show the existing library status icons. See D7999 for screenshots.
Note that when using preview icons, or if the search menu contains items with
own icons (e.g. brush icons), we still fallback to the prefix solution.
Zero or fake user is still indicated with a prefix.
Differential Revision: https://developer.blender.org/D7999
Reviewed by: Bastien Montagne, William Reynish
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_lib_id.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 13 |
2 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h index e6a711732c9..bc72afdd08d 100644 --- a/source/blender/blenkernel/BKE_lib_id.h +++ b/source/blender/blenkernel/BKE_lib_id.h @@ -267,6 +267,7 @@ void BKE_main_id_repair_duplicate_names_listbase(struct ListBase *lb); void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const struct ID *id, char separator_str); void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], const struct ID *id, + const bool add_lib_hint, char separator_char); char *BKE_id_to_unique_string_key(const struct ID *id); diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index 0312fa566e8..b983249994b 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -2175,13 +2175,18 @@ void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const ID *id, char separa */ void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], const ID *id, + const bool add_lib_hint, char separator_char) { - name[0] = id->lib ? (ID_MISSING(id) ? 'M' : 'L') : ID_IS_OVERRIDE_LIBRARY(id) ? 'O' : ' '; - name[1] = (id->flag & LIB_FAKEUSER) ? 'F' : ((id->us == 0) ? '0' : ' '); - name[2] = ' '; + int i = 0; + + if (add_lib_hint) { + name[i++] = id->lib ? (ID_MISSING(id) ? 'M' : 'L') : ID_IS_OVERRIDE_LIBRARY(id) ? 'O' : ' '; + } + name[i++] = (id->flag & LIB_FAKEUSER) ? 'F' : ((id->us == 0) ? '0' : ' '); + name[i++] = ' '; - BKE_id_full_name_get(name + 3, id, separator_char); + BKE_id_full_name_get(name + i, id, separator_char); } /** |