【发布时间】:2018-05-29 04:42:40
【问题描述】:
我正在尝试将表达式结果通过管道传输到 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")
【问题讨论】:
-
你在命令行使用什么命令?预期的行为是什么?实际行为是什么?你有什么错误吗?
-
当您尝试从命令行运行它时会发生什么?发布您正在运行的命令,以及 cli 为您返回的内容。
-
像这样从 python 命令行运行它: textToolHUD() 结果是: textToolHUD() # Error: TypeError: file
line 1: 'module' object is not callable # -
我已经把它作为 textToolHUD.py 保存在我的脚本目录中