diff options
Diffstat (limited to 'source/blender/gpencil_modifiers')
3 files changed, 41 insertions, 25 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c index 4c087577699..40ffe293d41 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c @@ -60,6 +60,7 @@ static void initData(GpencilModifierData *md) ARRAY_SET_ITEMS(gpmd->hsv, 1.0f, 1.0f, 1.0f); gpmd->layername[0] = '\0'; gpmd->flag |= GP_COLOR_CREATE_COLORS; + gpmd->modify_color = GP_MODIFY_COLOR_BOTH; } static void copyData(const GpencilModifierData *md, GpencilModifierData *target) @@ -86,15 +87,19 @@ static void deformStroke( copy_v3_v3(factor, mmd->hsv); add_v3_fl(factor, -1.0f); - rgb_to_hsv_v(gps->runtime.tmp_stroke_rgba, hsv); - add_v3_v3(hsv, factor); - CLAMP3(hsv, 0.0f, 1.0f); - hsv_to_rgb_v(hsv, gps->runtime.tmp_stroke_rgba); + if (mmd->modify_color != GP_MODIFY_COLOR_FILL) { + rgb_to_hsv_v(gps->runtime.tmp_stroke_rgba, hsv); + add_v3_v3(hsv, factor); + CLAMP3(hsv, 0.0f, 1.0f); + hsv_to_rgb_v(hsv, gps->runtime.tmp_stroke_rgba); + } - rgb_to_hsv_v(gps->runtime.tmp_fill_rgba, hsv); - add_v3_v3(hsv, factor); - CLAMP3(hsv, 0.0f, 1.0f); - hsv_to_rgb_v(hsv, gps->runtime.tmp_fill_rgba); + if (mmd->modify_color != GP_MODIFY_COLOR_STROKE) { + rgb_to_hsv_v(gps->runtime.tmp_fill_rgba, hsv); + add_v3_v3(hsv, factor); + CLAMP3(hsv, 0.0f, 1.0f); + hsv_to_rgb_v(hsv, gps->runtime.tmp_fill_rgba); + } } static void bakeModifier( diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c index 541b37523b2..e0484e19959 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c @@ -61,6 +61,7 @@ static void initData(GpencilModifierData *md) gpmd->layername[0] = '\0'; gpmd->vgname[0] = '\0'; gpmd->flag |= GP_OPACITY_CREATE_COLORS; + gpmd->modify_color = GP_MODIFY_COLOR_BOTH; } static void copyData(const GpencilModifierData *md, GpencilModifierData *target) @@ -84,19 +85,24 @@ static void deformStroke( return; } - gps->runtime.tmp_fill_rgba[3] *= mmd->factor; + if (mmd->modify_color != GP_MODIFY_COLOR_FILL) { + gps->runtime.tmp_stroke_rgba[3] *= mmd->factor; + /* if factor is > 1, then force opacity */ + if (mmd->factor > 1.0f) { + gps->runtime.tmp_stroke_rgba[3] += mmd->factor - 1.0f; + } + CLAMP(gps->runtime.tmp_stroke_rgba[3], 0.0f, 1.0f); + } - /* if factor is > 1, then force opacity */ - if (mmd->factor > 1.0f) { - gps->runtime.tmp_stroke_rgba[3] += mmd->factor - 1.0f; - if (gps->runtime.tmp_fill_rgba[3] > 1e-5) { + if (mmd->modify_color != GP_MODIFY_COLOR_STROKE) { + gps->runtime.tmp_fill_rgba[3] *= mmd->factor; + /* if factor is > 1, then force opacity */ + if (mmd->factor > 1.0f && gps->runtime.tmp_fill_rgba[3] > 1e-5) { gps->runtime.tmp_fill_rgba[3] += mmd->factor - 1.0f; } + CLAMP(gps->runtime.tmp_fill_rgba[3], 0.0f, 1.0f); } - CLAMP(gps->runtime.tmp_stroke_rgba[3], 0.0f, 1.0f); - CLAMP(gps->runtime.tmp_fill_rgba[3], 0.0f, 1.0f); - /* if opacity > 1.0, affect the strength of the stroke */ if (mmd->factor > 1.0f) { for (int i = 0; i < gps->totpoints; i++) { diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c index 06212451d48..8af9ff6eec8 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c @@ -60,6 +60,7 @@ static void initData(GpencilModifierData *md) gpmd->layername[0] = '\0'; ARRAY_SET_ITEMS(gpmd->rgb, 1.0f, 1.0f, 1.0f); gpmd->flag |= GP_TINT_CREATE_COLORS; + gpmd->modify_color = GP_MODIFY_COLOR_BOTH; } static void copyData(const GpencilModifierData *md, GpencilModifierData *target) @@ -81,20 +82,24 @@ static void deformStroke( return; } - interp_v3_v3v3(gps->runtime.tmp_stroke_rgba, gps->runtime.tmp_stroke_rgba, mmd->rgb, mmd->factor); - interp_v3_v3v3(gps->runtime.tmp_fill_rgba, gps->runtime.tmp_fill_rgba, mmd->rgb, mmd->factor); + if (mmd->modify_color != GP_MODIFY_COLOR_FILL) { + interp_v3_v3v3(gps->runtime.tmp_stroke_rgba, gps->runtime.tmp_stroke_rgba, mmd->rgb, mmd->factor); + /* if factor is > 1, the alpha must be changed to get full tint */ + if (mmd->factor > 1.0f) { + gps->runtime.tmp_stroke_rgba[3] += mmd->factor - 1.0f; + } + CLAMP4(gps->runtime.tmp_stroke_rgba, 0.0f, 1.0f); + } - /* if factor is > 1, the alpha must be changed to get full tint */ - if (mmd->factor > 1.0f) { - gps->runtime.tmp_stroke_rgba[3] += mmd->factor - 1.0f; - if (gps->runtime.tmp_fill_rgba[3] > 1e-5) { + if (mmd->modify_color != GP_MODIFY_COLOR_STROKE) { + interp_v3_v3v3(gps->runtime.tmp_fill_rgba, gps->runtime.tmp_fill_rgba, mmd->rgb, mmd->factor); + /* if factor is > 1, the alpha must be changed to get full tint */ + if (mmd->factor > 1.0f && gps->runtime.tmp_fill_rgba[3] > 1e-5) { gps->runtime.tmp_fill_rgba[3] += mmd->factor - 1.0f; } + CLAMP4(gps->runtime.tmp_fill_rgba, 0.0f, 1.0f); } - CLAMP4(gps->runtime.tmp_stroke_rgba, 0.0f, 1.0f); - CLAMP4(gps->runtime.tmp_fill_rgba, 0.0f, 1.0f); - /* if factor > 1.0, affect the strength of the stroke */ if (mmd->factor > 1.0f) { for (int i = 0; i < gps->totpoints; i++) { |