[Bf-blender-cvs] [33fc230ba2e] master: Fix T98799: camera unselectable in camera view below a certain scale

Philipp Oeser noreply at git.blender.org
Tue Jun 28 07:55:14 CEST 2022


Commit: 33fc230ba2e93242f6862a8934a96c3f6619bcb8
Author: Philipp Oeser
Date:   Tue Jun 28 15:51:19 2022 +1000
Branches: master
https://developer.blender.org/rB33fc230ba2e93242f6862a8934a96c3f6619bcb8

Fix T98799: camera unselectable in camera view below a certain scale

The camera frame (used for selection) was drawn outside the near
clipping plane in those cases.

This has been an issue before as seen in the following commits:
- rB6e7e6832e87
- rB33d322873e6
- rB4f9451c0442

Remaining issue was that the code which ensure the frame isn't behind
the near clipping plane was not taking into account the camera could be
scaled (in Z).
A caller of `BKE_camera_view_frame_ex` (namely
`OVERLAY_camera_cache_populate`) applies scale (also on the depth) which
does not play well with the way `BKE_camera_view_frame_ex` did it.

Now take Z scale into account.

Ref D15178

===================================================================

M	source/blender/blenkernel/intern/camera.c

===================================================================

diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 6325251647b..fbe03ac365c 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -528,7 +528,7 @@ void BKE_camera_view_frame_ex(const Scene *scene,
 
   if (do_clip) {
     /* Ensure the frame isn't behind the near clipping plane, T62814. */
-    float fac = (camera->clip_start + 0.1f) / -r_vec[0][2];
+    float fac = ((camera->clip_start + 0.1f) / -r_vec[0][2]) * scale[2];
     for (uint i = 0; i < 4; i++) {
       if (camera->type == CAM_ORTHO) {
         r_vec[i][2] *= fac;



More information about the Bf-blender-cvs mailing list