diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-29 05:15:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-29 05:15:49 +0300 |
commit | e78ded8b0f8cf69fea29651df7bc82e5ebf63d7f (patch) | |
tree | fed2333a9e9d84c4bf4a38ff82e610fd66ac0602 /source/blender/editors/space_view3d | |
parent | 83f369a0b917fbf4e554d65c1d28eaa67f5a96de (diff) | |
parent | 01d02e78b567d214926ce99be41fe76e7efc2bc6 (diff) |
Merge branch 'blender-v2.91-release'
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_intern.h | 8 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 11 |
3 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 83a2254e811..7ec6bddd6a3 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3910,6 +3910,7 @@ static void axis_set_view(bContext *C, region, smooth_viewtx, &(const V3D_SmoothParams){ + .camera_old = camera_eval, .ofs = ofs, .quat = quat, .dist = &dist, diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 87a971f1ca3..b23b9db3211 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -170,10 +170,16 @@ bool ED_view3d_boundbox_clip_ex(const RegionView3D *rv3d, float obmat[4][4]); bool ED_view3d_boundbox_clip(RegionView3D *rv3d, const struct BoundBox *bb); +/** + * Parameters for setting the new view-port state. + * + * Each of the struct members may be NULL to signify they aren't to be adjusted. + */ typedef struct V3D_SmoothParams { struct Object *camera_old, *camera; const float *ofs, *quat, *dist, *lens; - /* alternate rotation center (ofs = must be NULL) */ + + /** Alternate rotation center, when set `ofs` must be NULL. */ const float *dyn_ofs; } V3D_SmoothParams; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 0f0a710a82a..a24f59019f0 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -192,8 +192,10 @@ void ED_view3d_smooth_view_ex( if (sview->camera) { Object *ob_camera_eval = DEG_get_evaluated_object(depsgraph, sview->camera); - sms.dst.dist = ED_view3d_offset_distance( - ob_camera_eval->obmat, sview->ofs, VIEW3D_DIST_FALLBACK); + if (sview->ofs != NULL) { + sms.dst.dist = ED_view3d_offset_distance( + ob_camera_eval->obmat, sview->ofs, VIEW3D_DIST_FALLBACK); + } ED_view3d_from_object(ob_camera_eval, sms.dst.ofs, sms.dst.quat, &sms.dst.dist, &sms.dst.lens); sms.to_camera = true; /* restore view3d values in end */ } @@ -224,8 +226,9 @@ void ED_view3d_smooth_view_ex( /* original values */ if (sview->camera_old) { Object *ob_camera_old_eval = DEG_get_evaluated_object(depsgraph, sview->camera_old); - sms.src.dist = ED_view3d_offset_distance(ob_camera_old_eval->obmat, rv3d->ofs, 0.0f); - /* this */ + if (sview->ofs != NULL) { + sms.src.dist = ED_view3d_offset_distance(ob_camera_old_eval->obmat, sview->ofs, 0.0f); + } ED_view3d_from_object( ob_camera_old_eval, sms.src.ofs, sms.src.quat, &sms.src.dist, &sms.src.lens); } |