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:
authorAntonio Vazquez <blendergit@gmail.com>2020-03-20 17:37:56 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-03-21 11:48:18 +0300
commitd924e31b421a51fed343fbd2a17291cfd289d9bc (patch)
tree674c93c2d214c027ebc1573858d673682533c746 /source/blender/gpencil_modifiers/intern
parenta22cd6b6a95138d73e9e23f7ac0d40de17a5a25f (diff)
GPencil: New Hardeness mode for Opacity modifier
Add new option to change the stroke hardeness. This option works at stroke level, not at point level. Also replaced the "Both" name mode by "Stroke and Fill". Differential Revision: https://developer.blender.org/D7195
Diffstat (limited to 'source/blender/gpencil_modifiers/intern')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index 12576b3d27f..93f3776827b 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@ -51,6 +51,7 @@ static void initData(GpencilModifierData *md)
OpacityGpencilModifierData *gpmd = (OpacityGpencilModifierData *)md;
gpmd->pass_index = 0;
gpmd->factor = 1.0f;
+ gpmd->hardeness = 1.0f;
gpmd->layername[0] = '\0';
gpmd->materialname[0] = '\0';
gpmd->vgname[0] = '\0';
@@ -104,6 +105,14 @@ static void deformStroke(GpencilModifierData *md,
return;
}
+ /* Hardeness (at stroke level). */
+ if (mmd->modify_color == GP_MODIFY_COLOR_HARDENESS) {
+ gps->hardeness *= mmd->hardeness;
+ CLAMP(gps->hardeness, 0.0f, 1.0f);
+
+ return;
+ }
+
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;