[英]Maya python fit camera-view to mesh
What you're asking is relatively complex in terms of operation.您要问的操作相对复杂。 You're adjusting multiple camera properties to frame an object.
您正在调整多个相机属性以构图 object。
I recommend you decompose the problem into parts and ignore focal length all together.我建议您将问题分解为多个部分并忽略焦距。 Simply transform a camera so it frames the object.
只需转换相机,使其构图 object。 You can then add a supplementary step to modify the width and height of the camera to tightly frame it.
然后,您可以添加一个补充步骤来修改相机的宽度和高度以紧密地构图。
The gist of what you want to do is as follows:您想要做的事情的要点如下:
This will be much easier if you're familiar with the OpenMaya API.如果您熟悉 OpenMaya API,这会容易得多。 The OpenMayaUI.M3dView and the OpenMaya.MFnCamera classes should get you started.
OpenMayaUI.M3dView 和 OpenMaya.MFnCamera 类应该可以帮助您入门。
https://help.autodesk.com/view/MAYAUL/2019/ENU/?guid=__py_ref_class_open_maya_u_i_1_1_m3d_view_html https://help.autodesk.com/view/MAYAUL/2019/ENU/?guid=__py_ref_class_open_maya_u_i_1_1_m3d_view_html
https://help.autodesk.com/view/MAYAUL/2019/ENU/?guid=__py_ref_class_open_maya_1_1_m_fn_camera_html https://help.autodesk.com/view/MAYAUL/2019/ENU/?guid=__py_ref_class_open_maya_1_1_m_fn_camera_html
If you're unfamiliar with the API, then scour the mel scripts and check how the FrameSelectedWithoutChildren Runtime Command (F key in the viewport) shortcut works, and use that to automate the process.如果您不熟悉 API,请浏览 mel 脚本并检查 FrameSelectedWithoutChildren 运行时命令(视口中的 F 键)快捷方式的工作原理,并使用它来自动执行该过程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.