Fix for using non camera objects as a camera having zero area view-frame
authorCampbell Barton <ideasman42@gmail.com>
Sat, 1 Mar 2014 10:41:07 +0000 (21:41 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 1 Mar 2014 10:41:07 +0000 (21:41 +1100)
source/blender/blenkernel/intern/camera.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c

index 3290f0eae8e9c26ed8de5739bb3148972e9300d5..1e47dc3ab53a1c7ece5fa23cff1720697c62f311 100644 (file)
@@ -198,6 +198,10 @@ void BKE_camera_params_init(CameraParams *params)
        params->sensor_fit = CAMERA_SENSOR_FIT_AUTO;
 
        params->zoom = 1.0f;
+
+       /* fallback for non camera objects */
+       params->clipsta = 0.1f;
+       params->clipsta = 100.0f;
 }
 
 void BKE_camera_params_from_object(CameraParams *params, Object *ob)
index 4220bcf161bce67197e8349ec9416f9b916fe166..18f3d150eb29a3dc08abab6addeaad1764087bf8 100644 (file)
@@ -950,6 +950,9 @@ static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionV
 
        /* get camera viewplane */
        BKE_camera_params_init(&params);
+       /* fallback for non camera objects */
+       params.clipsta = v3d->near;
+       params.clipend = v3d->far;
        BKE_camera_params_from_object(&params, v3d->camera);
        if (no_shift) {
                params.shiftx = 0.0f;
@@ -2746,6 +2749,9 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
                CameraParams params;
 
                BKE_camera_params_init(&params);
+               /* fallback for non camera objects */
+               params.clipsta = v3d->near;
+               params.clipend = v3d->far;
                BKE_camera_params_from_object(&params, v3d->camera);
                BKE_camera_params_compute_viewplane(&params, sizex, sizey, scene->r.xasp, scene->r.yasp);
                BKE_camera_params_compute_matrix(&params);
index cf593a68d77f0af2ddc0b42136f70b3aca655975..f2f4f0f97aa6fac785704508c50dfe04118a3c9d 100644 (file)
@@ -2533,6 +2533,8 @@ static void view3d_from_minmax(bContext *C, View3D *v3d, ARegion *ar,
                        if (rv3d->persp == RV3D_CAMOB && ED_view3d_camera_lock_check(v3d, rv3d)) {
                                CameraParams params;
                                BKE_camera_params_init(&params);
+                               params.clipsta = v3d->near;
+                               params.clipend = v3d->far;
                                BKE_camera_params_from_object(&params, v3d->camera);
 
                                lens = params.lens;