diff options
Diffstat (limited to 'source/blender/gpencil_modifiers')
17 files changed, 78 insertions, 35 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c index b2eeaa1c4e9..1a61133f3f7 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.c @@ -84,8 +84,8 @@ void gpencil_modifier_type_init(GpencilModifierTypeInfo *types[]) /* verify if valid layer and pass index */ bool is_stroke_affected_by_modifier( - Object *ob, char *mlayername, int mpassindex, int minpoints, - bGPDlayer *gpl, bGPDstroke *gps, bool inv1, bool inv2) + Object *ob, char *mlayername, int mpassindex, int gpl_passindex, int minpoints, + bGPDlayer *gpl, bGPDstroke *gps, bool inv1, bool inv2, bool inv3) { MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1); @@ -102,7 +102,20 @@ bool is_stroke_affected_by_modifier( } } } - /* verify pass */ + /* verify layer pass */ + if (gpl_passindex > 0) { + if (inv3 == false) { + if (gpl->pass_index != gpl_passindex) { + return false; + } + } + else { + if (gpl->pass_index == gpl_passindex) { + return false; + } + } + } + /* verify material pass */ if (mpassindex > 0) { if (inv2 == false) { if (gp_style->index != mpassindex) { diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h index 95772d141f1..1b61465efa3 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h @@ -42,8 +42,10 @@ struct Material; struct GHash; bool is_stroke_affected_by_modifier( - struct Object *ob, char *mlayername, int mpassindex, int minpoints, - bGPDlayer *gpl, bGPDstroke *gps, bool inv1, bool inv2); + struct Object *ob, char *mlayername, int mpassindex, + int gpl_passindex, int minpoints, + bGPDlayer *gpl, bGPDstroke *gps, + bool inv1, bool inv2, bool inv3); float get_modifier_point_weight(struct MDeformVert *dvert, bool inverse, int def_nr); diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c index 0b02443f7eb..a98078a6490 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c @@ -435,6 +435,19 @@ static void generateStrokes( } } } + /* verify layer pass */ + if (mmd->layer_pass > 0) { + if ((mmd->flag & GP_BUILD_INVERT_LAYERPASS) == 0) { + if (gpl->pass_index != mmd->layer_pass) { + return false; + } + } + else { + if (gpl->pass_index == mmd->layer_pass) { + return false; + } + } + } /* Early exit if outside of the frame range for this modifier * (e.g. to have one forward, and one backwards modifier) diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c index ac1e51c62ea..fcf06ae9a3c 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c @@ -78,8 +78,9 @@ static void deformStroke( float hsv[3], factor[3]; if (!is_stroke_affected_by_modifier(ob, - mmd->layername, mmd->pass_index, 1, gpl, gps, - mmd->flag & GP_COLOR_INVERT_LAYER, mmd->flag & GP_COLOR_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, gps, + mmd->flag & GP_COLOR_INVERT_LAYER, mmd->flag & GP_COLOR_INVERT_PASS, + mmd->flag & GP_COLOR_INVERT_LAYERPASS)) { return; } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c index 38a149fce71..45a382fe4b8 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c @@ -209,8 +209,9 @@ static void deformStroke( struct GPHookData_cb tData; if (!is_stroke_affected_by_modifier(ob, - mmd->layername, mmd->pass_index, 3, gpl, gps, - mmd->flag & GP_HOOK_INVERT_LAYER, mmd->flag & GP_HOOK_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 3, gpl, gps, + mmd->flag & GP_HOOK_INVERT_LAYER, mmd->flag & GP_HOOK_INVERT_PASS, + mmd->flag & GP_HOOK_INVERT_LAYERPASS)) { return; } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilinstance.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilinstance.c index 05912e594f5..9c56a06af99 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilinstance.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilinstance.c @@ -114,8 +114,9 @@ static void generate_geometry( * ATTENTION: The logic here is the inverse of what's used everywhere else! */ if (is_stroke_affected_by_modifier(ob, - mmd->layername, mmd->pass_index, 1, gpl, gps, - mmd->flag & GP_INSTANCE_INVERT_LAYER, mmd->flag & GP_INSTANCE_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, gps, + mmd->flag & GP_INSTANCE_INVERT_LAYER, mmd->flag & GP_INSTANCE_INVERT_PASS, + mmd->flag & GP_INSTANCE_INVERT_LAYERPASS)) { valid_strokes[idx] = true; num_valid++; diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c index 0d7bfcfdaae..ffa24c24b17 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c @@ -82,8 +82,9 @@ static void deformStroke( const int def_nr = defgroup_name_index(ob, mmd->vgname); if (!is_stroke_affected_by_modifier(ob, - mmd->layername, mmd->pass_index, 3, gpl, gps, - mmd->flag & GP_LATTICE_INVERT_LAYER, mmd->flag & GP_LATTICE_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 3, gpl, gps, + mmd->flag & GP_LATTICE_INVERT_LAYER, mmd->flag & GP_LATTICE_INVERT_PASS, + mmd->flag & GP_LATTICE_INVERT_LAYERPASS)) { return; } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c index aec9715a995..19e6e6905b9 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c @@ -124,8 +124,11 @@ static void generateStrokes( for (i = 0, gps = gpf->strokes.first; i < tot_strokes; i++, gps = gps->next) { if (is_stroke_affected_by_modifier( - ob, mmd->layername, mmd->pass_index, 1, gpl, gps, - mmd->flag & GP_MIRROR_INVERT_LAYER, mmd->flag & GP_MIRROR_INVERT_PASS)) + ob, mmd->layername, mmd->pass_index, mmd->layer_pass, + 1, gpl, gps, + mmd->flag & GP_MIRROR_INVERT_LAYER, + mmd->flag & GP_MIRROR_INVERT_PASS, + mmd->flag & GP_MIRROR_INVERT_LAYERPASS)) { gps_new = BKE_gpencil_stroke_duplicate(gps); update_position(ob, mmd, gps_new, xi); diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c index aacf66d2538..3029d1b4ab5 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c @@ -117,8 +117,9 @@ static void deformStroke( } if (!is_stroke_affected_by_modifier(ob, - mmd->layername, mmd->pass_index, 3, gpl, gps, - mmd->flag & GP_NOISE_INVERT_LAYER, mmd->flag & GP_NOISE_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 3, gpl, gps, + mmd->flag & GP_NOISE_INVERT_LAYER, mmd->flag & GP_NOISE_INVERT_PASS, + mmd->flag & GP_NOISE_INVERT_LAYERPASS)) { return; } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c index 373fccde633..86892ad44fd 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c @@ -78,8 +78,9 @@ static void deformStroke( float loc[3], rot[3], scale[3]; if (!is_stroke_affected_by_modifier(ob, - mmd->layername, mmd->pass_index, 1, gpl, gps, - mmd->flag & GP_OFFSET_INVERT_LAYER, mmd->flag & GP_OFFSET_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, gps, + mmd->flag & GP_OFFSET_INVERT_LAYER, mmd->flag & GP_OFFSET_INVERT_PASS, + mmd->flag & GP_OFFSET_INVERT_LAYERPASS)) { return; } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c index 2ccca9f3ab9..9c38198a240 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c @@ -79,8 +79,9 @@ static void deformStroke( if (!is_stroke_affected_by_modifier( ob, - mmd->layername, mmd->pass_index, 1, gpl, gps, - mmd->flag & GP_OPACITY_INVERT_LAYER, mmd->flag & GP_OPACITY_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, gps, + mmd->flag & GP_OPACITY_INVERT_LAYER, mmd->flag & GP_OPACITY_INVERT_PASS, + mmd->flag & GP_OPACITY_INVERT_LAYERPASS)) { return; } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c index a892f230d39..0dde238d205 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c @@ -67,8 +67,9 @@ static void deformStroke( SimplifyGpencilModifierData *mmd = (SimplifyGpencilModifierData *)md; if (!is_stroke_affected_by_modifier(ob, - mmd->layername, mmd->pass_index, 4, gpl, gps, - mmd->flag & GP_SIMPLIFY_INVERT_LAYER, mmd->flag & GP_SIMPLIFY_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 4, gpl, gps, + mmd->flag & GP_SIMPLIFY_INVERT_LAYER, mmd->flag & GP_SIMPLIFY_INVERT_PASS, + mmd->flag & GP_SIMPLIFY_INVERT_LAYERPASS)) { return; } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c index 01fb4c1f83b..0e2750ec58d 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c @@ -70,8 +70,9 @@ static void deformStroke( const int def_nr = defgroup_name_index(ob, mmd->vgname); if (!is_stroke_affected_by_modifier(ob, - mmd->layername, mmd->pass_index, 3, gpl, gps, - mmd->flag & GP_SMOOTH_INVERT_LAYER, mmd->flag & GP_SMOOTH_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 3, gpl, gps, + mmd->flag & GP_SMOOTH_INVERT_LAYER, mmd->flag & GP_SMOOTH_INVERT_PASS, + mmd->flag & GP_SMOOTH_INVERT_LAYERPASS)) { return; } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c index 7cf19de2020..0c6adcb128b 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c @@ -72,8 +72,9 @@ static void deformStroke( if (!is_stroke_affected_by_modifier( ob, - mmd->layername, mmd->pass_index, 3, gpl, gps, - mmd->flag & GP_SUBDIV_INVERT_LAYER, mmd->flag & GP_SUBDIV_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 3, gpl, gps, + mmd->flag & GP_SUBDIV_INVERT_LAYER, mmd->flag & GP_SUBDIV_INVERT_PASS, + mmd->flag & GP_SUBDIV_INVERT_LAYERPASS)) { return; } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c index 10b96cd2181..2dc4e84cef8 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c @@ -95,8 +95,9 @@ static void deformStroke( const int def_nr = defgroup_name_index(ob, mmd->vgname); if (!is_stroke_affected_by_modifier(ob, - mmd->layername, mmd->pass_index, 1, gpl, gps, - mmd->flag & GP_THICK_INVERT_LAYER, mmd->flag & GP_THICK_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, gps, + mmd->flag & GP_THICK_INVERT_LAYER, mmd->flag & GP_THICK_INVERT_PASS, + mmd->flag & GP_THICK_INVERT_LAYERPASS)) { return; } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c index cb7e508e3db..0e66f639ce3 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c @@ -72,7 +72,7 @@ static int remapTime( const int sfra = scene->r.sfra; const int efra = scene->r.efra; const bool invgpl = mmd->flag & GP_TIME_INVERT_LAYER; - const bool invpass = mmd->flag & GP_TIME_INVERT_PASS; + const bool invpass = mmd->flag & GP_TIME_INVERT_LAYERPASS; /* omit if filter by layer */ if (mmd->layername[0] != '\0') { @@ -88,14 +88,14 @@ static int remapTime( } } /* verify pass */ - if (mmd->pass_index > 0) { + if (mmd->layer_pass > 0) { if (invpass == false) { - if (gpl->pass_index != mmd->pass_index) { + if (gpl->pass_index != mmd->layer_pass) { return cfra; } } else { - if (gpl->pass_index == mmd->pass_index) { + if (gpl->pass_index == mmd->layer_pass) { return cfra; } } diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c index cdbc1f465a2..b1eea14d90c 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c @@ -76,8 +76,9 @@ static void deformStroke( TintGpencilModifierData *mmd = (TintGpencilModifierData *)md; if (!is_stroke_affected_by_modifier(ob, - mmd->layername, mmd->pass_index, 1, gpl, gps, - mmd->flag & GP_TINT_INVERT_LAYER, mmd->flag & GP_TINT_INVERT_PASS)) + mmd->layername, mmd->pass_index, mmd->layer_pass, 1, gpl, gps, + mmd->flag & GP_TINT_INVERT_LAYER, mmd->flag & GP_TINT_INVERT_PASS, + mmd->flag & GP_TINT_INVERT_LAYERPASS)) { return; } |