[Bf-blender-cvs] [8014180] master: Vertex Paint: orbit last stroke support
Campbell Barton
noreply at git.blender.org
Fri Oct 30 00:13:08 CET 2015
Commit: 8014180720d81131f2ca4b541142816f459a5f3c
Author: Campbell Barton
Date: Fri Oct 30 09:53:27 2015 +1100
Branches: master
https://developer.blender.org/rB8014180720d81131f2ca4b541142816f459a5f3c
Vertex Paint: orbit last stroke support
This option works for all paint modes now.
===================================================================
M source/blender/editors/sculpt_paint/paint_vertex.c
M source/blender/editors/space_view3d/view3d_edit.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 8daad9d..15627c6 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -91,6 +91,19 @@ static bool vertex_paint_use_fast_update_check(Object *ob)
return false;
}
+static void paint_last_stroke_update(Scene *scene, ARegion *ar, const float mval[2])
+{
+ const int mval_i[2] = {mval[0], mval[1]};
+ float world[3];
+
+ if (ED_view3d_autodist_simple(ar, mval_i, world, 0, NULL)) {
+ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
+ ups->average_stroke_counter++;
+ add_v3_v3(ups->average_stroke_accum, world);
+ ups->last_stroke_valid = true;
+ }
+}
+
/* polling - retrieve whether cursor should be set or operator should be done */
/* Returns true if vertex paint mode is active */
@@ -2379,6 +2392,11 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
swap_m4m4(vc->rv3d->persmat, mat);
+ /* calculate pivot for rotation around seletion if needed */
+ if (U.uiflag & USER_ORBIT_SELECTION) {
+ paint_last_stroke_update(scene, vc->ar, mval);
+ }
+
DAG_id_tag_update(ob->data, 0);
ED_region_tag_redraw(vc->ar);
}
@@ -2833,6 +2851,11 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
do_shared_vertexcol(me, vpd->mlooptag);
}
+ /* calculate pivot for rotation around seletion if needed */
+ if (U.uiflag & USER_ORBIT_SELECTION) {
+ paint_last_stroke_update(scene, vc->ar, mval);
+ }
+
ED_region_tag_redraw(vc->ar);
if (vpd->use_fast_update == false) {
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index a31bc61..8f5c909 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -640,7 +640,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
* center, in other cases it's not clear what rotation center shall be
* so just rotate around object origin
*/
- if (ob->mode & (OB_MODE_SCULPT | OB_MODE_TEXTURE_PAINT)) {
+ if (ob->mode & (OB_MODE_SCULPT | OB_MODE_TEXTURE_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
float stroke[3];
BKE_paint_stroke_get_average(scene, ob, stroke);
copy_v3_v3(lastofs, stroke);
More information about the Bf-blender-cvs
mailing list