From d63956d0e51c1b5a65941b918d0e055b1c14fa4b Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Mon, 11 May 2020 16:18:08 +0200 Subject: 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 --- .../blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c') diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c index ec0f5789238..0b00bcaf3ff 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c @@ -36,6 +36,8 @@ #include "BKE_gpencil_geom.h" #include "BKE_gpencil_modifier.h" +#include "BKE_lib_query.h" +#include "BKE_modifier.h" #include "DEG_depsgraph.h" @@ -48,7 +50,7 @@ static void initData(GpencilModifierData *md) gpmd->pass_index = 0; gpmd->level = 1; gpmd->layername[0] = '\0'; - gpmd->materialname[0] = '\0'; + gpmd->material = NULL; } static void copyData(const GpencilModifierData *md, GpencilModifierData *target) @@ -72,7 +74,7 @@ static void deformStroke(GpencilModifierData *md, if (!is_stroke_affected_by_modifier(ob, mmd->layername, - mmd->materialname, + mmd->material, mmd->pass_index, mmd->layer_pass, minimum_vert, @@ -104,6 +106,13 @@ static void bakeModifier(struct Main *UNUSED(bmain), } } +static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk, void *userData) +{ + SubdivGpencilModifierData *mmd = (SubdivGpencilModifierData *)md; + + walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER); +} + GpencilModifierTypeInfo modifierType_Gpencil_Subdiv = { /* name */ "Subdivide", /* structName */ "SubdivGpencilModifierData", @@ -124,6 +133,6 @@ GpencilModifierTypeInfo modifierType_Gpencil_Subdiv = { /* updateDepsgraph */ NULL, /* dependsOnTime */ NULL, /* foreachObjectLink */ NULL, - /* foreachIDLink */ NULL, + /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ NULL, }; -- cgit v1.2.3