From b7bdc6c7a11fdd9615c3d07f1b3b028fe47bbd57 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Fri, 21 Mar 2008 01:10:32 +0000 Subject: [PATCH] Fixed bug #8514, sculpt: pivot last and undo Undoing in sculpt mode correctly returns to previous pivots now. --- source/blender/blenkernel/BKE_sculpt.h | 3 --- source/blender/makesdna/DNA_scene_types.h | 8 ++++++-- source/blender/src/sculptmode.c | 4 ++-- source/blender/src/view.c | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/source/blender/blenkernel/BKE_sculpt.h b/source/blender/blenkernel/BKE_sculpt.h index e03e38bab75..5d7ed28f561 100644 --- a/source/blender/blenkernel/BKE_sculpt.h +++ b/source/blender/blenkernel/BKE_sculpt.h @@ -59,9 +59,6 @@ typedef struct SculptSession { struct RadialControl *radialcontrol; - /* For rotating around a pivot point */ - vec3f pivot; - struct SculptStroke *stroke; } SculptSession; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 869f1cb426d..f31f9fff142 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -468,6 +468,10 @@ typedef struct SculptData /* Settings for each brush */ BrushData drawbrush, smoothbrush, pinchbrush, inflatebrush, grabbrush, layerbrush, flattenbrush; + + /* For rotating around a pivot point */ + float pivot[3]; + short brush_type; /* For the Brush Shape */ @@ -486,10 +490,10 @@ typedef struct SculptData /* Symmetry is separate from the other BrushData because the same settings are always used for all brush types */ char symm; - + /* Added to store if the 'Rake' setting has been set */ char rake; - char pad[7]; + char pad[3]; } SculptData; typedef struct Scene { diff --git a/source/blender/src/sculptmode.c b/source/blender/src/sculptmode.c index 3fda71bf828..715a0f47afa 100644 --- a/source/blender/src/sculptmode.c +++ b/source/blender/src/sculptmode.c @@ -1231,7 +1231,7 @@ void init_brushaction(BrushAction *a, short *mouse, short *pr_mouse) /* Set the pivot to allow the model to rotate around the center of the brush */ if(get_depth(mouse[0],mouse[1]) < 1.0) - VecCopyf(&sculpt_session()->pivot.x, a->symm.center_3d); + VecCopyf(sd->pivot, a->symm.center_3d); /* Now project the Up, Right, and Out normals from view to model coords */ unproject(zero_loc, 0, 0, 0); @@ -1692,7 +1692,7 @@ void sculpt(void) } else { do_symmetrical_brush_actions(a, mouse, mvalo); - unproject(&ss->pivot.x, mouse[0], mouse[1], a->depth); + unproject(sd->pivot, mouse[0], mouse[1], a->depth); } if(modifier_calculations || ob_get_keyblock(ob)) diff --git a/source/blender/src/view.c b/source/blender/src/view.c index abb49c0ec9d..90138abb9ab 100644 --- a/source/blender/src/view.c +++ b/source/blender/src/view.c @@ -579,7 +579,7 @@ void viewmove(int mode) use_sel= 1; VecCopyf(ofs, G.vd->ofs); - VecCopyf(obofs,&sculpt_session()->pivot.x); + VecCopyf(obofs, sculpt_data()->pivot); Mat4MulVecfl(ob->obmat, obofs); obofs[0]= -obofs[0]; obofs[1]= -obofs[1];