Convert relative path to absolute on selection (fix relative path with .blend file loaded)

This commit is contained in:
Francesco Bellini 2024-09-01 15:45:24 +02:00
parent 3fc8da77d2
commit 2965688087

View File

@ -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="")