commit d080e7791e559d3f7b48d244bafe9b85e1dd095b Author: Sergey Sharybin Date: Mon Jul 19 14:46:01 2021 +0200 TEMP diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index 662faebdc78..ab84198f936 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -6042,9 +6042,7 @@ def km_clip_editor_tool_mask_add_vertex(params): "Mask Editing: Add Vertex and Slide", {"space_type": 'CLIP_EDITOR', "region_type": 'WINDOW'}, {"items": [ - ("mask.add_vertex_slide", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None), - ("mask.slide_point", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), - ("mask.slide_spline_curvature", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), + ("mask.draw_mask", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None), ]}, ) diff --git a/release/scripts/startup/bl_operators/__init__.py b/release/scripts/startup/bl_operators/__init__.py index 078b32f5e2a..5cae875272f 100644 --- a/release/scripts/startup/bl_operators/__init__.py +++ b/release/scripts/startup/bl_operators/__init__.py @@ -35,6 +35,7 @@ _modules = [ "file", "geometry_nodes", "image", + "mask", "mesh", "node", "object", diff --git a/release/scripts/startup/bl_operators/mask.py b/release/scripts/startup/bl_operators/mask.py new file mode 100644 index 00000000000..712ff26b583 --- /dev/null +++ b/release/scripts/startup/bl_operators/mask.py @@ -0,0 +1,63 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# +import bpy +from bpy.types import Operator +from bpy.props import EnumProperty + + +class MASK_OT_draw_mask(Operator): + """Smart code to draw a mask""" + bl_label = "Draw a mask" + bl_idname = "mask.draw_mask" + + type: EnumProperty( + name="Type", + items=( + ('AUTO', "Auto", ""), + ('VECTOR', "Vector", ""), + ('ALIGNED', "Aligned", ""), + ('ALIGNED_DOUBLESIDE', "Aligned", ""), + ('FREE', "Free", ""), + ), + ) + + def execute(self, context): + return bpy.ops.mask.add_vertex_slide( + MASK_OT_add_vertex={ + "type": self.type, + } + ) + + def invoke(self, context, _event): + bpy.ops.mask.add_vertex_slide( + 'INVOKE_REGION_WIN', + MASK_OT_add_vertex={ + "type": self.type, + } + ) + + # ignore return from operators above because they are 'RUNNING_MODAL', + # and cause this one not to be freed. T24671. + return {'FINISHED'} + + +classes = ( + MASK_OT_draw_mask, +) diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 4f5feb13358..d1cc1cfbe95 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -2505,13 +2505,13 @@ class _defs_mask_tools: def add_vertex_slide(): def draw_settings(_context, layout, tool): tool_settings = _context.tool_settings - props = tool.operator_properties("mask.add_vertex") + props = tool.operator_properties("mask.draw_mask") row = layout.row() row.label(text="Mask Settings") row.prop(props, "type") return dict( - idname="builtin.add_vertex_slide", + idname="builtin.draw_mask", label="Draw a Mask", icon="ops.curve.extrude_move", widget=None,