From 9c28f0eb37aebd6e5eae0763b008ef02d5ce081b Mon Sep 17 00:00:00 2001 From: Dennis Ranish Date: Wed, 8 Jun 2022 12:10:32 -0700 Subject: D14823: Adds operator to duplicate the active color attribute layer Fixes T97706 Adds operator to duplicate the active color attribute layer. Adds `"Color Attribute Specials"` menu to color attribute ui to access the `"geometry.color_attribute_duplicate"` operator. Internally adds a function that duplicates a referenced CustomDataLayer - `BKE_id_attribute_duplicate` mostly copies the existing `BKE_id_attribute_new` - but gets the type and domain from the referenced layer - and copies the data from the old layer into the new layer Reviewed By: Joseph Eagar & Hans Goudey & Julien Kaspar Differential Revision: https://developer.blender.org/D14823 Ref D14823 --- release/scripts/startup/bl_ui/properties_data_mesh.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 15d25f71419..764299e7ce3 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -64,6 +64,18 @@ class MESH_MT_shape_key_context_menu(Menu): layout.operator("object.shape_key_move", icon='TRIA_DOWN_BAR', text="Move to Bottom").type = 'BOTTOM' +class MESH_MT_color_attribute_context_menu(Menu): + bl_label = "Color Attribute Specials" + + def draw(self, _context): + layout = self.layout + + props = layout.operator( + "geometry.color_attribute_duplicate", + icon='DUPLICATE', + ) + + class MESH_MT_attribute_context_menu(Menu): bl_label = "Attribute Specials" @@ -660,12 +672,16 @@ class DATA_PT_vertex_colors(DATA_PT_mesh_attributes, Panel): col.operator("geometry.color_attribute_add", icon='ADD', text="") col.operator("geometry.color_attribute_remove", icon='REMOVE', text="") - self.draw_attribute_warnings(context, layout) + col.separator() + col.menu("MESH_MT_color_attribute_context_menu", icon='DOWNARROW_HLT', text="") + + self.draw_attribute_warnings(context, layout) classes = ( MESH_MT_vertex_group_context_menu, MESH_MT_shape_key_context_menu, + MESH_MT_color_attribute_context_menu, MESH_MT_attribute_context_menu, MESH_UL_vgroups, MESH_UL_fmaps, -- cgit v1.2.3