Archimesh: fix usages of bpy.ops.object.select_all

Fixes T67048: Adding archimesh stairs object to the scene flips normals
of all other objects in scene

Reviewers: antoniov, brecht

Maniphest Tasks: T67048

Differential Revision: https://developer.blender.org/D5282
This commit is contained in:
Philipp Oeser 2019-07-17 10:10:40 +02:00
parent 37fe422f9a
commit 184f7341bd
Notes: blender-bot 2023-02-14 19:12:11 +01:00
Referenced by issue #67048, Adding archimesh stairs object to the scene flips normals of all other objects in scene
9 changed files with 21 additions and 21 deletions

View File

@ -172,7 +172,7 @@ def create_book_mesh(self):
for o in bpy.data.objects:
if o.select_get() is True:
o.select_set(False)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
generate_books(self)
return

View File

@ -359,7 +359,7 @@ def create_column_mesh(self):
if o.select_get() is True:
o.select_set(False)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
radio_top = self.rad_top
if self.keep_size is True:
@ -380,7 +380,7 @@ def create_column_mesh(self):
# Create circular column
# ------------------------
if self.model == "1":
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
mycolumn = create_circular_column(self, "Column", radio_top, radio_mid, radio_bottom, height)
mycolumn.select_set(True)
bpy.context.view_layer.objects.active = mycolumn
@ -392,7 +392,7 @@ def create_column_mesh(self):
# ------------------------
if self.model == "2":
mycolumn = create_rectangular_base(self, "Column", self.col_sx, self.col_sy, height)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
mycolumn.select_set(True)
bpy.context.view_layer.objects.active = mycolumn
set_normals(mycolumn)
@ -401,7 +401,7 @@ def create_column_mesh(self):
# ------------------------
if self.cir_base is True:
cir_bottom = create_torus("Column_cir_bottom", radio_bottom, self.cir_base_r, self.cir_base_z)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
cir_bottom.select_set(True)
bpy.context.view_layer.objects.active = cir_bottom
set_modifier_subsurf(cir_bottom)
@ -417,7 +417,7 @@ def create_column_mesh(self):
if self.box_base is True:
box_bottom = create_rectangular_base(self, "Column_box_bottom", self.box_base_x, self.box_base_y,
self.box_base_z)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
box_bottom.select_set(True)
bpy.context.view_layer.objects.active = box_bottom
box_bottom.parent = mycolumn
@ -433,7 +433,7 @@ def create_column_mesh(self):
# ------------------------
if self.cir_top is True:
cir_top = create_torus("Column_cir_top", radio_top, self.cir_top_r, self.cir_top_z)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
cir_top.select_set(True)
bpy.context.view_layer.objects.active = cir_top
set_modifier_subsurf(cir_top)
@ -449,7 +449,7 @@ def create_column_mesh(self):
if self.box_top is True:
box_top = create_rectangular_base(self, "Column_box_top", self.box_top_x, self.box_top_y,
self.box_top_z, self.ramp)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
box_top.select_set(True)
bpy.context.view_layer.objects.active = box_top
set_normals(box_top)
@ -465,7 +465,7 @@ def create_column_mesh(self):
myarc = create_arc("Column_arch", self.arc_radio, self.arc_gap, self.arc_width,
self.array_space_factor)
myarc.parent = mycolumn
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
myarc.select_set(True)
bpy.context.view_layer.objects.active = myarc
set_normals(myarc)
@ -555,7 +555,7 @@ def create_column_mesh(self):
mat = create_diffuse_material("Column_arch", False, 0.8, 0.8, 0.8)
set_material(myarc, mat)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
mycolumn.select_set(True)
bpy.context.view_layer.objects.active = mycolumn

View File

@ -166,7 +166,7 @@ def create_japan_mesh(self):
for o in bpy.data.objects:
if o.select_get() is True:
o.select_set(False)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
# Create units
generate_japan(self)
@ -252,7 +252,7 @@ def create_roller_mesh(self):
for o in bpy.data.objects:
if o.select_get() is True:
o.select_set(False)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
generate_roller(self)
return

View File

@ -614,7 +614,7 @@ def create_kitchen_mesh(self):
for o in bpy.data.objects:
if o.select_get() is True:
o.select_set(False)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
# Create cabinets
generate_cabinets(self)

View File

@ -401,7 +401,7 @@ def create_light_mesh(self):
for o in bpy.data.objects:
if o.select_get() is True:
o.select_set(False)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
generate_light(self)
return

View File

@ -160,7 +160,7 @@ def create_roof_mesh(self):
for o in bpy.data.objects:
if o.select_get() is True:
o.select_set(False)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
mydata = create_roof(self)
myroof = mydata[0]
@ -210,7 +210,7 @@ def create_roof_mesh(self):
mat = create_diffuse_material("Roof_material", False, 0.482, 0.061, 0.003, 0.581, 0.105, 0.068, 0.01)
set_material(myroof, mat)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
myroof.select_set(True)
bpy.context.view_layer.objects.active = myroof
return

View File

@ -264,7 +264,7 @@ def create_shelves_mesh(self):
for o in bpy.data.objects:
if o.select_get() is True:
o.select_set(False)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
# Create units
generate_shelves(self)

View File

@ -209,7 +209,7 @@ def create_stairs_mesh(self):
if o.select_get() is True:
o.select_set(False)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
# ------------------------
# Create stairs
@ -245,7 +245,7 @@ def create_stairs_mesh(self):
mat = create_diffuse_material("Stairs_material", False, 0.8, 0.8, 0.8)
set_material(mystairs, mat)
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
mystairs.select_set(True)
bpy.context.view_layer.objects.active = mystairs

View File

@ -101,7 +101,7 @@ def set_modifier_subsurf(myobject):
# Add modifier (mirror)
# --------------------------------------------------------------------
def set_modifier_mirror(myobject, axis="Y"):
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
myobject.select_set(True)
bpy.context.view_layer.objects.active = myobject
if bpy.context.view_layer.objects.active.name == myobject.name:
@ -130,7 +130,7 @@ def set_modifier_mirror(myobject, axis="Y"):
# Add modifier (array)
# --------------------------------------------------------------------
def set_modifier_array(myobject, axis, move, repeat, fix=False, fixmove=0, zmove=0):
bpy.ops.object.select_all(False)
bpy.ops.object.select_all(action='DESELECT')
myobject.select_set(True)
bpy.context.view_layer.objects.active = myobject
if bpy.context.view_layer.objects.active.name == myobject.name: