diff options
Diffstat (limited to 'source/blender/editors/render')
-rw-r--r-- | source/blender/editors/render/render_preview.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 10e0a143d9b..157f2b3ecb4 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -692,8 +692,9 @@ struct ObjectPreviewData { int sizey; }; -static Object *object_preview_camera_create( - Main *preview_main, ViewLayer *view_layer, Object *preview_object, int sizex, int sizey) +static Object *object_preview_camera_create(Main *preview_main, + ViewLayer *view_layer, + Object *preview_object) { Object *camera = BKE_object_add(preview_main, view_layer, OB_CAMERA, "Preview Camera"); @@ -701,18 +702,17 @@ static Object *object_preview_camera_create( float dummyscale[3]; mat4_to_loc_rot_size(camera->loc, rotmat, dummyscale, preview_object->obmat); - /* Camera is Y up, so needs additional 90deg rotation around X to match object's Z up. */ + /* Camera is Y up, so needs additional rotations to obliquely face the front. */ float drotmat[3][3]; - axis_angle_to_mat3_single(drotmat, 'X', M_PI_2); + const float eul[3] = {M_PI * 0.4f, 0.0f, M_PI * 0.1f}; + eul_to_mat3(drotmat, eul); mul_m3_m3_post(rotmat, drotmat); camera->rotmode = ROT_MODE_QUAT; mat3_to_quat(camera->quat, rotmat); - /* shader_preview_render() does this too. */ - if (sizex > sizey) { - ((Camera *)camera->data)->lens *= (float)sizey / (float)sizex; - } + /* Nice focal length for close portraiture. */ + ((Camera *)camera->data)->lens = 85; return camera; } @@ -730,11 +730,8 @@ static Scene *object_preview_scene_create(const struct ObjectPreviewData *previe BKE_collection_object_add(preview_data->pr_main, scene->master_collection, preview_data->object); - Object *camera_object = object_preview_camera_create(preview_data->pr_main, - view_layer, - preview_data->object, - preview_data->sizex, - preview_data->sizey); + Object *camera_object = object_preview_camera_create( + preview_data->pr_main, view_layer, preview_data->object); scene->camera = camera_object; scene->r.xsch = preview_data->sizex; |