1 # SPDX-FileCopyrightText: 2019-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 from bpy
.types
import (
10 from bpy
.props
import (
15 from .object_menus
import *
16 from .snap_origin_cursor
import *
21 # ********** Edit Multiselect **********
22 class VIEW3D_MT_Edit_Multi(Menu
):
23 bl_label
= "Mode Select"
25 def draw(self
, context
):
28 layout
.operator("selectedit.vertex", text
="Vertex", icon
='VERTEXSEL')
29 layout
.operator("selectedit.edge", text
="Edge", icon
='EDGESEL')
30 layout
.operator("selectedit.face", text
="Face", icon
='FACESEL')
31 layout
.operator("selectedit.vertsfaces", text
="Vertex/Faces", icon
='VERTEXSEL')
32 layout
.operator("selectedit.vertsedges", text
="Vertex/Edges", icon
='EDGESEL')
33 layout
.operator("selectedit.edgesfaces", text
="Edges/Faces", icon
='FACESEL')
34 layout
.operator("selectedit.vertsedgesfaces", text
="Vertex/Edges/Faces", icon
='OBJECT_DATAMODE')
37 # ********** Edit Mesh Edge **********
38 class VIEW3D_MT_EditM_Edge(Menu
):
41 def draw(self
, context
):
43 layout
.operator_context
= 'INVOKE_REGION_WIN'
45 layout
.operator("mesh.mark_seam")
46 layout
.operator("mesh.mark_seam", text
="Clear Seam").clear
= True
49 layout
.operator("mesh.mark_sharp")
50 layout
.operator("mesh.mark_sharp", text
="Clear Sharp").clear
= True
51 layout
.operator("mesh.extrude_move_along_normals", text
="Extrude")
54 layout
.operator("mesh.edge_rotate",
55 text
="Rotate Edge CW").direction
= 'CW'
56 layout
.operator("mesh.edge_rotate",
57 text
="Rotate Edge CCW").direction
= 'CCW'
60 layout
.operator("TFM_OT_edge_slide", text
="Edge Slide")
61 layout
.operator("mesh.loop_multi_select", text
="Edge Loop")
62 layout
.operator("mesh.loop_multi_select", text
="Edge Ring").ring
= True
63 layout
.operator("mesh.loop_to_region")
64 layout
.operator("mesh.region_to_loop")
67 # multiple edit select modes.
68 class VIEW3D_OT_selecteditVertex(Operator
):
69 bl_idname
= "selectedit.vertex"
70 bl_label
= "Vertex Mode"
71 bl_description
= "Vert Select"
72 bl_options
= {'REGISTER', 'UNDO'}
74 def execute(self
, context
):
75 if context
.object.mode
!= "EDIT":
76 bpy
.ops
.object.mode_set(mode
="EDIT")
77 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
78 if bpy
.ops
.mesh
.select_mode
!= "EDGE, FACE":
79 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
83 class VIEW3D_OT_selecteditEdge(Operator
):
84 bl_idname
= "selectedit.edge"
85 bl_label
= "Edge Mode"
86 bl_description
= "Edge Select"
87 bl_options
= {'REGISTER', 'UNDO'}
89 def execute(self
, context
):
90 if context
.object.mode
!= "EDIT":
91 bpy
.ops
.object.mode_set(mode
="EDIT")
92 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='EDGE')
93 if bpy
.ops
.mesh
.select_mode
!= "VERT, FACE":
94 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='EDGE')
98 class VIEW3D_OT_selecteditFace(Operator
):
99 bl_idname
= "selectedit.face"
100 bl_label
= "Multiedit Face"
101 bl_description
= "Face Mode"
102 bl_options
= {'REGISTER', 'UNDO'}
104 def execute(self
, context
):
105 if context
.object.mode
!= "EDIT":
106 bpy
.ops
.object.mode_set(mode
="EDIT")
107 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='FACE')
108 if bpy
.ops
.mesh
.select_mode
!= "VERT, EDGE":
109 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='FACE')
113 # Components Multi Selection Mode
114 class VIEW3D_OT_selecteditVertsEdges(Operator
):
115 bl_idname
= "selectedit.vertsedges"
116 bl_label
= "Verts Edges Mode"
117 bl_description
= "Vert/Edge Select"
118 bl_options
= {'REGISTER', 'UNDO'}
120 def execute(self
, context
):
121 if context
.object.mode
!= "EDIT":
122 bpy
.ops
.object.mode_set(mode
="EDIT")
123 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
124 if bpy
.ops
.mesh
.select_mode
!= "VERT, EDGE, FACE":
125 bpy
.ops
.object.mode_set(mode
="EDIT")
126 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
127 bpy
.ops
.mesh
.select_mode(use_extend
=True, use_expand
=False, type='EDGE')
131 class VIEW3D_OT_selecteditEdgesFaces(Operator
):
132 bl_idname
= "selectedit.edgesfaces"
133 bl_label
= "Edges Faces Mode"
134 bl_description
= "Edge/Face Select"
135 bl_options
= {'REGISTER', 'UNDO'}
137 def execute(self
, context
):
138 if context
.object.mode
!= "EDIT":
139 bpy
.ops
.object.mode_set(mode
="EDIT")
140 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='EDGE')
141 if bpy
.ops
.mesh
.select_mode
!= "VERT, EDGE, FACE":
142 bpy
.ops
.object.mode_set(mode
="EDIT")
143 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='EDGE')
144 bpy
.ops
.mesh
.select_mode(use_extend
=True, use_expand
=False, type='FACE')
148 class VIEW3D_OT_selecteditVertsFaces(Operator
):
149 bl_idname
= "selectedit.vertsfaces"
150 bl_label
= "Verts Faces Mode"
151 bl_description
= "Vert/Face Select"
152 bl_options
= {'REGISTER', 'UNDO'}
154 def execute(self
, context
):
155 if context
.object.mode
!= "EDIT":
156 bpy
.ops
.object.mode_set(mode
="EDIT")
157 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
158 if bpy
.ops
.mesh
.select_mode
!= "VERT, EDGE, FACE":
159 bpy
.ops
.object.mode_set(mode
="EDIT")
160 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
161 bpy
.ops
.mesh
.select_mode(use_extend
=True, use_expand
=False, type='FACE')
165 class VIEW3D_OT_selecteditVertsEdgesFaces(Operator
):
166 bl_idname
= "selectedit.vertsedgesfaces"
167 bl_label
= "Verts Edges Faces Mode"
168 bl_description
= "Vert/Edge/Face Select"
169 bl_options
= {'REGISTER', 'UNDO'}
171 def execute(self
, context
):
172 if context
.object.mode
!= "EDIT":
173 bpy
.ops
.object.mode_set(mode
="EDIT")
174 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
175 if bpy
.ops
.mesh
.select_mode
!= "VERT, EDGE, FACE":
176 bpy
.ops
.object.mode_set(mode
="EDIT")
177 bpy
.ops
.mesh
.select_mode(use_extend
=False, use_expand
=False, type='VERT')
178 bpy
.ops
.mesh
.select_mode(use_extend
=True, use_expand
=False, type='EDGE')
179 bpy
.ops
.mesh
.select_mode(use_extend
=True, use_expand
=False, type='FACE')
186 VIEW3D_MT_Edit_Multi
,
187 VIEW3D_MT_EditM_Edge
,
188 VIEW3D_OT_selecteditVertex
,
189 VIEW3D_OT_selecteditEdge
,
190 VIEW3D_OT_selecteditFace
,
191 VIEW3D_OT_selecteditVertsEdges
,
192 VIEW3D_OT_selecteditEdgesFaces
,
193 VIEW3D_OT_selecteditVertsFaces
,
194 VIEW3D_OT_selecteditVertsEdgesFaces
,
198 # Register Classes & Hotkeys #
201 bpy
.utils
.register_class(cls
)
204 # Unregister Classes & Hotkeys #
207 for cls
in reversed(classes
):
208 bpy
.utils
.unregister_class(cls
)
211 if __name__
== "__main__":