[Bf-blender-cvs] [7e0a7639be2] soc-2019-npr: Gpencil: clean up length modifier callback
YimingWu
noreply at git.blender.org
Wed Jul 3 05:10:21 CEST 2019
Commit: 7e0a7639be216e6538640bfc2a83f49515016c8b
Author: YimingWu
Date: Wed Jul 3 10:45:33 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB7e0a7639be216e6538640bfc2a83f49515016c8b
Gpencil: clean up length modifier callback
===================================================================
M source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
===================================================================
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
index 98884a3495f..40be666a609 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
@@ -76,6 +76,16 @@ static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
BKE_gpencil_modifier_copyData_generic(md, target);
}
+static void deformStroke(bGPDstroke *gps, int length)
+{
+ if (length > 0) {
+ BKE_gpencil_stretch_stroke(gps, length);
+ }
+ else {
+ BKE_gpencil_shrink_stroke(gps, -length);
+ }
+}
+
static void bakeModifier(Main *UNUSED(bmain),
Depsgraph *depsgraph,
GpencilModifierData *md,
@@ -89,12 +99,7 @@ static void bakeModifier(Main *UNUSED(bmain),
LengthGpencilModifierData *lmd = (LengthGpencilModifierData *)md;
bGPDstroke *gps;
for (gps = gpf->strokes.first; gps; gps = gps->next) {
- if (lmd->length > 0) {
- BKE_gpencil_stretch_stroke(gps, lmd->length);
- }
- else {
- BKE_gpencil_shrink_stroke(gps, -lmd->length);
- }
+ deformStroke(gps, lmd->length);
}
return;
}
@@ -110,12 +115,7 @@ static void generateStrokes(
LengthGpencilModifierData *lmd = (LengthGpencilModifierData *)md;
bGPDstroke *gps;
for (gps = gpf->strokes.first; gps; gps = gps->next) {
- if (lmd->length > 0) {
- BKE_gpencil_stretch_stroke(gps, lmd->length);
- }
- else {
- BKE_gpencil_shrink_stroke(gps, -lmd->length);
- }
+ deformStroke(gps, lmd->length);
}
}
More information about the Bf-blender-cvs
mailing list