[Bf-blender-cvs] [ff2260527fc] greasepencil-object: Remove unused and duplicate code

Antonio Vazquez noreply at git.blender.org
Mon Mar 12 10:00:02 CET 2018


Commit: ff2260527fc68860e32d5c5a66fb342c32b5a380
Author: Antonio Vazquez
Date:   Mon Mar 12 09:37:03 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBff2260527fc68860e32d5c5a66fb342c32b5a380

Remove unused and duplicate code

After moving bGPDbrush to Brush, some data is duplicated or not used.

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

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/intern/brush.c
M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/makesdna/DNA_brush_types.h
M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 95a6561ec23..17cfa9e9bd2 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -2523,7 +2523,7 @@ class VIEW3D_PT_tools_grease_pencil_appearance(Panel):
             drawingbrush = context.active_gpencil_brush
             col.prop(drawingbrush, "use_cursor", text="Show Brush")
             row = col.row(align=True)
-            row.prop(drawingbrush, "cursor_color", text="Color")
+            row.prop(drawingbrush, "cursor_color_add", text="Color")
 
             col.separator()
             col = col.column(align=True)
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index d1b88c95b6c..d2b06397b5d 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -267,7 +267,6 @@ void BKE_brush_gpencil_presets(bContext *C)
 
 	Brush *brush, *deft;
 	CurveMapping *custom_curve;
-	float curcolor[3] = { 1.0f, 1.0f, 1.0f };
 
 	/* Pencil brush */
 	brush = BKE_brush_add_gpencil(bmain, ts, "Pencil");
@@ -294,7 +293,6 @@ void BKE_brush_gpencil_presets(bContext *C)
 	brush->gp_thick_smoothlvl = 3;
 	brush->draw_subdivide = 1;
 	brush->draw_random_sub = 0.0f;
-	copy_v3_v3(brush->curcolor, curcolor);
 	brush->gp_icon_id = GPBRUSH_PENCIL;
 	brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
 
@@ -327,7 +325,6 @@ void BKE_brush_gpencil_presets(bContext *C)
 	brush->gp_thick_smoothfac = 1.0f;
 	brush->gp_thick_smoothlvl = 3;
 	brush->draw_random_sub = 0.0f;
-	copy_v3_v3(brush->curcolor, curcolor);
 	brush->gp_icon_id = GPBRUSH_PEN;
 	brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
 
@@ -357,7 +354,6 @@ void BKE_brush_gpencil_presets(bContext *C)
 	brush->gp_thick_smoothlvl = 3;
 	brush->draw_subdivide = 1;
 	brush->draw_random_sub = 0.0f;
-	copy_v3_v3(brush->curcolor, curcolor);
 	brush->gp_icon_id = GPBRUSH_INK;
 	brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
 
@@ -393,7 +389,6 @@ void BKE_brush_gpencil_presets(bContext *C)
 	brush->gp_thick_smoothlvl = 2;
 	brush->draw_subdivide = 1;
 	brush->draw_random_sub = 0.0f;
-	copy_v3_v3(brush->curcolor, curcolor);
 	brush->gp_icon_id = GPBRUSH_INKNOISE;
 	brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
 
@@ -430,7 +425,6 @@ void BKE_brush_gpencil_presets(bContext *C)
 	brush->gp_thick_smoothlvl = 3;
 	brush->draw_subdivide = 0;
 	brush->draw_random_sub = 0;
-	copy_v3_v3(brush->curcolor, curcolor);
 	brush->gp_icon_id = GPBRUSH_BLOCK;
 	brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
 
@@ -460,7 +454,6 @@ void BKE_brush_gpencil_presets(bContext *C)
 	brush->gp_thick_smoothlvl = 3;
 	brush->draw_subdivide = 1;
 	brush->draw_random_sub = 0.0f;
-	copy_v3_v3(brush->curcolor, curcolor);
 	brush->gp_icon_id = GPBRUSH_MARKER;
 	brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
 
@@ -488,7 +481,6 @@ void BKE_brush_gpencil_presets(bContext *C)
 	brush->gp_lazy_factor = LAZY_FACTOR;
 
 	brush->draw_strength = 1.0f;
-	copy_v3_v3(brush->curcolor, curcolor);
 
 	/* Soft Eraser brush */
 	brush = brush = BKE_brush_add_gpencil(bmain, ts, "Soft Eraser");
@@ -497,7 +489,6 @@ void BKE_brush_gpencil_presets(bContext *C)
 	brush->gp_icon_id = GPBRUSH_ERASE_SOFT;
 	brush->gp_brush_type = GP_BRUSH_TYPE_ERASE;
 	brush->gp_eraser_mode = GP_BRUSH_ERASER_SOFT;
-	copy_v3_v3(brush->curcolor, curcolor);
 
 	/* Hard Eraser brush */
 	brush = brush = BKE_brush_add_gpencil(bmain, ts, "Hard Eraser");
@@ -506,7 +497,6 @@ void BKE_brush_gpencil_presets(bContext *C)
 	brush->gp_icon_id = GPBRUSH_ERASE_HARD;
 	brush->gp_brush_type = GP_BRUSH_TYPE_ERASE;
 	brush->gp_eraser_mode = GP_BRUSH_ERASER_HARD;
-	copy_v3_v3(brush->curcolor, curcolor);
 
 	/* Stroke Eraser brush */
 	brush = brush = BKE_brush_add_gpencil(bmain, ts, "Stroke Eraser");
@@ -515,7 +505,6 @@ void BKE_brush_gpencil_presets(bContext *C)
 	brush->gp_icon_id = GPBRUSH_ERASE_STROKE;
 	brush->gp_brush_type = GP_BRUSH_TYPE_ERASE;
 	brush->gp_eraser_mode = GP_BRUSH_ERASER_STROKE;
-	copy_v3_v3(brush->curcolor, curcolor);
 
 	/* set defaut brush */
 	BKE_paint_brush_set(paint, deft);
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index a71b39d5d1e..301d551aed4 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1419,7 +1419,7 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata)
 			}
 			else {
 				radius = 5.0f;
-				copy_v3_v3(color, paintbrush->curcolor);
+				copy_v3_v3(color, paintbrush->add_col);
 			}
 		}
 	}
@@ -1474,7 +1474,7 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata)
 		glEnable(GL_LINE_SMOOTH);
 		glEnable(GL_BLEND);
 
-		copy_v3_v3(color, paintbrush->curcolor);
+		copy_v3_v3(color, paintbrush->add_col);
 		immUniformColor4f(color[0], color[1], color[2], 0.8f);
 
 		immBegin(GWN_PRIM_LINES, 2);
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index b9a93879d7e..46a474ad98a 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -144,7 +144,7 @@ typedef struct Brush {
 
 	/* grease pencil drawing brush data */
 	short thickness;          /* thickness to apply to strokes */
-	short gp_flag;
+	short gp_flag;            /* internal grease pecncil drawing flags */
 	float draw_smoothfac;     /* amount of smoothing to apply to newly created strokes */
 	short draw_smoothlvl;     /* number of times to apply smooth factor to new strokes */
 	short draw_subdivide;     /* number of times to subdivide new strokes */
@@ -161,7 +161,6 @@ typedef struct Brush {
 	struct CurveMapping *cur_strength;
 	struct CurveMapping *cur_jitter;
 
-	float curcolor[3];
 	float gp_thick_smoothfac; /* amount of thickness smoothing to apply to newly created strokes */
 	short gp_thick_smoothlvl; /* number of times to apply thickness smooth factor to new strokes */
 
@@ -179,40 +178,37 @@ typedef struct Brush {
 	int   gp_brush_type;      /* type of brush (draw, fill, erase, etc..) */
 	int   gp_eraser_mode;     /* soft, hard or stroke */
 	float gp_active_smooth;   /* smooth while drawing factor */
+	char pad_[4];
 } Brush;
 
 /* Brush->gp_flag */
 typedef enum eGPDbrush_Flag {
-	/* brush is active */
-	GP_BRUSH_ACTIVE = (1 << 0),
 	/* brush use pressure */
-	GP_BRUSH_USE_PRESSURE = (1 << 1),
+	GP_BRUSH_USE_PRESSURE = (1 << 0),
 	/* brush use pressure for alpha factor */
-	GP_BRUSH_USE_STENGTH_PRESSURE = (1 << 2),
+	GP_BRUSH_USE_STENGTH_PRESSURE = (1 << 1),
 	/* brush use pressure for alpha factor */
-	GP_BRUSH_USE_JITTER_PRESSURE = (1 << 3),
+	GP_BRUSH_USE_JITTER_PRESSURE = (1 << 2),
 	/* brush use random for pressure */
-	GP_BRUSH_USE_RANDOM_PRESSURE = (1 << 4),
+	GP_BRUSH_USE_RANDOM_PRESSURE = (1 << 3),
 	/* brush use random for strength */
-	GP_BRUSH_USE_RANDOM_STRENGTH = (1 << 5),
+	GP_BRUSH_USE_RANDOM_STRENGTH = (1 << 4),
 	/* enable screen cursor */
-	GP_BRUSH_ENABLE_CURSOR = (1 << 6),
-	/* brush is only for filling */
-	GP_BRUSH_FILL_ONLY = (1 << 7), /* Deprecated */
+	GP_BRUSH_ENABLE_CURSOR = (1 << 5),
 	/* fill hide transparent */
-	GP_BRUSH_FILL_HIDE = (1 << 8),
+	GP_BRUSH_FILL_HIDE = (1 << 6),
 	/* show fill help lines */
-	GP_BRUSH_FILL_SHOW_HELPLINES = (1 << 10),
+	GP_BRUSH_FILL_SHOW_HELPLINES = (1 << 7),
 	/* lazy mouse */
-	GP_BRUSH_STABILIZE_MOUSE = (1 << 11),
+	GP_BRUSH_STABILIZE_MOUSE = (1 << 8),
 	/* lazy mouse override (internal only) */
-	GP_BRUSH_STABILIZE_MOUSE_TEMP = (1 << 12),
+	GP_BRUSH_STABILIZE_MOUSE_TEMP = (1 << 9),
 	/* default eraser brush for quick switch */
-	GP_BRUSH_DEFAULT_ERASER = (1 << 13),
+	GP_BRUSH_DEFAULT_ERASER = (1 << 10),
 	/* settings group */
-	GP_BRUSH_GROUP_SETTINGS = (1 << 14),
+	GP_BRUSH_GROUP_SETTINGS = (1 << 11),
 	/* Random settings group */
-	GP_BRUSH_GROUP_RANDOM = (1 << 15)
+	GP_BRUSH_GROUP_RANDOM = (1 << 12)
 } eGPDbrush_Flag;
 
 /* Brush->gp_fill_draw_mode */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index f7373075f33..09054cedb83 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1739,15 +1739,6 @@ static void rna_def_brush(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Stabilizer",
 		"Draw lines with a delay to allow smooth strokes. Press Shift key to override while drawing");
 
-	/* Cursor Color */
-	static float default_1[3] = { 1.0f, 1.0f, 1.0f };
-	prop = RNA_def_property(srna, "cursor_color", PROP_FLOAT, PROP_COLOR_GAMMA);
-	RNA_def_property_float_sdna(prop, NULL, "curcolor");
-	RNA_def_property_array(prop, 3);
-	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_float_array_default(prop, default_1);
-	RNA_def_property_ui_text(prop, "Cursor Color", "Color for the cursor");
-
 	prop = RNA_def_property(srna, "use_cursor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", GP_BRUSH_ENABLE_CURSOR);
 	RNA_def_property_boolean_default(prop, true);



More information about the Bf-blender-cvs mailing list