通过MEL代码调用Python对象时出错
如何解决这个问题。
Following error occurs from maya. I am doing the following in Filemenu.mel file. this runs at the startup.
python("import saveCentral_fromPath");
...
全局过程 runSaveCentral() {
python("saveCentral_fromPath.saveCentral()");
python("a._first_()");
}
...
菜单项 -标签 ("save Central") -启用 1
-注释 ("发布:复制到中央区域")
-命令 ("runSaveCentral()") publishItem;
# Error: file: S:/xxxxxxxx/scripts/maya/melTEST/FileMenu.mel line 64: class saveCentral_fromPath has no attribute 'saveCentral'
# Traceback (most recent call last):
# File "<maya console>", line 1, in <module>
# AttributeError: class saveCentral_fromPath has no attribute 'saveCentral' #
祝好,
kNish
1 个回答
0
当然可以!请看下面的内容:
在编程中,有时候我们需要让程序做一些特定的事情,比如处理数据或者与用户互动。为了实现这些功能,我们会使用一些代码块,这些代码块就像是程序的“指令”,告诉计算机该怎么做。
例如,代码块可能包含一些简单的操作,比如加法、减法,或者更复杂的逻辑,比如判断一个条件是否成立。通过组合这些代码块,我们可以创建出更复杂的程序,完成各种任务。
总之,代码块是编程的基本单位,就像乐高积木一样,我们可以通过拼接不同的块来搭建出我们想要的东西。
如果你有任何具体的代码块想要了解,随时可以问我!
python("import saveCentral_fromPath");
.
..
global proc runSaveCentral()
{
python("saveCentral_fromPath.saveCentral()._first_()");
# filename.classname.functionname
}
.
.
.
menuItem -label ("save Central") -en 1
-annotation ("publish : copy to central area")
-command ("runSaveCentral()") publishItem;