diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-05-11 17:18:08 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-05-11 17:28:15 +0300 |
commit | d63956d0e51c1b5a65941b918d0e055b1c14fa4b (patch) | |
tree | 1824ff8bb76f0fe2b50a33927f01a4f4ae6178ad /source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c | |
parent | 870e081bcda7f8fd99f73366d22bdf372c09f054 (diff) |
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
Diffstat (limited to 'source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c index cc9dfa81b3c..cc38fa8bc87 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c @@ -44,6 +44,8 @@ #include "BKE_gpencil.h" #include "BKE_gpencil_geom.h" #include "BKE_gpencil_modifier.h" +#include "BKE_lib_query.h" +#include "BKE_modifier.h" #include "BKE_object.h" #include "DEG_depsgraph.h" @@ -60,7 +62,7 @@ static void initData(GpencilModifierData *md) gpmd->flag |= GP_NOISE_USE_RANDOM; gpmd->factor = 0.5f; gpmd->layername[0] = '\0'; - gpmd->materialname[0] = '\0'; + gpmd->material = NULL; gpmd->vgname[0] = '\0'; gpmd->step = 4; gpmd->seed = 1; @@ -135,7 +137,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, 1, @@ -259,6 +261,13 @@ static void bakeModifier(struct Main *UNUSED(bmain), } } +static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk, void *userData) +{ + NoiseGpencilModifierData *mmd = (NoiseGpencilModifierData *)md; + + walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER); +} + GpencilModifierTypeInfo modifierType_Gpencil_Noise = { /* name */ "Noise", /* structName */ "NoiseGpencilModifierData", @@ -279,6 +288,6 @@ GpencilModifierTypeInfo modifierType_Gpencil_Noise = { /* updateDepsgraph */ NULL, /* dependsOnTime */ dependsOnTime, /* foreachObjectLink */ NULL, - /* foreachIDLink */ NULL, + /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ NULL, }; |