[Bf-blender-cvs] [3b29a921fb9] greasepencil-object: GPencil: Split Vertex Paint factor for Draw
Antonio Vazquez
noreply at git.blender.org
Sat Nov 2 22:06:52 CET 2019
Commit: 3b29a921fb9edaad4c278c4fda7a4162a7d8fb42
Author: Antonio Vazquez
Date: Sat Nov 2 22:06:44 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB3b29a921fb9edaad4c278c4fda7a4162a7d8fb42
GPencil: Split Vertex Paint factor for Draw
This allows to use palettes.
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M release/scripts/startup/bl_ui/space_view3d.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_primitive.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/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 1e1989ae4d9..9210d832e5e 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -909,14 +909,16 @@ class GreasePencilMaterialsPanel:
gpcolor.use_stroke_texture_mix
):
row = layout.row()
- row.prop(gpcolor, "color", text="Stroke Color")
+ row.prop(gpcolor, "color", text="Stroke Base Color")
# Mix color
if is_view3d and brush is not None and brush.gpencil_tool == 'DRAW':
if gpcolor.stroke_style == 'SOLID' or gpcolor.use_stroke_pattern:
gp_settings = brush.gpencil_settings
row = layout.row()
- row.prop(gp_settings, "mix_color", text="Vertex Color")
+ row.prop(brush, "color", text="Vertex Color")
+ row = layout.row()
+ row.prop(gp_settings, "vertex_color_factor", text="Vertex Factor")
else:
space = context.space_data
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index c07b24b92e6..0af34488bc5 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -351,7 +351,7 @@ class _draw_tool_settings_context_mode:
if ma and (ma.grease_pencil.stroke_style != 'TEXTURE' or
ma.grease_pencil.use_stroke_pattern):
row.separator(factor=0.4)
- row.prop(gp_settings, "mix_color", text="")
+ row.prop(brush, "color", text="")
row = layout.row(align=True)
tool_settings = context.scene.tool_settings
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 6ab8d5eddbe..a0438f4967f 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -2070,26 +2070,24 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
gp_settings = brush.gpencil_settings
row = layout.row(align=True)
- if brush.gpencil_tool == 'DRAW':
- row.prop(gp_settings, "mix_color", text="")
- row = layout.row(align=True)
- row.template_color_picker(gp_settings, "mix_color", value_slider=True)
+ row.prop(brush, "color", text="")
+ row = layout.row(align=True)
+ row.template_color_picker(brush, "color", value_slider=True)
- if brush.gpencil_tool == 'TINT':
- row.prop(brush, "color", text="")
+ if brush.gpencil_tool == 'DRAW':
row = layout.row(align=True)
- row.template_color_picker(brush, "color", value_slider=True)
+ row.prop(gp_settings, "vertex_color_factor", slider=True, text="Vertex Factor")
- sub_row = layout.row(align=True)
- sub_row.prop(brush, "color", text="")
- sub_row.prop(brush, "secondary_color", text="")
+ sub_row = layout.row(align=True)
+ sub_row.prop(brush, "color", text="")
+ sub_row.prop(brush, "secondary_color", text="")
- sub_row.operator("gpencil.tint_flip", icon='FILE_REFRESH', text="")
+ sub_row.operator("gpencil.tint_flip", icon='FILE_REFRESH', text="")
- row = layout.row(align=True)
- row.template_ID(ts.gpencil_paint, "palette", new="palette.new")
- if settings.palette:
- layout.template_palette(ts.gpencil_paint, "palette", color=True)
+ row = layout.row(align=True)
+ row.template_ID(ts.gpencil_paint, "palette", new="palette.new")
+ if settings.palette:
+ layout.template_palette(ts.gpencil_paint, "palette", color=True)
# Grease Pencil drawingcurves
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 09f30556a61..1441b44b458 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1008,7 +1008,8 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f);
pt->time = ptc->time;
/* Point mix color. */
- copy_v4_v4(pt->mix_color, brush->gpencil_settings->mix_color);
+ copy_v3_v3(pt->mix_color, brush->rgb);
+ pt->mix_color[3] = brush->gpencil_settings->vertex_factor;
pt++;
@@ -1041,7 +1042,8 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f);
pt->time = ptc->time;
/* Point mix color. */
- copy_v4_v4(pt->mix_color, brush->gpencil_settings->mix_color);
+ copy_v3_v3(pt->mix_color, brush->rgb);
+ pt->mix_color[3] = brush->gpencil_settings->vertex_factor;
if ((ts->gpencil_flags & GP_TOOL_FLAG_CREATE_WEIGHTS) && (have_weight)) {
BKE_gpencil_dvert_ensure(gps);
@@ -1164,7 +1166,8 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
pt->uv_fac = ptc->uv_fac;
pt->uv_rot = ptc->uv_rot;
/* Point mix color. */
- copy_v4_v4(pt->mix_color, brush->gpencil_settings->mix_color);
+ copy_v3_v3(pt->mix_color, brush->rgb);
+ pt->mix_color[3] = brush->gpencil_settings->vertex_factor;
if (dvert != NULL) {
dvert->totweight = 0;
@@ -1856,8 +1859,8 @@ static void gp_init_colors(tGPsdata *p)
/* Apply the mix color to stroke. */
interp_v3_v3v3(gpd->runtime.scolor,
gpd->runtime.scolor,
- brush->gpencil_settings->mix_color,
- brush->gpencil_settings->mix_color[3]);
+ brush->rgb,
+ brush->gpencil_settings->vertex_factor);
}
}
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index fbd26b10021..3d517f06a32 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -163,8 +163,8 @@ static void gp_init_colors(tGPDprimitive *p)
/* Apply the mix color to stroke. */
interp_v3_v3v3(gpd->runtime.scolor,
gpd->runtime.scolor,
- brush->gpencil_settings->mix_color,
- brush->gpencil_settings->mix_color[3]);
+ brush->rgb,
+ brush->gpencil_settings->vertex_factor);
}
}
@@ -1030,7 +1030,8 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
pt->flag = 0;
pt->uv_fac = tpt->uv_fac;
/* Point mix color. */
- copy_v4_v4(pt->mix_color, brush->gpencil_settings->mix_color);
+ copy_v3_v3(pt->mix_color, brush->rgb);
+ pt->mix_color[3] = brush->gpencil_settings->vertex_factor;
if (gps->dvert != NULL) {
MDeformVert *dvert = &gps->dvert[i];
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index a403ac43ee3..d30e244eb88 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -108,8 +108,9 @@ typedef struct BrushGpencilSettings {
/** Simplify adaptive factor */
float simplify_f;
- /** Mix color RGBA (A=mix factor) */
- float mix_color[4];
+ /** Mix colorfactor */
+ float vertex_factor;
+ char _pad_[4];
struct CurveMapping *curve_sensitivity;
struct CurveMapping *curve_strength;
@@ -519,7 +520,7 @@ typedef enum eBrushUVSculptTool {
SCULPT_TOOL_ELASTIC_DEFORM, \
SCULPT_TOOL_POSE, \
\
- /* These brushes could handle dynamic topology, \ \ \ \ \ \ \ \ \ \
+ /* These brushes could handle dynamic topology, \ \ \ \ \ \ \ \ \ \ \
* but user feedback indicates it's better not to */ \
SCULPT_TOOL_SMOOTH, \
SCULPT_TOOL_MASK) == 0)
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index cf1f1be4061..8c9887cfcf7 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1292,14 +1292,13 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Grease Pencil Icon", "");
- /* Mix color. */
- prop = RNA_def_property(srna, "mix_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "mix_color");
- RNA_def_property_array(prop, 4);
+ /* Vertex Color mix factor. */
+ prop = RNA_def_property(srna, "vertex_color_factor", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "vertex_factor");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(
- prop, "Vertex Color", "Color used to mix with stroke color to get final color");
+ prop, "Vertex Color Factor", "Factor used to mix vertex color to get final color");
/* Flags */
prop = RNA_def_property(srna, "use_pressure", PROP_BOOLEAN, PROP_NONE);
More information about the Bf-blender-cvs
mailing list