mat exclude by name for palette link

1.9.2

- feat: Palette linker has a name exclusion list in preferences
  - Avoid linking some material that are prefered local to file
  - Default item in list : `line`
This commit is contained in:
Pullusb
2022-01-19 11:36:45 +01:00
parent 7985844226
commit cab3a91f70
3 changed files with 20 additions and 2 deletions
+6 -1
View File
@@ -50,6 +50,9 @@ class GPTB_OT_import_obj_palette(Operator):
self.report({'ERROR'}, 'Need to have at least one GP object selected in scene')
return {"CANCELLED"}
prefs = utils.get_addon_prefs()
exclusions = [name.strip() for name in prefs.mat_link_exclude.split(',')] if prefs.mat_link_exclude else []
# Avoid looping on linked duplicate
objs = []
datas = []
@@ -117,7 +120,9 @@ class GPTB_OT_import_obj_palette(Operator):
for ob in objs:
for src_ob in linked_objs:
for src_mat in src_ob.data.materials:
print(f'- {src_mat.name}')
## filter mat
if src_mat.name in exclusions:
continue
mat = ob.data.materials.get(src_mat.name)
if mat and mat.library == src_mat.library: