Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-11-20 20:11:42 +0300
committerAntonioya <blendergit@gmail.com>2018-11-20 20:12:04 +0300
commitec908beab321853e7d018d1d0b1450f4aef89a51 (patch)
tree5e51d299dc85e084855fc789dfae0376d6babd91 /source/blender
parent53d9ddf772be064bcde132b1f79ed2239f74b741 (diff)
GP: New option to paint a predefined weight
Enabling this option, the weight is set to the predefined value and not the result of the sum of the paint actions.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c14
-rw-r--r--source/blender/makesdna/DNA_scene_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c7
3 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 75b632238af..1710bd6be88 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -903,11 +903,21 @@ static bool gp_brush_weight_apply(
if (gp_brush_invert_check(gso)) {
/* reduce weight */
- curweight -= inf;
+ if (gso->settings->flag & GP_SCULPT_SETT_FLAG_PAINT_WEIGHT) {
+ curweight = 0.0f;
+ }
+ else {
+ curweight -= inf;
+ }
}
else {
/* increase weight */
- curweight += inf;
+ if (gso->settings->flag & GP_SCULPT_SETT_FLAG_PAINT_WEIGHT) {
+ curweight = gso->gp_brush->strength;
+ }
+ else {
+ curweight += inf;
+ }
}
CLAMP(curweight, 0.0f, 1.0f);
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index c1ced30169b..640fe526971 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1051,6 +1051,8 @@ typedef enum eGP_Sculpt_SettingsFlag {
GP_SCULPT_SETT_FLAG_FRAME_FALLOFF = (1 << 5),
/* apply brush to uv data */
GP_SCULPT_SETT_FLAG_APPLY_UV = (1 << 6),
+ /* paint weight, not add/substract */
+ GP_SCULPT_SETT_FLAG_PAINT_WEIGHT = (1 << 7),
} eGP_Sculpt_SettingsFlag;
/* Settings for GP Interpolation Operators */
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index b067bec4b43..7aa38472944 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1244,6 +1244,13 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+ prop = RNA_def_property(srna, "use_fix_weight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_PAINT_WEIGHT);
+ RNA_def_property_ui_text(prop, "Fix Weight",
+ "Set the predefined weight to any point affected by the brush");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
prop = RNA_def_property(srna, "use_multiframe_falloff", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_FRAME_FALLOFF);
RNA_def_property_ui_text(prop, "Use Falloff", "Use falloff effect when edit in multiframe mode to compute brush effect by frame");