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:
authorCampbell Barton <campbell@blender.org>2022-08-09 02:31:20 +0300
committerCampbell Barton <campbell@blender.org>2022-08-09 02:31:20 +0300
commit228f7cb5cec86d45757ae350d816e5e7c7c9123a (patch)
treed70056c7f2e42e47a3f501c90f1a4a552ded153c /source/blender/editors/space_view3d/view3d_navigate_zoom_border.c
parent8ed2abf856cbabd970d92aa3de850b0c70dccd0c (diff)
Fix viewport operators with a view locked camera
Smooth-view wasn't working properly with a locked-camera this could animate from the wrong position if the camera wasn't in sync with the underlying viewport transformation. Resolve issues for: - VIEW3D_OT_view_orbit - VIEW3D_OT_view_roll - VIEW3D_OT_zoom_border
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_navigate_zoom_border.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_navigate_zoom_border.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c b/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c
index eaabee9e891..7cafc3dfd42 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_zoom_border.c
@@ -159,11 +159,15 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
/* clamp after because we may have been zooming out */
CLAMP(new_dist, dist_range[0], dist_range[1]);
- /* TODO(campbell): 'is_camera_lock' not currently working well. */
const bool is_camera_lock = ED_view3d_camera_lock_check(v3d, rv3d);
- if ((rv3d->persp == RV3D_CAMOB) && (is_camera_lock == false)) {
+ if (rv3d->persp == RV3D_CAMOB) {
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- ED_view3d_persp_switch_from_camera(depsgraph, v3d, rv3d, RV3D_PERSP);
+ if (is_camera_lock) {
+ ED_view3d_camera_lock_init(depsgraph, v3d, rv3d);
+ }
+ else {
+ ED_view3d_persp_switch_from_camera(depsgraph, v3d, rv3d, RV3D_PERSP);
+ }
}
ED_view3d_smooth_view(C,