From 29656880875cd8a8d6aed3615c47202afad5ff24 Mon Sep 17 00:00:00 2001 From: doc-code Date: Sun, 1 Sep 2024 15:45:24 +0200 Subject: [PATCH] Convert relative path to absolute on selection (fix relative path with .blend file loaded) --- addon/classes/ots.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addon/classes/ots.py b/addon/classes/ots.py index 4bf38fb..54b5e82 100644 --- a/addon/classes/ots.py +++ b/addon/classes/ots.py @@ -24,6 +24,9 @@ def on_path_update(self, context): if not self.name and self.path: self.name = name_from_path(self.path) context.preferences.is_dirty = True + if self.path and self.path.startswith('//'): + self.path = bpy.path.abspath(self.path) + context.preferences.is_dirty = True class TemplateItem(PropertyGroup): name: StringProperty( @@ -47,7 +50,7 @@ class CustomTemplatesPreferences(AddonPreferences): text=f"Your custom templates ({len(self.projects)})") row = layout.row() row.template_list("UI_UL_list", "custom_templates", - self, "projects", self, "active_template_index") + self, "projects", self, "active_template_index", rows=6, maxrows=6) col = row.column(align=True) col.menu("CT_MT_templates_menu", icon='DOWNARROW_HLT', text="")