[Bf-blender-cvs] [114d44ac4b6] greasepencil-object: GPencil: Move Vertex Mode to Brush
Antonio Vazquez
noreply at git.blender.org
Thu Nov 7 20:43:29 CET 2019
Commit: 114d44ac4b6f518860375553b1257b91a3fc09e4
Author: Antonio Vazquez
Date: Thu Nov 7 20:43:22 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB114d44ac4b6f518860375553b1257b91a3fc09e4
GPencil: Move Vertex Mode to Brush
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/blenkernel/BKE_gpencil.h
M source/blender/blenkernel/intern/brush.c
M source/blender/editors/gpencil/gpencil_fill.c
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_primitive.c
M source/blender/editors/gpencil/gpencil_tint.c
M source/blender/makesdna/DNA_brush_types.h
M source/blender/makesdna/DNA_scene_types.h
M source/blender/makesrna/intern/rna_brush.c
M source/blender/makesrna/intern/rna_gpencil_modifier.c
M source/blender/makesrna/intern/rna_sculpt_paint.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 5f62081dab7..0270e973346 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -935,13 +935,13 @@ class GreasePencilVertexcolorPanel:
if ob:
if tool in ('DRAW', 'FILL') and is_vertex is False:
row = layout.row(align=True)
- row.prop(gpencil_paint, "use_vertex_mode", text="Mode")
+ row.prop(gp_settings, "vertex_mode", text="Mode")
row = layout.row(align=True)
row.prop(gp_settings, "vertex_color_factor", slider=True, text="Mix Factor")
if tool == 'TINT' or is_vertex is True:
row = layout.row(align=True)
- row.prop(gpencil_paint, "use_vertex_mode", text="Mode")
+ row.prop(gp_settings, "vertex_mode", text="Mode")
sub_row = layout.row(align=True)
sub_row.prop(brush, "color", text="")
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 0eb147de5fa..fc4ad59feee 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -2091,11 +2091,11 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
col.enabled = settings.use_vertex_color or brush.gpencil_tool == 'TINT'
if brush.gpencil_tool in ('DRAW', 'FILL'):
- col.prop(settings, "use_vertex_mode", text="Mode")
+ col.prop(gp_settings, "vertex_mode", text="Mode")
col.prop(gp_settings, "vertex_color_factor", slider=True, text="Mix Factor")
if brush.gpencil_tool == 'TINT':
- col.prop(settings, "use_vertex_mode", text="Mode")
+ col.prop(gp_settings, "vertex_mode", text="Mode")
col.prop(brush, "color", text="")
col.template_color_picker(brush, "color", value_slider=True)
@@ -2302,10 +2302,11 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex(View3DPanel, Panel):
ts = context.tool_settings
settings = ts.gpencil_vertex_paint
brush = settings.brush
-
+ gp_settings = brush.gpencil_settings
+
col = layout.column()
- col.prop(settings, "use_vertex_mode", text="Mode")
+ col.prop(gp_settings, "vertex_mode", text="Mode")
col.prop(brush, "color", text="")
col.template_color_picker(brush, "color", value_slider=True)
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 89ef6c94f7c..d6a3ba279b9 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -67,20 +67,20 @@ struct MDeformVert;
/* Vertex Color macros. */
#define GPENCIL_USE_VERTEX_COLOR(toolsettings) \
((toolsettings->gp_paint->flag & GPPAINT_FLAG_USE_VERTEXCOLOR))
-#define GPENCIL_USE_VERTEX_COLOR_STROKE(toolsettings) \
+#define GPENCIL_USE_VERTEX_COLOR_STROKE(toolsettings, brush) \
((GPENCIL_USE_VERTEX_COLOR(toolsettings) && \
- ((toolsettings->gp_paint->mode == GPPAINT_MODE_STROKE) || \
- (toolsettings->gp_paint->mode == GPPAINT_MODE_BOTH))))
-#define GPENCIL_USE_VERTEX_COLOR_FILL(toolsettings) \
+ ((brush->gpencil_settings->vertex_mode == GPPAINT_MODE_STROKE) || \
+ (brush->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))))
+#define GPENCIL_USE_VERTEX_COLOR_FILL(toolsettings, brush) \
((GPENCIL_USE_VERTEX_COLOR(toolsettings) && \
- ((toolsettings->gp_paint->mode == GPPAINT_MODE_FILL) || \
- (toolsettings->gp_paint->mode == GPPAINT_MODE_BOTH))))
-#define GPENCIL_TINT_VERTEX_COLOR_STROKE(toolsettings) \
- ((toolsettings->gp_paint->mode == GPPAINT_MODE_STROKE) || \
- (toolsettings->gp_paint->mode == GPPAINT_MODE_BOTH))
-#define GPENCIL_TINT_VERTEX_COLOR_FILL(toolsettings) \
- ((toolsettings->gp_paint->mode == GPPAINT_MODE_FILL) || \
- (toolsettings->gp_paint->mode == GPPAINT_MODE_BOTH))
+ ((brush->gpencil_settings->vertex_mode == GPPAINT_MODE_FILL) || \
+ (brush->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))))
+#define GPENCIL_TINT_VERTEX_COLOR_STROKE(brush) \
+ ((brush->gpencil_settings->vertex_mode == GPPAINT_MODE_STROKE) || \
+ (brush->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))
+#define GPENCIL_TINT_VERTEX_COLOR_FILL(brush) \
+ ((brush->gpencil_settings->vertex_mode == GPPAINT_MODE_FILL) || \
+ (brush->gpencil_settings->vertex_mode == GPPAINT_MODE_BOTH))
/* ------------ Grease-Pencil API ------------------ */
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 89837c46830..34be3503c33 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -266,6 +266,7 @@ static Brush *gpencil_brush_ensure(Main *bmain,
/* Set vertex mix factor. */
if (brush->gpencil_settings) {
+ brush->gpencil_settings->vertex_mode = GPPAINT_MODE_STROKE;
brush->gpencil_settings->vertex_factor = 1.0f;
}
@@ -593,6 +594,7 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts)
brush->gpencil_settings->icon_id = GP_BRUSH_ICON_FILL;
brush->gpencil_tool = GPAINT_TOOL_FILL;
+ brush->gpencil_settings->vertex_mode = GPPAINT_MODE_FILL;
brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 37c8d264d6c..8de12332faf 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1035,7 +1035,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
gps->inittime = 0.0f;
/* Apply the mix color to fill. */
- if (GPENCIL_USE_VERTEX_COLOR_FILL(ts)) {
+ if (GPENCIL_USE_VERTEX_COLOR_FILL(ts, brush)) {
copy_v3_v3(gps->mix_color_fill, brush->rgb);
gps->mix_color_fill[3] = brush->gpencil_settings->vertex_factor;
}
@@ -1099,7 +1099,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
/* Point mix color. */
copy_v3_v3(pt->mix_color, brush->rgb);
- pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts) ?
+ pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts, brush) ?
brush->gpencil_settings->vertex_factor :
0.0f;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 5fd55d89545..c87e5ef9994 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -995,7 +995,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
}
/* Apply the mix color to fill for stroke. */
- if (GPENCIL_USE_VERTEX_COLOR_FILL(ts)) {
+ if (GPENCIL_USE_VERTEX_COLOR_FILL(ts, brush)) {
copy_v3_v3(gps->mix_color_fill, brush->rgb);
gps->mix_color_fill[3] = brush->gpencil_settings->vertex_factor;
}
@@ -1016,7 +1016,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
pt->time = ptc->time;
/* Point mix color. */
copy_v3_v3(pt->mix_color, brush->rgb);
- pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts) ?
+ pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts, brush) ?
brush->gpencil_settings->vertex_factor :
0.0f;
@@ -1052,7 +1052,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
pt->time = ptc->time;
/* Point mix color. */
copy_v3_v3(pt->mix_color, brush->rgb);
- pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts) ?
+ pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts, brush) ?
brush->gpencil_settings->vertex_factor :
0.0f;
@@ -1178,7 +1178,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
pt->uv_rot = ptc->uv_rot;
/* Point mix color. */
copy_v3_v3(pt->mix_color, brush->rgb);
- pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts) ?
+ pt->mix_color[3] = GPENCIL_USE_VERTEX_COLOR_STROKE(ts, brush) ?
brush->gpencil_settings->vertex_factor :
0.0f;
@@ -1867,7 +1867,7 @@ static void gp_init_colors(tGPsdata *p)
}
/* Apply the mix color to fill. */
- if (GPENCIL_USE_VERTEX_COLOR_FILL(ts)) {
+ if (GPENCIL_USE_VERTEX_COLOR_FILL(ts, brush)) {
interp_v3_v3v3(gpd->runtime.sfill,
gpd->runtime.sfill,
brush->rgb,
@@ -1879,7 +1879,7 @@ static void gp_init_colors(tGPsdata *p)
gpd->runtime.bfill_style = gp_style->fill_style;
/* Apply the mix color to stroke. */
- if (GPENCIL_USE_VERTEX_COLOR_STROKE(ts)) {
+ if (GPENCIL_USE_VERTEX_COLOR_STROKE(ts, brush)) {
interp_v3_v3v3(gpd->runtime.scolor,
gpd->runtime.scolor,
brush->rgb,
@@ -3064,7 +3064,8 @@ static void gpencil_guide_event_handling(bContext *C,
/* Enter or exit set center point mode */
if ((event->type == OKEY) && (event->val == KM_RELEASE)) {
- if ((p->paintmode == GP_PAINTMODE_DRAW) && guide->use_guide && (guide->reference_point != GP_GUIDE_REF_OBJECT)) {
+ if ((p->paintmode == GP_PAINTMODE_DRAW) && guide->use_guide &&
+ (guide->reference_point != GP_GUIDE_REF_OBJECT)) {
add_notifier = true;
p->paintmode = GP_PAINTMODE_SET_CP;
ED_gpencil_toggle_brush_cursor(C, false, NULL);
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 8335bb37224..ed7469e2205 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -157,7 +157,7 @@ static void gp_init_colors(tGPDprimitive *p)
gpd->runtime.sfill[3] = 0.8f;
}
/* Apply the mix color to fill. */
- if (GPENCIL_USE_VERTEX_COLOR_FILL(ts)) {
+ if (GPENCIL_USE_VERTEX_COLOR_FILL(ts, brush)) {
int
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list