report [#34772] Incorrect aspect for tex mapping from camera view
There was no good way to UV project from a camera with non-square view-border without it stretching the image (even using 'Correct Aspect'). While this isnt a bug its useful to do a UV projection without stretching the image, added 'Camera Bounds' option.
This commit is contained in:
@@ -1339,10 +1339,14 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
else if (camera) {
|
||||
const bool camera_bounds = RNA_boolean_get(op->ptr, "camera_bounds");
|
||||
struct ProjCameraInfo *uci = BLI_uvproject_camera_info(v3d->camera, obedit->obmat,
|
||||
scene->r.xsch * scene->r.xasp,
|
||||
scene->r.ysch * scene->r.yasp);
|
||||
camera_bounds ? (scene->r.xsch * scene->r.xasp) : 1.0f,
|
||||
camera_bounds ? (scene->r.ysch * scene->r.yasp) : 1.0f);
|
||||
|
||||
|
||||
// BLI_uvproject_camera_info_scale
|
||||
|
||||
if (uci) {
|
||||
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
|
||||
if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
|
||||
@@ -1403,7 +1407,10 @@ void UV_OT_project_from_view(wmOperatorType *ot)
|
||||
ot->poll = uv_from_view_poll;
|
||||
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "orthographic", 0, "Orthographic", "Use orthographic projection");
|
||||
RNA_def_boolean(ot->srna, "orthographic", 0, "Orthographic",
|
||||
"Use orthographic projection");
|
||||
RNA_def_boolean(ot->srna, "camera_bounds", 1, "Camera Bounds",
|
||||
"Map UVs to the camera region taking resolution and aspect into account");
|
||||
uv_map_clip_correct_properties(ot);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user