From 983c9d5622dd3cf94264b7956fdec6294c5b8004 Mon Sep 17 00:00:00 2001 From: ChristopheSeux Date: Tue, 3 Oct 2023 11:59:40 +0200 Subject: [PATCH] Avoid change directory --- context.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/context.py b/context.py index bc98d81..5e44cd4 100644 --- a/context.py +++ b/context.py @@ -17,8 +17,6 @@ class BW_context: self._folder_items = [] self.shapes = {} # used to store vert co for the transform properties - os.chdir(self.module_dir/'widgets') - @property def addon(self): from bpy import context @@ -201,7 +199,7 @@ class BW_context: if self._folder_items: id = max([i[-1] for i in self._folder_items])+1 - self._folder_items.append((str(folder), folder.name, '', '', id)) + self._folder_items.append((str(folder), bpy.path.display_name(folder.name), '', '', id)) for f in reversed(self._folder_items): if self.abspath(f[0]) not in self.folder_paths: @@ -247,6 +245,8 @@ class BW_context: if path.startswith('//'): path = './' + path[2:] + elif path.startswith('./') or not '/' in str(path): + path = self.module_dir/'widgets' / path return Path(path).absolute().resolve()