我正在尝试将表达式结果导入maya文本对象,以用作平视显示。我的脚本在脚本编辑器中工作,但从命令行或从我的显示表达式调用时不起作用。如何更改此项以使其从命令行工作?在
import maya.cmds as cmds
# convert a string to hex values, separated by a space
typeNode = cmds.ls( selection=True )
type3d = cmds.listConnections(t='type')
typeValue = cmds.getAttr( 'tower_CON.Spin' )
valueList=list(str('{:3.2f}'.format(typeValue)))
hexVersion=""
for x in valueList:
hexValue=x.encode("hex")
hexVersion=hexVersion + hexValue + " "
cmds.setAttr(str(type3d[0]) + ".textInput", hexVersion.rstrip(), type="string")
很可能您缺少依赖项。运行:
从您的注释中的错误来看,您似乎正在尝试将模块作为函数运行。在
您可能需要将其保存在文件中:
然后在命令行中
^{pr2}$你也可以按原样保存文件
它将运行一次,但依赖于在导入时运行的代码是不好的做法。在
相关问题 更多 >
编程相关推荐