[Bf-blender-cvs] [94226271556] master: Fix T99653: "Align Active Camera to Selected" fails with ortho camera
Campbell Barton
noreply at git.blender.org
Wed Jul 13 08:42:12 CEST 2022
Commit: 94226271556baacc5a77432fc9c62638901ce664
Author: Campbell Barton
Date: Wed Jul 13 16:18:14 2022 +1000
Branches: master
https://developer.blender.org/rB94226271556baacc5a77432fc9c62638901ce664
Fix T99653: "Align Active Camera to Selected" fails with ortho camera
There were two bugs, a regression in [0] and the object-data wasn't
tagged for depsgraph updating.
[0]: 19df0e3cfd5b9fed891ed81dd1123b2351605a7d
===================================================================
M source/blender/blenkernel/intern/camera.c
M source/blender/editors/space_view3d/view3d_utils.c
===================================================================
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index fbe03ac365c..1c4267cac6d 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -622,15 +622,13 @@ static void camera_frame_fit_data_init(const Scene *scene,
invert_m4(camera_rotmat_transposed_inversed);
/* Extract frustum planes from projection matrix. */
- planes_from_projmat(
- params->winmat,
- /* left right top bottom near far */
- data->plane_tx[2],
- data->plane_tx[0],
- data->plane_tx[3],
- data->plane_tx[1],
- NULL,
- NULL);
+ planes_from_projmat(params->winmat,
+ data->plane_tx[2],
+ data->plane_tx[0],
+ data->plane_tx[1],
+ data->plane_tx[3],
+ NULL,
+ NULL);
/* Rotate planes and get normals from them */
for (uint i = 0; i < CAMERA_VIEWFRAME_NUM_PLANES; i++) {
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c
index 1fabdef8da2..85b1af8e55d 100644
--- a/source/blender/editors/space_view3d/view3d_utils.c
+++ b/source/blender/editors/space_view3d/view3d_utils.c
@@ -1492,10 +1492,12 @@ static bool view3d_camera_to_view_selected_impl(struct Main *bmain,
depsgraph, scene, camera_ob_eval, co, &scale, r_clip_start, r_clip_end)) {
ObjectTfmProtectedChannels obtfm;
float obmat_new[4][4];
+ bool is_ortho_camera = false;
if ((camera_ob_eval->type == OB_CAMERA) &&
(((Camera *)camera_ob_eval->data)->type == CAM_ORTHO)) {
((Camera *)camera_ob->data)->ortho_scale = scale;
+ is_ortho_camera = true;
}
copy_m4_m4(obmat_new, camera_ob_eval->obmat);
@@ -1508,6 +1510,9 @@ static bool view3d_camera_to_view_selected_impl(struct Main *bmain,
/* notifiers */
DEG_id_tag_update_ex(bmain, &camera_ob->id, ID_RECALC_TRANSFORM);
+ if (is_ortho_camera) {
+ DEG_id_tag_update_ex(bmain, camera_ob->data, ID_RECALC_PARAMETERS);
+ }
return true;
}
More information about the Bf-blender-cvs
mailing list