Skip to content

Commit

Permalink
feat: add temporary triangulation to active object during snap_align …
Browse files Browse the repository at this point in the history
…operations to increase face points
  • Loading branch information
tristan-hm committed May 11, 2022
1 parent 8301845 commit 640bc8c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions utils/snap_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def invoke(self, context, event):
self.affected_boolean_modifiers[mod.name] = mod.show_viewport
mod.show_viewport = False

self.triangulate_modifier = context.active_object.modifiers.new('Snap Align Triangulate — ND', 'TRIANGULATE')
self.triangulate_modifier.min_vertices = 5

depsgraph = context.evaluated_depsgraph_get()
object_eval = context.object.evaluated_get(depsgraph)

Expand Down Expand Up @@ -221,6 +224,8 @@ def clean_up(self, context):
if mod.type == 'BOOLEAN' and mod.object == self.reference_obj:
mod.show_viewport = self.affected_boolean_modifiers[mod.name]

context.active_object.modifiers.remove(self.triangulate_modifier)

bpy.ops.object.select_all(action='DESELECT')
self.reference_obj.select_set(True)
context.view_layer.objects.active = self.reference_obj
Expand Down

0 comments on commit 640bc8c

Please sign in to comment.