[Bf-blender-cvs] [2b6f8aaf681] greasepencil-object: GPencil: Add new variables for mix color
Antonio Vazquez
noreply at git.blender.org
Thu Oct 31 17:01:07 CET 2019
Commit: 2b6f8aaf68166a392ca71ab88b9acbeed81ce72f
Author: Antonio Vazquez
Date: Thu Oct 31 12:42:12 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB2b6f8aaf68166a392ca71ab88b9acbeed81ce72f
GPencil: Add new variables for mix color
This will be used by Vertex Paint tools.
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M source/blender/makesdna/DNA_brush_types.h
M source/blender/makesdna/DNA_gpencil_types.h
M source/blender/makesrna/intern/rna_brush.c
M source/blender/makesrna/intern/rna_gpencil.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 08bfee8a1a2..064063bf839 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -911,6 +911,12 @@ class GreasePencilMaterialsPanel:
row = layout.row()
row.prop(gpcolor, "color", text="Stroke Color")
+ # Mix color
+ if is_view3d and brush is not None:
+ gp_settings = brush.gpencil_settings
+ row = layout.row()
+ row.prop(gp_settings, "mix_color", text="Mix Color")
+
else:
space = context.space_data
row.template_ID(space, "pin_id")
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index bc039deffa6..b25a6c726c5 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -115,6 +115,9 @@ typedef struct BrushGpencilSettings {
/** Simplify adaptive factor */
float simplify_f;
+ /** Mix color RGBA (A=mix factor) */
+ float mix_color[4];
+
struct CurveMapping *curve_sensitivity;
struct CurveMapping *curve_strength;
struct CurveMapping *curve_jitter;
@@ -516,7 +519,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/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index f6ab2e39488..8c6ec81af76 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -81,6 +81,10 @@ typedef struct bGPDspoint {
/** Runtime data */
char _pad2[4];
+
+ /** Mix color RGBA (A=mix factor) */
+ float mix_color[4];
+
bGPDspoint_Runtime runtime;
} bGPDspoint;
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 937e0d3c5d7..9ee24a035d6 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1317,6 +1317,15 @@ 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);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Mix Color", "Color used to mix with stroke color to get final color");
+
/* Flags */
prop = RNA_def_property(srna, "use_pressure", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_PRESSURE);
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 561d9b8eafc..29bc1125644 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -899,6 +899,15 @@ static void rna_def_gpencil_stroke_point(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencil_stroke_point_select_set");
RNA_def_property_ui_text(prop, "Select", "Point is selected for viewport editing");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* 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);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Mix Color", "Color used to mix with point color to get final color");
}
static void rna_def_gpencil_stroke_points_api(BlenderRNA *brna, PropertyRNA *cprop)
More information about the Bf-blender-cvs
mailing list