mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fix #3414. Only clear default scene, not custom scene when loading / creating IFCs.
This commit is contained in:
@@ -375,10 +375,6 @@ def load_post(scene):
|
||||
else:
|
||||
bpy.ops.workspace.append_activate(idname="BIM", filepath=os.path.join(cwd, "data", "workspace.blend"))
|
||||
|
||||
for obj in [bpy.data.objects.get("Camera"), bpy.data.objects.get("Light")]:
|
||||
if obj:
|
||||
bpy.data.objects.remove(obj)
|
||||
|
||||
# To improve usability for new users, we hijack the scene properties
|
||||
# tab. We override default scene properties panels with our own poll
|
||||
# to hide them unless the user has chosen to view Blender properties.
|
||||
|
||||
@@ -48,9 +48,6 @@ class NewProject(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
bpy.ops.wm.read_homefile()
|
||||
|
||||
for obj in bpy.data.objects:
|
||||
bpy.data.objects.remove(obj)
|
||||
|
||||
if self.preset == "metric_m":
|
||||
bpy.context.scene.BIMProjectProperties.export_schema = "IFC4"
|
||||
bpy.context.scene.unit_settings.system = "METRIC"
|
||||
@@ -104,6 +101,9 @@ class CreateProject(bpy.types.Operator):
|
||||
props = context.scene.BIMProjectProperties
|
||||
template = None if props.template_file == "0" else props.template_file
|
||||
blenderbim.bim.schema.reload(props.export_schema)
|
||||
if tool.Blender.is_default_scene():
|
||||
for obj in bpy.data.objects:
|
||||
bpy.data.objects.remove(obj)
|
||||
core.create_project(tool.Ifc, tool.Project, schema=props.export_schema, template=template)
|
||||
|
||||
def rollback(self, data):
|
||||
@@ -591,8 +591,9 @@ class LoadProject(bpy.types.Operator, IFCFileSelector):
|
||||
if self.should_start_fresh_session:
|
||||
bpy.ops.wm.read_homefile()
|
||||
|
||||
for obj in bpy.data.objects:
|
||||
bpy.data.objects.remove(obj)
|
||||
if tool.Blender.is_default_scene():
|
||||
for obj in bpy.data.objects:
|
||||
bpy.data.objects.remove(obj)
|
||||
|
||||
context.window_manager.fileselect_add(self)
|
||||
return {"RUNNING_MODAL"}
|
||||
|
||||
@@ -57,6 +57,14 @@ class Blender:
|
||||
area_index = screen_areas.index(current_area)
|
||||
return context.screen.BIMAreaProperties[area_index].tab == tab
|
||||
|
||||
@classmethod
|
||||
def is_default_scene(cls):
|
||||
if len(bpy.context.scene.objects) != 3:
|
||||
return False
|
||||
if {obj.type for obj in bpy.context.scene.objects} == {"MESH", "LIGHT", "CAMERA"}:
|
||||
return True
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def get_name(cls, ifc_class, name):
|
||||
if not bpy.data.objects.get(f"{ifc_class}/{name}"):
|
||||
|
||||
Reference in New Issue
Block a user