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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-12-13 14:51:38 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-12-13 14:51:38 +0400
commitb30c74a5175cfec05b096b6a36801dddea4009d3 (patch)
treee5161c914ff8a8fde2ad22b74010dbe9984db271 /source/blender/editors/space_view3d
parent60808c5ed6a3b38ffefcdc4714ebdd5a2ae6d327 (diff)
Fix #33510: Rotate around selection doesn't work when .blend saved in sculpt mode
Issue was caused by calculateTransformCenter not giving any center point in cases object is in painting mode, which lead to previous offset used for view rotation. Since this previous offset is a static variable, it'll mean rotation will happen around scene origin after re-starting blender. Now made it so viewport rotation will use active object's center as an offset when active object is in painting mode. Should behave in more predictable way.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index c46e1aff9ae..19d10645e51 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -432,8 +432,21 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
copy_v3_v3(vod->ofs, rv3d->ofs);
if (vod->use_dyn_ofs) {
- /* If there's no selection, lastofs is unmodified and last value since static */
- calculateTransformCenter(C, V3D_CENTROID, lastofs, NULL);
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = OBACT;
+
+ if (ob->mode & OB_MODE_ALL_PAINT) {
+ /* transformation is disabled for painting modes, which will make it
+ * so previous offset is used. This is annoying when you open file
+ * saved with active object in painting mode
+ */
+ copy_v3_v3(lastofs, ob->obmat[3]);
+ }
+ else {
+ /* If there's no selection, lastofs is unmodified and last value since static */
+ calculateTransformCenter(C, V3D_CENTROID, lastofs, NULL);
+ }
+
negate_v3_v3(vod->dyn_ofs, lastofs);
}
else if (U.uiflag & USER_ZBUF_ORBIT) {