【发布时间】:2017-12-13 18:14:08
【问题描述】:
我正在尝试创建一个简单的 Python 脚本,该脚本将从 Maya 中调用 MEL 脚本来创建立方体。耶!应该相当直截了当,尽管我可能弄错了源文件的语法。
这是我所拥有的:
runMEL.py Python 文件: 将 maya.mel 导入为 mel
def runMEL():
print ("Running MEL from Python!")
mel.eval('"source D:\Maya_Python\myMELScript.mel;"') # source of the file
mel.eval("myMELScript;") #name of the function
runMEL() # call the function above
还有 MEL 脚本 myMELScript.mel
global proc myMELScript()
// call a MEL script with Python
{
polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;
print("MEL just made a cube!");
}
我从控制台得到以下信息:
Running MEL from Python!
// Error: "source D:\Maya_Python\myMELScript.mel;"; //
// Error: Line 1.40: Syntax error //
# Error: RuntimeError: file <maya console> line 5: Error occurred during execution of MEL script
Line 1.40: Syntax error #
【问题讨论】:
-
您是否有特定的原因要通过笨拙的 mel 来处理这个问题?