Fix #104467: Archimesh boolean doesn't work in 3.5 #104468

Merged
Damien Picard merged 1 commits from pioverfour/blender-addons:dp_fix_104467 into blender-v3.5-release 2023-03-06 14:51:24 +01:00
3 changed files with 14 additions and 20 deletions
Showing only changes of commit 581ec2845a - Show all commits

View File

@ -11,7 +11,7 @@ bl_info = {
"name": "Archimesh", "name": "Archimesh",
"author": "Antonio Vazquez (antonioya)", "author": "Antonio Vazquez (antonioya)",
"location": "View3D > Add Mesh / Sidebar > Create Tab", "location": "View3D > Add Mesh / Sidebar > Create Tab",
"version": (1, 2, 4), "version": (1, 2, 5),
"blender": (3, 0, 0), "blender": (3, 0, 0),
"description": "Generate rooms, doors, windows, and other architecture objects", "description": "Generate rooms, doors, windows, and other architecture objects",
"doc_url": "{BLENDER_MANUAL_URL}/addons/add_mesh/archimesh.html", "doc_url": "{BLENDER_MANUAL_URL}/addons/add_mesh/archimesh.html",

View File

@ -108,20 +108,16 @@ class ARCHIMESH_OT_Hole(Operator):
# --------------------------------------- # ---------------------------------------
for child in obj.parent.children: for child in obj.parent.children:
# noinspection PyBroadException # noinspection PyBroadException
try: if "archimesh.ctrl_hole" in child and child["archimesh.ctrl_hole"]:
if child["archimesh.ctrl_hole"]: # apply scale
# apply scale t = parentobj.RoomGenerator[0].wall_width
t = parentobj.RoomGenerator[0].wall_width if t > 0:
if t > 0: child.scale.y = (t + 0.45) / (child.dimensions.y / child.scale.y) # Add some gap
child.scale.y = (t + 0.45) / (child.dimensions.y / child.scale.y) # Add some gap else:
else: child.scale.y = 1
child.scale.y = 1 # add boolean modifier
# add boolean modifier if not isboolean(myroom, child):
if isboolean(myroom, child) is False: set_modifier_boolean(myroom, child)
set_modifier_boolean(myroom, child)
except:
# print("Unexpected error:" + str(sys.exc_info()))
pass
# --------------------------------------- # ---------------------------------------
# Now add the modifiers to baseboard # Now add the modifiers to baseboard

View File

@ -172,11 +172,9 @@ def set_modifier_solidify(myobject, width):
# Add modifier (boolean) # Add modifier (boolean)
# -------------------------------------------------------------------- # --------------------------------------------------------------------
def set_modifier_boolean(myobject, bolobject): def set_modifier_boolean(myobject, bolobject):
bpy.context.view_layer.objects.active = myobject boolean_modifier = myobject.modifiers.new("", 'BOOLEAN')
if bpy.context.view_layer.objects.active.name == myobject.name: boolean_modifier.operation = 'DIFFERENCE'
boolean_modifier = context.object.modifiers.new("", 'BOOLEAN') boolean_modifier.object = bolobject
boolean_modifier.operation = 'DIFFERENCE'
boolean_modifier.object = bolobject
# -------------------------------------------------------------------- # --------------------------------------------------------------------