[Bf-blender-cvs] [c1c1b525563] greasepencil-object: Invert Input Samples value

Antonio Vazquez noreply at git.blender.org
Mon Feb 26 19:35:08 CET 2018


Commit: c1c1b5255637ca5f70480b9dc6c26f3e37e01024
Author: Antonio Vazquez
Date:   Mon Feb 26 19:34:52 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc1c1b5255637ca5f70480b9dc6c26f3e37e01024

Invert Input Samples value

In order to keep UI consistency, the value now it's inverted. Bigger values, means more precission.

A value of Zero means, no additional sampling.

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

M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/makesdna/DNA_gpencil_types.h
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 037c1069cfe..147f0689bd3 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2648,11 +2648,11 @@ static void gpencil_move_last_stroke_to_back(bContext *C)
 static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEvent *event, tGPsdata *p)
 {
 	bGPDbrush *brush = p->brush;
-	int factor = brush->input_samples;
-	if (factor == 0) {
+	if (brush->input_samples == 0) {
 		return;
 	}
 
+	int factor = GP_MAX_INPUT_SAMPLES - brush->input_samples + 1;
 	float pt[2], a[2], b[2];
 	copy_v2fl_v2i(a, p->mvalo);
 	b[0] = event->mval[0] + 1;
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 03130f92b42..a6ddab79749 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -42,6 +42,7 @@ struct GHash;
 #define GP_OBGPENCIL_DEFAULT_SIZE  0.2f 
 #define GP_DEFAULT_PIX_FACTOR 1.0f
 #define GP_DEFAULT_GRID_SIZE 100 
+#define GP_MAX_INPUT_SAMPLES 30
 
 /* ***************************************** */
 /* GP Point Weights */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 7ac6a7ebf3f..cc5ad69ce03 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2388,8 +2388,8 @@ static void rna_def_gpencil_brush(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "input_samples", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "input_samples");
-	RNA_def_property_range(prop, 0, 200);
-	RNA_def_property_ui_text(prop, "Input Samples", "Maximum distance from last mouse position before generate a new control point. Set to 0 to disable");
+	RNA_def_property_range(prop, 0, GP_MAX_INPUT_SAMPLES);
+	RNA_def_property_ui_text(prop, "Input Samples", "Generate intermediate points for very fast mouse movements. Set to 0 to disable");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
 	/* Flags */



More information about the Bf-blender-cvs mailing list