Commit: 7d5fb2e103e03046194d69640aadf7e76a700620
Author: Philipp Oeser
Date:   Sat Oct 6 14:56:49 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB7d5fb2e103e03046194d69640aadf7e76a700620

Vertex Paint: support switching to secondary color temporarily holding Ctrl

while it is possible to permanently flip the colors using the 'X' button, this 
makes it consistent with Texture Paint.

fixes T56994

Reviewers: campbellbarton, brecht

Reviewed By: brecht

Subscribers: JulienKaspar

Tags: #sculpting_and_painting

Maniphest Tasks: T56994

Differential Revision: https://developer.blender.org/D3753

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

M       release/scripts/addons
M       source/blender/blenkernel/intern/paint.c
M       source/blender/editors/sculpt_paint/paint_intern.h
M       source/blender/editors/sculpt_paint/paint_ops.c
M       source/blender/editors/sculpt_paint/paint_vertex.c
M       source/blender/editors/sculpt_paint/paint_vertex_color_ops.c

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

diff --git a/release/scripts/addons b/release/scripts/addons
index 5f7fba0565a..2d1a067b12a 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 5f7fba0565a7c9ae93eae31a08fc9bbbd16d333a
+Subproject commit 2d1a067b12aa1c43e7935c09e424808ec78dccb2
diff --git a/source/blender/blenkernel/intern/paint.c 
b/source/blender/blenkernel/intern/paint.c
index c9f72ccf4ab..070f5daa019 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -448,7 +448,7 @@ bool BKE_palette_is_empty(const struct Palette *palette)
        return BLI_listbase_is_empty(&palette->colors);
 }
 
-/* are we in vertex paint or weight pain face select mode? */
+/* are we in vertex paint or weight paint face select mode? */
 bool BKE_paint_select_face_test(Object *ob)
 {
        return ( (ob != NULL) &&
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h 
b/source/blender/editors/sculpt_paint/paint_intern.h
index c74dc252d0c..2f0b1ebd98f 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -120,7 +120,7 @@ void PAINT_OT_weight_gradient(struct wmOperatorType *ot);
 void PAINT_OT_vertex_paint_toggle(struct wmOperatorType *ot);
 void PAINT_OT_vertex_paint(struct wmOperatorType *ot);
 
-unsigned int vpaint_get_current_col(struct Scene *scene, struct VPaint *vp);
+unsigned int vpaint_get_current_col(struct Scene *scene, struct VPaint *vp, 
bool secondary);
 
 /* paint_vertex_color_utils.c */
 unsigned int ED_vpaint_blend_tool(
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c 
b/source/blender/editors/sculpt_paint/paint_ops.c
index 278d02a768c..0e51fb39d23 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -1388,7 +1388,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
        keymap = WM_keymap_ensure(keyconf, "Vertex Paint", 0, 0);
        keymap->poll = vertex_paint_mode_poll;
 
-       WM_keymap_verify_item(keymap, "PAINT_OT_vertex_paint", LEFTMOUSE, 
KM_PRESS, 0, 0);
+       RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint", 
LEFTMOUSE, KM_PRESS, 0,        0)->ptr, "mode", BRUSH_STROKE_NORMAL);
+       RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_vertex_paint", 
LEFTMOUSE, KM_PRESS, KM_CTRL,  0)->ptr, "mode", BRUSH_STROKE_INVERT);
        WM_keymap_add_item(keymap, "PAINT_OT_brush_colors_flip", XKEY, 
KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "PAINT_OT_sample_color", SKEY, KM_PRESS, 0, 
0);
 
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c 
b/source/blender/editors/sculpt_paint/paint_vertex.c
index 4821fd4fef4..139986fa1c1 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -283,11 +283,11 @@ static VPaint *new_vpaint(void)
        return vp;
 }
 
-uint vpaint_get_current_col(Scene *scene, VPaint *vp)
+uint vpaint_get_current_col(Scene *scene, VPaint *vp, bool secondary)
 {
        Brush *brush = BKE_paint_brush(&vp->paint);
        uchar col[4];
-       rgb_float_to_uchar(col, BKE_brush_color_get(scene, brush));
+       rgb_float_to_uchar(col, secondary ? 
BKE_brush_secondary_color_get(scene, brush) : BKE_brush_color_get(scene, 
brush));
        col[3] = 255; /* alpha isn't used, could even be removed to speedup 
paint a little */
        return *(uint *)col;
 }
@@ -2521,7 +2521,7 @@ static bool vpaint_stroke_test_start(bContext *C, struct 
wmOperator *op, const f
                &vpd->normal_angle_precalc, vp->paint.brush->falloff_angle,
                (vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
 
-       vpd->paintcol = vpaint_get_current_col(scene, vp);
+       vpd->paintcol = vpaint_get_current_col(scene, vp, 
(RNA_enum_get(op->ptr, "mode") == BRUSH_STROKE_INVERT));
 
        vpd->is_texbrush = !(brush->vertexpaint_tool == PAINT_BLEND_BLUR) && 
brush->mtex.tex;
 
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c 
b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
index 4c8ca493cd1..ba3bc5501e3 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
@@ -107,7 +107,7 @@ static int vertex_color_set_exec(bContext *C, wmOperator 
*UNUSED(op))
 {
        Scene *scene = CTX_data_scene(C);
        Object *obact = CTX_data_active_object(C);
-       unsigned int paintcol = vpaint_get_current_col(scene, 
scene->toolsettings->vpaint);
+       unsigned int paintcol = vpaint_get_current_col(scene, 
scene->toolsettings->vpaint, false);
 
        if (vertex_color_set(obact, paintcol)) {
                WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obact);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to