Skip to content

Commit

Permalink
Added Button to Quickly Add Triangulate Modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Schneider committed Oct 3, 2021
1 parent 7f72ddf commit 01b8f1e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
8 changes: 6 additions & 2 deletions blendercadessentials/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name" : "Blender CAD Essentials",
"author" : "Sebastian Schneider",
"description" : "Collection of often needed tools when working with imported CAD Data",
"blender" : (2, 90, 0),
'version': (0, 0, 6),
"blender" : (2, 93, 0),
'version': (0, 0, 7),
"location" : "View3D",
"warning" : "",
"category" : "Generic"
Expand Down Expand Up @@ -52,6 +52,9 @@ def draw(self, context):
row = layout.row(align=True)
row.operator('mesh.bce_addfwnmodifier' ,text="Add FWVN Modifier")

row = layout.row(align=True)
row.operator('mesh.bce_addtrimodifier' ,text="Add Triangulate Modifier")

row = layout.row(align=True)
row.operator('mesh.bce_renameuvmaps' ,text="Rename UV Maps")

Expand All @@ -74,6 +77,7 @@ def draw(self, context):
bce_classes.ConvertHardEdgesToSeams,
bce_classes.RenameUVMaps,
bce_classes.AddFWNModifier,
bce_classes.AddTriModifier,
bce_classes.AddSmoothing,
bce_classes.DeleteLinkedObjects,
)
Expand Down
18 changes: 18 additions & 0 deletions blendercadessentials/bce_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,24 @@ def execute(self, context):
self.addfwnmodifier(context)
return{'FINISHED'}

class AddTriModifier(bpy.types.Operator):
bl_idname = "mesh.bce_addtrimodifier"
bl_label = "Addes Triangulate Modifier"
bl_description = "Triangulates Mesh"
bl_options = {'REGISTER', 'UNDO'}

def addtrimodifier(self, context):
selection = bpy.context.selected_objects
for o in selection:
bpy.context.view_layer.objects.active = o
if o.type in ['MESH']:
bpy.ops.object.ml_modifier_add(modifier_type="TRIANGULATE")
bpy.context.object.modifiers["Triangulate"].keep_custom_normals = True

def execute(self, context):
self.addtrimodifier(context)
return{'FINISHED'}

class AddSmoothing(bpy.types.Operator):
bl_idname = "mesh.bce_addsmoothing"
bl_label = "Adds FWVN Modifier"
Expand Down

0 comments on commit 01b8f1e

Please sign in to comment.