【发布时间】:2019-02-06 21:45:05
【问题描述】:
各位,感谢您抽出宝贵时间阅读本文! Soooooooo ...我正在尝试使用文本曲线在 Maya 中创建一个文本生成工具,但我似乎无法让它工作。我的想法是我在工具中输入文本,然后按下“创建文本”按钮后,该文本会变成几何图形的文本曲线,但无论我做什么,我似乎都会出错。
是否有人可能知道我可以做些什么来补救这种情况?
感谢您抽出宝贵时间阅读本文!干杯!
import sys
import os
import maya.cmds as mc
outputText = 'Hello World'
def UI ():
if mc.window('textGenerator', exists = True):
mc.deleteUI('textGenerator')
mc.window('textGenerator')
mc.columnLayout()
mc.text('Enter text here: ')
mc.textFieldGrp()
mc.button(label = 'Create Text', command = 'buttonPress()')
mc.showWindow('textGenerator')
def buttonPress():
finalName = mc.textFieldGrp()
mc.textCurves(finalName)
sys.stdout.write (outputText)
mc.textCurves(t=outputText)
UI()
【问题讨论】:
-
我刚刚更正了我的代码审查,传递了一个错误的变量,您在第 15 行缺少 -t 标志。(我之前没有 Maya,所以我无法测试它直播:))