[Bf-blender-cvs] [3b8fa288554] greasepencil-object: Minor changes to Input Samples algorithm

Antonio Vazquez noreply at git.blender.org
Tue Feb 27 16:59:36 CET 2018


Commit: 3b8fa28855461606a692926eb4071b982b76f294
Author: Antonio Vazquez
Date:   Tue Feb 27 16:59:28 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB3b8fa28855461606a692926eb4071b982b76f294

Minor changes to Input Samples algorithm

Now the number of slices is rounded using a ceiling value.

===================================================================

M	source/blender/editors/gpencil/gpencil_paint.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 2d013d4adce..d2b43bcc5e0 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2659,7 +2659,7 @@ static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEven
 	b[1] = event->mval[1] + 1;
 	float dist = len_v2v2(a, b);
 	if (dist >= factor) {
-		int slices = (int)((dist / factor) + 1);
+		int slices = 1 + (int)((dist - 1.0) / factor);
 		float n = 1.0f / slices;
 		for (int i = 1; i < slices; i++) {
 			interp_v2_v2v2(pt, a, b, n * i);



More information about the Bf-blender-cvs mailing list