disable rel paths for adding ref images and textures with unsaved .ifc

This commit is contained in:
Andrej730
2023-12-14 18:53:54 +05:00
parent 35fbd3363d
commit 37a7c8a41f
2 changed files with 20 additions and 0 deletions
@@ -2591,6 +2591,17 @@ class AddReferenceImage(bpy.types.Operator, Operator):
options={"SKIP_SAVE"},
)
def draw(self, context):
layout = self.layout
if Path(tool.Ifc.get_path()).is_file():
layout.prop(self, "use_relative_path")
else:
self.use_relative_path = False
layout.label(text="Save the .ifc file first ")
layout.label(text="to use relative paths.")
layout.prop(self, "override_existing_image")
layout.prop(self, "use_existing_object_by_name")
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"}
@@ -428,6 +428,15 @@ class ChooseTextureMapPath(bpy.types.Operator):
filter_image: bpy.props.BoolProperty(default=True, options={"HIDDEN", "SKIP_SAVE"})
filter_folder: bpy.props.BoolProperty(default=True, options={"HIDDEN", "SKIP_SAVE"})
def draw(self, context):
layout = self.layout
if Path(tool.Ifc.get_path()).is_file():
layout.prop(self, "use_relative_path")
else:
self.use_relative_path = False
layout.label(text="Save the .ifc file first ")
layout.label(text="to use relative paths.")
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"}