A preference for locking grids upon import

This commit is contained in:
Ryan Schultz
2022-09-11 11:06:50 -05:00
committed by Dion Moult
parent 227b1391bd
commit 806d147a85
2 changed files with 13 additions and 4 deletions
+6 -4
View File
@@ -562,8 +562,9 @@ class IfcImporter:
if grid.Representation:
shape = ifcopenshell.geom.create_shape(self.settings_2d, grid)
grid_obj = self.create_product(grid, shape)
grid_obj.lock_location = (True, True, True)
grid_obj.lock_rotation = (True, True, True)
if bpy.context.preferences.addons["blenderbim"].preferences.lock_grids_on_import:
grid_obj.lock_location = (True, True, True)
grid_obj.lock_rotation = (True, True, True)
collection = bpy.data.collections.new(self.get_name(grid))
u_axes = bpy.data.collections.new("UAxes")
collection.children.link(u_axes)
@@ -581,8 +582,9 @@ class IfcImporter:
shape = ifcopenshell.geom.create_shape(self.settings_2d, axis.AxisCurve)
mesh = self.create_mesh(axis, shape)
obj = bpy.data.objects.new(f"IfcGridAxis/{axis.AxisTag}", mesh)
obj.lock_location = (True, True, True)
obj.lock_rotation = (True, True, True)
if bpy.context.preferences.addons["blenderbim"].preferences.lock_grids_on_import:
obj.lock_location = (True, True, True)
obj.lock_rotation = (True, True, True)
self.link_element(axis, obj)
self.set_matrix_world(obj, grid_obj.matrix_world)
grid_collection.objects.link(obj)
+7
View File
@@ -114,6 +114,11 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
should_play_chaching_sound: BoolProperty(
name="Should Make A Cha-Ching Sound When Project Costs Updates", default=False
)
lock_grids_on_import: BoolProperty(
name="Will lock grids upon import", default=True
)
def draw(self, context):
layout = self.layout
@@ -149,6 +154,8 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
row.prop(self, "should_hide_empty_props")
row = layout.row()
row.prop(self, "should_play_chaching_sound")
row = layout.row()
row.prop(self, "lock_grids_on_import")
row = layout.row()
row.prop(context.scene.BIMProjectProperties, "should_disable_undo_on_save")