From 8b7cd1ed2a17e40661101eea4adae99e8e3d02e9 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 8 Apr 2022 16:37:35 +0200 Subject: Painting: Canvas switcher for painting brushes/tools. This patch adds color attributes to TexPaintSlot. This allows an easier selection when painting color attributes. Previously when selecting a paint tool the user had to start a stroke, before the UI reflected the correct TexPaintSlot. Now when switching the slot the active tool is checked and immediate the UI is drawn correctly. In the future the canvas selector will also be used to select an image or image texture node to paint on. Basic implementation has already been done inside this patch. A limitation of this patch is that is isn't possible anymore to rename images directly from the selection panel. This is currently allowed in master. But as CustomDataLayers aren't ID fields and not owned by the material supporting this wouldn't be easy. {F12953989} In the future we should update the create slot operator to also include color attributes. Sources could also be extended to use other areas of the object that use image textures (particles, geom nodes, etc... ). Reviewed By: brecht Maniphest Tasks: T96709 Differential Revision: https://developer.blender.org/D14455 --- release/scripts/startup/bl_ui/properties_data_mesh.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'release/scripts/startup/bl_ui/properties_data_mesh.py') diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 97519e55b48..1bfd82cc790 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -565,7 +565,7 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel): layout.label(text="Name collisions: " + ", ".join(set(colliding_names)), icon='ERROR') -class MESH_UL_color_attributes(UIList): +class ColorAttributesListBase(): display_domain_names = { 'POINT': "Vertex", 'EDGE': "Edge", @@ -588,6 +588,8 @@ class MESH_UL_color_attributes(UIList): return ret, idxs + +class MESH_UL_color_attributes(UIList, ColorAttributesListBase): def draw_item(self, _context, layout, data, attribute, _icon, _active_data, _active_propname, _index): data_type = attribute.bl_rna.properties['data_type'].enum_items[attribute.data_type] @@ -613,6 +615,12 @@ class MESH_UL_color_attributes(UIList): sub.label(text="%s ▶ %s" % (domain_name, data_type.name)) +class MESH_UL_color_attributes_selector(UIList, ColorAttributesListBase): + def draw_item(self, _context, layout, data, attribute, _icon, _active_data, _active_propname, _index): + layout.emboss = 'NONE' + layout.prop(attribute, "name", text="", icon='COLOR') + + class DATA_PT_vertex_colors(DATA_PT_mesh_attributes, Panel): bl_label = "Color Attributes" bl_options = {'DEFAULT_CLOSED'} @@ -663,6 +671,7 @@ classes = ( DATA_PT_customdata, DATA_PT_custom_props_mesh, MESH_UL_color_attributes, + MESH_UL_color_attributes_selector, ) if __name__ == "__main__": # only for live edit. -- cgit v1.2.3