Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Jolly <mistajolly@gmail.com>2018-08-09 14:42:02 +0300
committerAntonioya <blendergit@gmail.com>2018-08-09 14:43:21 +0300
commit2e10c658f42a842404f16a1b03ff4844e41d538c (patch)
treeefde511079a2e4537477c1da3f5b202982bc4780 /source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
parentf284821bf714cca98d86ede1e2a9713094d1d686 (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_gpenciltint.c')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c23
1 files changed, 14 insertions, 9 deletions
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++) {