GPencil: Replace material name with material pointer for Modifiers filter
Before, the material name was used to filter the effect of the stroke, but after the last changes in the ID code, now it's not working. After talking with @severin, we agreed to replace the material name with a pointer. Also, this fix a design issue when the materials were linked. Related to T76594 Differential Revision: https://developer.blender.org/D7681 with some minor changes
This commit is contained in:
@@ -1855,7 +1855,6 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
|
||||
# the mt.type enum is (ab)used for a lookup on function names
|
||||
# ...to avoid lengthy if statements
|
||||
# so each type must have a function here.
|
||||
|
||||
def gpencil_masking(self, layout, ob, md, use_vertex, use_curve=False):
|
||||
gpd = ob.data
|
||||
layout.separator()
|
||||
@@ -1884,7 +1883,15 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
|
||||
split = col2.split(factor=0.6)
|
||||
|
||||
row = split.row(align=True)
|
||||
row.prop_search(md, "material", gpd, "materials", text="", icon='SHADING_TEXTURE')
|
||||
|
||||
valid = md.material in (slot.material for slot in ob.material_slots) or md.material is None
|
||||
if valid:
|
||||
icon = 'SHADING_TEXTURE'
|
||||
else:
|
||||
icon = 'ERROR'
|
||||
|
||||
row.alert = not valid
|
||||
row.prop_search(md, "material", gpd, "materials", text="", icon=icon)
|
||||
row.prop(md, "invert_materials", text="", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
row = split.row(align=True)
|
||||
|
Reference in New Issue
Block a user