[Bf-blender-cvs] [17125fb75d7] temp-T96709-painting-target: Show icon of tex paint slot.
Jeroen Bakker
noreply at git.blender.org
Tue Mar 29 17:13:11 CEST 2022
Commit: 17125fb75d7a8d74434a51f9da0f22cba4e10471
Author: Jeroen Bakker
Date: Tue Mar 29 17:13:06 2022 +0200
Branches: temp-T96709-painting-target
https://developer.blender.org/rB17125fb75d7a8d74434a51f9da0f22cba4e10471
Show icon of tex paint slot.
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/makesrna/intern/rna_material.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 99390beebc5..dd6521cfdf4 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -280,7 +280,7 @@ class TEXTURE_UL_texpaintslots(UIList):
# mat = data
if self.layout_type in {'DEFAULT', 'COMPACT'}:
- layout.prop(item, "name", text="", emboss=False, icon_value=icon)
+ layout.prop(item, "name", text="", emboss=False, icon_value=item.icon_value)
elif self.layout_type == 'GRID':
layout.alignment = 'CENTER'
layout.label(text="")
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 7a4e532dea6..999a55d66a1 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -334,6 +334,19 @@ static int rna_TexPaintSlot_name_length(PointerRNA *ptr)
return 0;
}
+static int rna_TexPaintSlot_icon_get(PointerRNA *ptr)
+{
+ TexPaintSlot *data = (TexPaintSlot *)(ptr->data);
+ if (data->ima != NULL) {
+ return ICON_IMAGE;
+ }
+ if (data->attribute_name != NULL) {
+ return ICON_COLOR;
+ }
+
+ return ICON_NONE;
+}
+
static bool rna_is_grease_pencil_get(PointerRNA *ptr)
{
Material *ma = (Material *)ptr->data;
@@ -1023,6 +1036,11 @@ static void rna_def_tex_slot(BlenderRNA *brna)
prop, "rna_TexPaintSlot_name_get", "rna_TexPaintSlot_name_length", NULL);
RNA_def_property_ui_text(prop, "Name", "Name of the slot");
+ prop = RNA_def_property(srna, "icon_value", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_TexPaintSlot_icon_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Icon", "Paint slot icon");
+
prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
RNA_def_property_string_maxlength(prop, 64); /* else it uses the pointer size! */
RNA_def_property_string_sdna(prop, NULL, "uvname");
More information about the Bf-blender-cvs
mailing list