fix prefix set by env

2.0.11

- fix: prefix set by project environment
gpv2
Pullusb 2022-10-25 17:24:05 +02:00
parent 88cdbf88cd
commit 4622aa4520
2 changed files with 24 additions and 5 deletions

View File

@ -1,5 +1,9 @@
# Changelog
2.0.11
- fix: prefix set by project environment
2.0.10
- fix: poll error in console

View File

@ -4,7 +4,7 @@ bl_info = {
"name": "GP toolbox",
"description": "Tool set for Grease Pencil in animation production",
"author": "Samuel Bernou, Christophe Seux",
"version": (2, 0, 10),
"version": (2, 0, 11),
"blender": (3, 0, 0),
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
"warning": "",
@ -654,23 +654,38 @@ class GPTB_prefs(bpy.types.AddonPreferences):
### --- ENV_PROP ---
def set_namespace_env(name_env, prop_group):
tag_list = os.getenv(name_env)
current_pfix = []
if tag_list:
tag_list = tag_list.strip(',').split(',')
current_pfix = [n.tag for n in prop_group.namespaces if n.tag]
for n in prop_group.namespaces:
print(n.tag, n.name)
for p in tag_list:
pf = p.split(':')[0].strip()
tag = p.split(':')[0].strip()
name = '' if not ':' in p else p.split(':')[1].strip()
if pf not in current_pfix:
item = None
if tag not in current_pfix:
item = prop_group.namespaces.add()
item.tag = pf
item.tag = tag
item.name = name
item.is_project = True
print('Loaded project tag:', tag, name)
elif name:
# get the tag and apply name
item = [n for n in prop_group.namespaces if n.tag == tag][0]
if not item.name.strip():
item.name = name
print('Loaded name:', name)
if item:
item.is_project = True
else:
tag_list = []
# "release" suffix that are not in project anymore
for n in prop_group.namespaces:
if n.tag not in tag_list:
if n.tag not in current_pfix:
n.is_project = False
def set_env_properties():