[Bf-blender-cvs] [3fc9fc1cb46] master: UI: Indicate asset data-blocks with an icon in Outliners & search menus

Julian Eisel noreply at git.blender.org
Wed Dec 16 12:11:28 CET 2020


Commit: 3fc9fc1cb46a49bbfa2da4443fb4edefcdc3b89d
Author: Julian Eisel
Date:   Wed Dec 16 11:58:30 2020 +0100
Branches: master
https://developer.blender.org/rB3fc9fc1cb46a49bbfa2da4443fb4edefcdc3b89d

UI: Indicate asset data-blocks with an icon in Outliners & search menus

It's useful to easily see which data-blocks are assets and which not. So just
like we usually show the library linking/override icons, we show the asset icon
there (these are mutually exclusive data-block states).

Uses the `'MAT_SPHERE_SKY` icon, which wasn't used before (except by an
add-on!) and is sorta fitting, but not quite. We should either change this one
or add an own asset icon. Meanwhile this isn't too bad :)

Also adds an internal macro to check if a data-block is an asset, consistent to
how we do it for libraries and library overrides.

===================================================================

M	source/blender/editors/interface/interface_icons.c
M	source/blender/makesdna/DNA_ID.h

===================================================================

diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 1c09dc6f4df..08e9ea31b53 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -2199,6 +2199,9 @@ int UI_icon_from_library(const ID *id)
   if (ID_IS_OVERRIDE_LIBRARY(id)) {
     return ICON_LIBRARY_DATA_OVERRIDE;
   }
+  if (ID_IS_ASSET(id)) {
+    return ICON_MAT_SPHERE_SKY;
+  }
 
   return ICON_NONE;
 }
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index af8e83a2c44..265baa16cc5 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -509,6 +509,8 @@ typedef enum ID_Type {
 #define ID_IS_OVERRIDE_LIBRARY_TEMPLATE(_id) \
   (((ID *)(_id))->override_library != NULL && ((ID *)(_id))->override_library->reference == NULL)
 
+#define ID_IS_ASSET(_id) (((const ID *)(_id))->asset_data != NULL)
+
 /* Check whether datablock type is covered by copy-on-write. */
 #define ID_TYPE_IS_COW(_id_type) (!ELEM(_id_type, ID_BR, ID_PAL, ID_IM))



More information about the Bf-blender-cvs mailing list