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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-03-29 18:26:13 +0300
committerBastien Montagne <bastien@blender.org>2022-03-29 18:58:53 +0300
commit9394d455af43b3b4b00bf4f65e250f14567970fd (patch)
treed0e39f50dd2540429770a10180f37103c9ff3e06 /source
parent5adcf6c85e4c28fcfda0048a9ec7cceae105046d (diff)
LibOverride: Add a new 'virtual' non-editable override icon and use it in Outliner.
Ref: {T95707}.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/UI_icons.h1
-rw-r--r--source/blender/editors/interface/interface_icons.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index 8607c6d242c..94232a5108d 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -982,6 +982,7 @@ DEF_ICON_VECTOR(SEQUENCE_COLOR_08)
DEF_ICON_VECTOR(SEQUENCE_COLOR_09)
DEF_ICON_VECTOR(LIBRARY_DATA_INDIRECT)
+DEF_ICON_VECTOR(LIBRARY_DATA_OVERRIDE_NONEDITABLE)
/* Events. */
DEF_ICON_COLOR(EVENT_A)
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 887781beda1..e3bf1a48907 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -476,6 +476,21 @@ static void vicon_strip_color_draw_library_data_indirect(
x, y, ICON_LIBRARY_DATA_DIRECT, aspect, ICON_INDIRECT_DATA_ALPHA * alpha, 0.0f, NULL, false);
}
+static void vicon_strip_color_draw_library_data_override_noneditable(
+ int x, int y, int w, int UNUSED(h), float alpha)
+{
+ const float aspect = (float)ICON_DEFAULT_WIDTH / (float)w;
+
+ UI_icon_draw_ex(x,
+ y,
+ ICON_LIBRARY_DATA_OVERRIDE,
+ aspect,
+ ICON_INDIRECT_DATA_ALPHA * alpha * 0.75f,
+ 0.0f,
+ NULL,
+ false);
+}
+
/* Dynamically render icon instead of rendering a plain color to a texture/buffer
* This is not strictly a "vicon", as it needs access to icon->obj to get the color info,
* but it works in a very similar way.
@@ -987,6 +1002,8 @@ static void init_internal_icons(void)
def_internal_vicon(ICON_SEQUENCE_COLOR_09, vicon_strip_color_draw_09);
def_internal_vicon(ICON_LIBRARY_DATA_INDIRECT, vicon_strip_color_draw_library_data_indirect);
+ def_internal_vicon(ICON_LIBRARY_DATA_OVERRIDE_NONEDITABLE,
+ vicon_strip_color_draw_library_data_override_noneditable);
}
static void init_iconfile_list(struct ListBase *list)
@@ -2192,6 +2209,10 @@ int UI_icon_from_library(const ID *id)
return ICON_LIBRARY_DATA_DIRECT;
}
if (ID_IS_OVERRIDE_LIBRARY(id)) {
+ if (!ID_IS_OVERRIDE_LIBRARY_REAL(id) ||
+ (id->override_library->flag & IDOVERRIDE_LIBRARY_FLAG_SYSTEM_DEFINED) != 0) {
+ return ICON_LIBRARY_DATA_OVERRIDE_NONEDITABLE;
+ }
return ICON_LIBRARY_DATA_OVERRIDE;
}
if (ID_IS_ASSET(id)) {