[Bf-blender-cvs] [7a80a76] GPencil_FillStrokes: RNA: Line width for volumetric strokes is allowed to be higher

Joshua Leung noreply at git.blender.org
Thu Oct 30 13:44:41 CET 2014


Commit: 7a80a76b0d8a9a2de7fed3eaf3d36d5b06576374
Author: Joshua Leung
Date:   Thu Oct 30 19:38:38 2014 +1300
Branches: GPencil_FillStrokes
https://developer.blender.org/rB7a80a76b0d8a9a2de7fed3eaf3d36d5b06576374

RNA: Line width for volumetric strokes is allowed to be higher

While 3D strokes currently have a size limitation, this doesn't apply to volumetrics.

TODO
Most of our 2D strokes don't have a limitation either, but we can't easily
identify such cases in this function, so for now the limit holds.

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

M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index c732c9f..a74a6e6 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -66,6 +66,28 @@ static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr)
 		return 1;
 }
 
+static void rna_GPencilLayer_line_width_range(PointerRNA *ptr, int *min, int *max,
+                                              int *UNUSED(softmin), int *UNUSED(softmax))
+{
+	bGPDlayer *gpl = ptr->data;
+	
+	/* The restrictions on max width here are due to OpenGL on Windows not supporting
+	 * any widths greater than 10 (for driver-drawn) strokes/points.
+	 *
+	 * Although most of our 2D strokes also don't suffer from this restriction,
+	 * it's relatively hard to test for that. So, for now, only volumetric strokes
+	 * get to be larger...
+	 */
+	if (gpl->flag & GP_LAYER_VOLUMETRIC) {
+		*min = 1;
+		*max = 300;
+	}
+	else {
+		*min = 1;
+		*max = 10;
+	}
+}
+
 static PointerRNA rna_GPencil_active_layer_get(PointerRNA *ptr)
 {
 	bGPdata *gpd = ptr->id.data;
@@ -633,7 +655,8 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
 	/* Line Thickness */
 	prop = RNA_def_property(srna, "line_width", PROP_INT, PROP_PIXEL);
 	RNA_def_property_int_sdna(prop, NULL, "thickness");
-	RNA_def_property_range(prop, 1, 10); /* 10 px limit comes from Windows OpenGL limits for natively-drawn strokes */
+	//RNA_def_property_range(prop, 1, 10); /* 10 px limit comes from Windows OpenGL limits for natively-drawn strokes */
+	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_GPencilLayer_line_width_range");
 	RNA_def_property_ui_text(prop, "Thickness", "Thickness of strokes (in pixels)");
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");




More information about the Bf-blender-cvs mailing list