UI: Object Thumbnails Orientation Change
Object orientation for thumbnail creation changed to be slightly oblique (tilted to one side and from above) to better show shape, especially when axis-aligned. Camera lens changed to 85 to avoid distortion of close objects like human heads. see D9940 for details and examples. Differential Revision: https://developer.blender.org/D9940 Reviewed by Julian Eisel
This commit is contained in:
parent
06af6a9efa
commit
ecc7a83798
Notes:
blender-bot
2023-02-14 04:46:12 +01:00
Referenced by issue #82704, Polish Preview Creation
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue