Grease Pencil: User-Pref for setting the default colour of newly created layers

This commit is contained in:
Joshua Leung
2013-11-06 10:59:05 +00:00
parent 17994825f0
commit 50ac2ee8de
5 changed files with 24 additions and 4 deletions

View File

@@ -268,12 +268,16 @@ class USERPREF_PT_edit(Panel):
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:")

View File

@@ -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 @@ bGPDlayer *gpencil_layer_addnew(bGPdata *gpd, const char *name, int setactive)
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 */

View File

@@ -1406,6 +1406,7 @@ void init_userdef_do_versions(void)
}
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,7 +2225,14 @@ void init_userdef_do_versions(void)
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;

View File

@@ -474,6 +474,7 @@ typedef struct UserDef {
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;

View File

@@ -3266,7 +3266,13 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
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);