diff options
author | Charlie Jolly <mistajolly@gmail.com> | 2018-08-09 14:42:02 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2018-08-09 14:43:21 +0300 |
commit | 2e10c658f42a842404f16a1b03ff4844e41d538c (patch) | |
tree | efde511079a2e4537477c1da3f5b202982bc4780 /source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c | |
parent | f284821bf714cca98d86ede1e2a9713094d1d686 (diff) |
GP: Add option to select color affected in modifiers
Now it's possible to define if the Tint, Hue and OPacity modifier affect the stroke color, fill color or both.
Diffstat (limited to 'source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c | 22 |
1 files changed, 14 insertions, 8 deletions
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++) { |