Avoid change directory

master
ChristopheSeux 2023-10-03 11:59:40 +02:00
parent 242cf7dce7
commit 983c9d5622
1 changed files with 3 additions and 3 deletions

View File

@ -17,8 +17,6 @@ class BW_context:
self._folder_items = [] self._folder_items = []
self.shapes = {} # used to store vert co for the transform properties self.shapes = {} # used to store vert co for the transform properties
os.chdir(self.module_dir/'widgets')
@property @property
def addon(self): def addon(self):
from bpy import context from bpy import context
@ -201,7 +199,7 @@ class BW_context:
if self._folder_items: if self._folder_items:
id = max([i[-1] for i in self._folder_items])+1 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): for f in reversed(self._folder_items):
if self.abspath(f[0]) not in self.folder_paths: if self.abspath(f[0]) not in self.folder_paths:
@ -247,6 +245,8 @@ class BW_context:
if path.startswith('//'): if path.startswith('//'):
path = './' + path[2:] path = './' + path[2:]
elif path.startswith('./') or not '/' in str(path):
path = self.module_dir/'widgets' / path
return Path(path).absolute().resolve() return Path(path).absolute().resolve()