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`gpv2
parent
7985844226
commit
cab3a91f70
|
@ -1,5 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
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`
|
||||
|
||||
1.9.1
|
||||
|
||||
- fix: add error handling on palette linker when blend_path isn't valid anymore
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -15,7 +15,7 @@ bl_info = {
|
|||
"name": "GP toolbox",
|
||||
"description": "Tool set for Grease Pencil in animation production",
|
||||
"author": "Samuel Bernou, Christophe Seux",
|
||||
"version": (1, 9, 1),
|
||||
"version": (1, 9, 2),
|
||||
"blender": (2, 91, 0),
|
||||
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
|
||||
"warning": "",
|
||||
|
@ -190,6 +190,11 @@ class GPTB_prefs(bpy.types.AddonPreferences):
|
|||
default=True,
|
||||
)
|
||||
|
||||
mat_link_exclude : StringProperty(
|
||||
name="Materials Link Exclude",
|
||||
description="List of material name to exclude when using palette linker (separate multiple value with comma, ex: line, rough)",
|
||||
default="line,", maxlen=0)
|
||||
|
||||
use_env_brushes : BoolProperty(
|
||||
name="Use Project Brushes",
|
||||
description="Load the brushes path in environnement at startup (key 'BRUSHES')",
|
||||
|
@ -381,6 +386,8 @@ class GPTB_prefs(bpy.types.AddonPreferences):
|
|||
subbox.prop(self, 'palette_path')
|
||||
subbox.prop(self, 'warn_base_palette')
|
||||
|
||||
subbox.prop(self, 'mat_link_exclude')
|
||||
|
||||
## Brushes
|
||||
subbox.prop(self, 'use_env_brushes', text='Use Brushes Environnement Path')
|
||||
subbox.prop(self, 'brush_path')
|
||||
|
|
Loading…
Reference in New Issue