[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61159] trunk/blender: Grease Pencil: User-Pref for setting the default colour of newly created layers

Joshua Leung aligorith at gmail.com
Wed Nov 6 11:59:06 CET 2013


Revision: 61159
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61159
Author:   aligorith
Date:     2013-11-06 10:59:05 +0000 (Wed, 06 Nov 2013)
Log Message:
-----------
Grease Pencil: User-Pref for setting the default colour of newly created layers

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
    trunk/blender/source/blender/blenkernel/intern/gpencil.c
    trunk/blender/source/blender/editors/interface/resources.c
    trunk/blender/source/blender/makesdna/DNA_userdef_types.h
    trunk/blender/source/blender/makesrna/intern/rna_userdef.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_userpref.py	2013-11-06 08:27:18 UTC (rev 61158)
+++ trunk/blender/release/scripts/startup/bl_ui/space_userpref.py	2013-11-06 10:59:05 UTC (rev 61159)
@@ -268,14 +268,18 @@
 
         col = row.column()
         col.label(text="Grease Pencil:")
+        col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
+        col.separator()
         col.prop(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
         col.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
-        col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
+        col.separator()
         col.prop(edit, "use_grease_pencil_smooth_stroke", text="Smooth Stroke")
         col.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify Stroke")
         col.separator()
+        col.prop(edit, "grease_pencil_default_color", text="Default Color")
         col.separator()
         col.separator()
+        col.separator()
         col.label(text="Playback:")
         col.prop(edit, "use_negative_frames")
         col.separator()

Modified: trunk/blender/source/blender/blenkernel/intern/gpencil.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/gpencil.c	2013-11-06 08:27:18 UTC (rev 61158)
+++ trunk/blender/source/blender/blenkernel/intern/gpencil.c	2013-11-06 10:59:05 UTC (rev 61159)
@@ -38,6 +38,7 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
+#include "BLI_math_vector.h"
 
 #include "BLF_translation.h"
 
@@ -182,7 +183,7 @@
 	BLI_addtail(&gpd->layers, gpl);
 	
 	/* set basic settings */
-	gpl->color[3] = 0.9f;
+	copy_v4_v4(gpl->color, U.gpencil_new_layer_col);
 	gpl->thickness = 3;
 	
 	/* auto-name */

Modified: trunk/blender/source/blender/editors/interface/resources.c
===================================================================
--- trunk/blender/source/blender/editors/interface/resources.c	2013-11-06 08:27:18 UTC (rev 61158)
+++ trunk/blender/source/blender/editors/interface/resources.c	2013-11-06 10:59:05 UTC (rev 61159)
@@ -1406,6 +1406,7 @@
 	}
 	if (U.pad_rot_angle == 0)
 		U.pad_rot_angle = 15;
+	
 	/* graph editor - unselected F-Curve visibility */
 	if (U.fcu_inactive_alpha == 0) {
 		U.fcu_inactive_alpha = 0.25f;
@@ -2224,8 +2225,15 @@
 			rgba_char_args_test_set(btheme->tima.uv_shadow, 112, 112, 112, 255);
 		}
 	}
-
 	
+	if (U.versionfile < 270) {
+		/* grease pencil - new layer color */
+		if (U.gpencil_new_layer_col[3] < 0.1f) {
+			/* defaults to black, but must at least be visible! */
+			U.gpencil_new_layer_col[3] = 0.9f;
+		}
+	}
+	
 	if (U.pixelsize == 0.0f)
 		U.pixelsize = 1.0f;
 	

Modified: trunk/blender/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2013-11-06 08:27:18 UTC (rev 61158)
+++ trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2013-11-06 10:59:05 UTC (rev 61159)
@@ -474,6 +474,7 @@
 	struct ColorBand coba_weight;	/* from texture.h */
 
 	float sculpt_paint_overlay_col[3];
+	float gpencil_new_layer_col[3]; /* default color for newly created Grease Pencil layers */
 
 	short tweak_threshold;
 	short pad3;

Modified: trunk/blender/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2013-11-06 08:27:18 UTC (rev 61158)
+++ trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2013-11-06 10:59:05 UTC (rev 61159)
@@ -3266,7 +3266,13 @@
 	RNA_def_property_int_sdna(prop, NULL, "gp_eraser");
 	RNA_def_property_range(prop, 0, 100);
 	RNA_def_property_ui_text(prop, "Grease Pencil Eraser Radius", "Radius of eraser 'brush'");
-
+	
+	
+	prop = RNA_def_property(srna, "grease_pencil_default_color", PROP_FLOAT, PROP_COLOR);
+	RNA_def_property_float_sdna(prop, NULL, "gpencil_new_layer_col");
+	RNA_def_property_array(prop, 4);
+	RNA_def_property_ui_text(prop, "Grease Pencil Default Color", "Color of new Grease Pencil layers");
+	
 	/* sculpt and paint */
 
 	prop = RNA_def_property(srna, "sculpt_paint_overlay_color", PROP_FLOAT, PROP_COLOR_GAMMA);




More information about the Bf-blender-cvs mailing list