mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 08:02:29 +00:00
Prevent crash on attempt to link the current .blend file
This commit is contained in:
@@ -687,6 +687,9 @@ class LinkIfc(bpy.types.Operator):
|
|||||||
files = [f.name for f in self.files] if self.files else [self.filepath]
|
files = [f.name for f in self.files] if self.files else [self.filepath]
|
||||||
for filename in files:
|
for filename in files:
|
||||||
filepath = os.path.join(self.directory, filename)
|
filepath = os.path.join(self.directory, filename)
|
||||||
|
if bpy.data.filepath and Path(filepath).samefile(bpy.data.filepath):
|
||||||
|
self.report({"INFO"}, "Can't link the current .blend file")
|
||||||
|
continue
|
||||||
new = context.scene.BIMProjectProperties.links.add()
|
new = context.scene.BIMProjectProperties.links.add()
|
||||||
if self.use_relative_path:
|
if self.use_relative_path:
|
||||||
filepath = os.path.relpath(filepath, bpy.path.abspath("//"))
|
filepath = os.path.relpath(filepath, bpy.path.abspath("//"))
|
||||||
|
|||||||
Reference in New Issue
Block a user