diff --git a/scripts/startup/bl_ui/properties_data_mesh.py b/scripts/startup/bl_ui/properties_data_mesh.py index 7cb1b173210..a772fcee153 100644 --- a/scripts/startup/bl_ui/properties_data_mesh.py +++ b/scripts/startup/bl_ui/properties_data_mesh.py @@ -84,6 +84,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_shape_key_tree_context_menu(Menu): + bl_label = "Shape Key context menu" + + def draw(self, _context): + layout = self.layout + layout.operator("object.shape_key_make_basis", text="Make Basis") + layout.operator("object.shape_key_copy", icon='DUPLICATE', text="Duplicate") + layout.separator() + layout.operator("object.shape_key_move", icon='TRIA_UP_BAR', text="Move After Basis").type = 'TOP' + layout.operator("object.shape_key_move", icon='TRIA_DOWN_BAR', text="Move to Last").type = 'BOTTOM' + + class MESH_MT_color_attribute_context_menu(Menu): bl_label = "Color Attribute Specials" @@ -690,6 +702,7 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, Panel): classes = ( MESH_MT_vertex_group_context_menu, MESH_MT_shape_key_context_menu, + MESH_MT_shape_key_tree_context_menu, MESH_MT_color_attribute_context_menu, MESH_MT_attribute_context_menu, MESH_UL_vgroups, diff --git a/source/blender/editors/object/interface_template_shape_key_tree.cc b/source/blender/editors/object/interface_template_shape_key_tree.cc index c30434a5921..c8a80b52660 100644 --- a/source/blender/editors/object/interface_template_shape_key_tree.cc +++ b/source/blender/editors/object/interface_template_shape_key_tree.cc @@ -230,6 +230,15 @@ class ShapeKeyItem : public ui::AbstractTreeViewItem { return label_; } + void build_context_menu(bContext &C, uiLayout &layout) const override + { + MenuType *mt = WM_menutype_find("MESH_MT_shape_key_tree_context_menu", true); + if (!mt) { + return; + } + UI_menutype_draw(&C, mt, &layout); + } + std::unique_ptr create_drag_controller() const override { return std::make_unique(