mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
fix loading and unloading linked IFCs with a relative path
This commit is contained in:
@@ -850,7 +850,7 @@ class UnloadLink(bpy.types.Operator):
|
|||||||
for scene in bpy.data.scenes:
|
for scene in bpy.data.scenes:
|
||||||
if scene.library and scene.library.filepath == filepath:
|
if scene.library and scene.library.filepath == filepath:
|
||||||
bpy.data.scenes.remove(scene)
|
bpy.data.scenes.remove(scene)
|
||||||
link = context.scene.BIMProjectProperties.links.get(filepath)
|
link = context.scene.BIMProjectProperties.links.get(self.filepath)
|
||||||
link.is_loaded = False
|
link.is_loaded = False
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
@@ -866,7 +866,7 @@ class LoadLink(bpy.types.Operator):
|
|||||||
filepath = self.filepath
|
filepath = self.filepath
|
||||||
if not os.path.isabs(filepath):
|
if not os.path.isabs(filepath):
|
||||||
filepath = os.path.abspath(os.path.join(bpy.path.abspath("//"), filepath))
|
filepath = os.path.abspath(os.path.join(bpy.path.abspath("//"), filepath))
|
||||||
with bpy.data.libraries.load(self.filepath, link=True) as (data_from, data_to):
|
with bpy.data.libraries.load(filepath, link=True) as (data_from, data_to):
|
||||||
data_to.scenes = data_from.scenes
|
data_to.scenes = data_from.scenes
|
||||||
for scene in bpy.data.scenes:
|
for scene in bpy.data.scenes:
|
||||||
if not scene.library or scene.library.filepath != filepath:
|
if not scene.library or scene.library.filepath != filepath:
|
||||||
@@ -875,7 +875,7 @@ class LoadLink(bpy.types.Operator):
|
|||||||
if "IfcProject" not in child.name:
|
if "IfcProject" not in child.name:
|
||||||
continue
|
continue
|
||||||
bpy.data.scenes[0].collection.children.link(child)
|
bpy.data.scenes[0].collection.children.link(child)
|
||||||
link = context.scene.BIMProjectProperties.links.get(filepath)
|
link = context.scene.BIMProjectProperties.links.get(self.filepath)
|
||||||
link.is_loaded = True
|
link.is_loaded = True
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user