Skip to content

Commit

Permalink
fix: ensure active boolean utils don't affect the geometry of the tar…
Browse files Browse the repository at this point in the history
…get object while using snap_align
  • Loading branch information
tristan-hm committed May 11, 2022
1 parent d1bc6cf commit e796693
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions utils/snap_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ def invoke(self, context, event):
self.reference_obj_original_location = self.reference_obj.location.copy()
self.reference_obj_original_rotation = self.reference_obj.rotation_euler.copy()

self.affected_boolean_modifiers = {}
for mod in context.active_object.modifiers:
if mod.type == 'BOOLEAN' and mod.object == self.reference_obj:
self.affected_boolean_modifiers[mod.name] = mod.show_viewport
mod.show_viewport = False

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

Expand Down Expand Up @@ -204,15 +210,23 @@ def recalculate_points(self, context, mouse_coords):
self.operate(context)


def finish(self, context):
def clean_up(self, context):
bpy.ops.object.hide_view_clear()
for mod in context.active_object.modifiers:
if mod.type == 'BOOLEAN' and mod.object == self.reference_obj:
mod.show_viewport = self.affected_boolean_modifiers[mod.name]



def finish(self, context):
self.clean_up(context)

unregister_draw_handler()
unregister_points_handler()


def revert(self, context):
bpy.ops.object.hide_view_clear()
self.clean_up(context)

self.reference_obj.location = self.reference_obj_original_location
self.reference_obj.rotation_euler = self.reference_obj_original_rotation
Expand Down

0 comments on commit e796693

Please sign in to comment.