Operator: Add 'dissolve_and_intersect' option for 'Extrude and Move on Normals'

This allows easy choice of operators when editing keymaps
This commit is contained in:
Germano Cavalcante 2020-04-15 16:02:16 -03:00
parent 03a931a876
commit 851baa40a1
1 changed files with 19 additions and 2 deletions

View File

@ -72,13 +72,19 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
bl_label = "Extrude and Move on Normals"
bl_idname = "view3d.edit_mesh_extrude_move_normal"
dissolve_and_intersect: BoolProperty(
name="dissolve_and_intersect",
default=False,
description="Dissolves adjacent faces and intersects new geometry"
)
@classmethod
def poll(cls, context):
obj = context.active_object
return (obj is not None and obj.mode == 'EDIT')
@staticmethod
def extrude_region(context, use_vert_normals):
def extrude_region(context, use_vert_normals, dissolve_and_intersect):
mesh = context.object.data
totface = mesh.total_face_sel
@ -91,6 +97,17 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
'INVOKE_REGION_WIN',
TRANSFORM_OT_shrink_fatten={},
)
elif dissolve_and_intersect:
bpy.ops.mesh.extrude_region_dissolve_move_intersect(
'INVOKE_REGION_WIN',
MESH_OT_extrude_region={
"use_dissolve_ortho_edges": True,
},
TRANSFORM_OT_translate={
"orient_type": 'NORMAL',
"constraint_axis": (False, False, True),
},
)
else:
bpy.ops.mesh.extrude_region_move(
'INVOKE_REGION_WIN',
@ -119,7 +136,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
return {'FINISHED'}
def execute(self, context):
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, False)
return VIEW3D_OT_edit_mesh_extrude_move.extrude_region(context, False, self.dissolve_and_intersect)
def invoke(self, context, _event):
return self.execute(context)