python - followObject_Setup 和 followObjectExpr 在这里是什么意思
问题描述
我是 Maya 脚本的新手,我被要求将以下 MEL 转换为 Python。
我一直在搜索 Mel 中的所有命令,一切似乎都很好,除了下面脚本中的两个术语 ## followObject_setup 和 followObjectExpr ##。
谁能解释一下,这是什么。
提前致谢
global proc newPointBlast_Follow()
{
/*
Function to get the point from selection and camera from view.
Attach the camera to point.
*/
global string $followingCamera[];
global string $object_to_Follow[];
undoInfo -swf off;
string $currentPanel = `getPanel -wf`;
string $type = `getPanel -typeOf $currentPanel`;
if ( $type == "modelPanel" )
{
$followingCamera[0] = `modelPanel -q -camera $currentPanel`;
}
$object_to_Follow = `ls -sl`;
if ( `size( $object_to_Follow )` == 0 )
{
confirmDialog -title "No Object selected" -message "Please select an Object or Vertex to Follow" -button "OK"; }
else
{
newPointBlast_unlockImagePlanes();
if ( `objExists followObject_setup` )
{
delete followObject_setup;
}
if ( `objExists followObjectExpr` )
{
delete followObjectExpr;
}
最后一个 if 语句的含义是什么?
解决方案
它是在其他地方定义的一些变量。
在 Maya 中,如果您输入 MEL :
whatIs followObjectExpr
whatIs followObject_setup
如果它返回 None,它不是一个 proc 或属于 Maya 的东西
否则,如果你不能在 python 中粗略地转换你的命令,你可以使用下面的命令来转换一个 mel 字符串:
import pymel.tools.mel2py as mel2py
text = raw_input()
print(mel2py.mel2pyStr(text, pymelNamespace='pm'))
或者您可以使用它来转换 mel 文件:
import pymel.tools.mel2py as mel2py
mel2py.mel2py('/path/maya20XX/scripts/others/doWrapArgList.mel',
'/path/myfolder/doWrapArgList/')
推荐阅读
- laravel - Vue.js - Laravel 填充日期时间本地输入字段
- python - Anaconda 3 安装错误 - 没有脚本文件夹,也没有 conda 命令提示符和快捷方式
- c# - Web 参考 C# 的可配置值
- python - 在 python 中,如何为使用打开文件的函数编写单元测试?
- android - 当我们对某些用户进行身份验证时,我们是否需要添加 livedata?
- android - 以线性布局居中 Edittext - Android
- sql - 在oracle plsql中添加n个工作日,包括自定义假期列表
- return - 布尔返回类型混淆
- javascript - 使用 Node Express 从 Apache Ignite 获取数据的问题
- ios - 将CustomView添加到navigationItem后,CustomView总是返回nil