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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user