Skip to content

Commit

Permalink
chore: tidy up swap_solver script
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan-hm committed Jun 5, 2022
1 parent 6845d30 commit 66df047
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions booleans/swap_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,28 @@ def invoke(self, context, event):
self.dirty = False

self.solve_mode = None

self.all_objects = [obj for obj in bpy.data.objects if obj.type == 'MESH']
self.reference_object_names = [obj.name for obj in context.selected_objects]
self.boolean_mods = []
self.fast_solver_count = 0
self.exact_solver_count = 0

for obj in self.all_objects:
all_scene_objects = [obj for obj in bpy.data.objects if obj.type == 'MESH']
selected_object_names = [obj.name for obj in context.selected_objects]
fast_solver_count = 0
exact_solver_count = 0

for obj in all_scene_objects:
mods = [mod for mod in obj.modifiers if mod.type == 'BOOLEAN']
for mod in mods:
if mod.object.name in self.reference_object_names:
if mod.object.name in selected_object_names:
self.boolean_mods.append(mod)

for mod in self.boolean_mods:
if mod.solver == 'FAST':
self.fast_solver_count += 1
fast_solver_count += 1
elif mod.solver == 'EXACT':
self.exact_solver_count += 1
exact_solver_count += 1

if self.fast_solver_count == len(self.boolean_mods):
if fast_solver_count == len(self.boolean_mods):
self.solve_mode = 'FAST'
elif self.exact_solver_count == len(self.boolean_mods):
elif exact_solver_count == len(self.boolean_mods):
self.solve_mode = 'EXACT'

capture_modifier_keys(self)
Expand Down

0 comments on commit 66df047

Please sign in to comment.