Fix T37387 VIEW3D_OT_view_selected in sculpt mode zooms far from
authorAntony Riakiotakis <kalast@gmail.com>
Thu, 19 Dec 2013 03:09:42 +0000 (05:09 +0200)
committerAntony Riakiotakis <kalast@gmail.com>
Thu, 19 Dec 2013 03:09:42 +0000 (05:09 +0200)
sculpted object if last sculpt stroke ends outside the mesh.

Code here used the last true location which is invalid in that case,
just reuse the average stroke location instead.

source/blender/editors/include/ED_sculpt.h
source/blender/editors/sculpt_paint/sculpt.c

index ed7415e6c26dd289fbbe0bc95d856658dbf4ae3e..4c6c40905481d3ac8ae1650b4e66a38f395f91aa 100644 (file)
@@ -45,7 +45,6 @@ void ED_operatortypes_sculpt(void);
 void sculpt_get_redraw_planes(float planes[4][4], struct ARegion *ar,
                               struct RegionView3D *rv3d, struct Object *ob);
 void ED_sculpt_force_update(struct bContext *C);
-float *ED_sculpt_get_last_stroke(struct Object *ob);
 void ED_sculpt_get_average_stroke(struct Object *ob, float stroke[3]);
 int ED_sculpt_minmax(struct bContext *C, float min[3], float max[3]);
 int ED_sculpt_mask_layers_ensure(struct Object *ob,
index 6e11de878e333c6d523f369ade8aafc5210423b2..4a1859c15f8d186070a23bf781aa4b446e21e9f0 100644 (file)
@@ -117,11 +117,6 @@ void ED_sculpt_force_update(bContext *C)
        }
 }
 
-float *ED_sculpt_get_last_stroke(struct Object *ob)
-{
-       return (ob && ob->sculpt && ob->sculpt->last_stroke_valid) ? ob->sculpt->last_stroke : NULL;
-}
-
 void ED_sculpt_get_average_stroke(Object *ob, float stroke[3])
 {
        if (ob->sculpt->last_stroke_valid && ob->sculpt->average_stroke_counter > 0) {
@@ -4575,7 +4570,7 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str
 
                /* update last stroke position */
                ob->sculpt->last_stroke_valid = 1;
-               copy_v3_v3(ob->sculpt->last_stroke, ss->cache->true_location);
+               ED_sculpt_get_average_stroke(ob, ob->sculpt->last_stroke);
                mul_m4_v3(ob->obmat, ob->sculpt->last_stroke);
 
                sculpt_cache_free(ss->cache);