使用文本字段结果作为函数名称

Using textfield result as name for function

我想使用文本字段条目来命名新创建的 blenshape。 错误显示:“指定了无效的变形器名称”

这是我目前所拥有的,不幸的是它不起作用:

def blendButton (self, *args):
    #create BlendShape button
        cmds.separator(h=15)
        self.widgets["textfield"]= cmds.textField(fi="Your BS name")
        cmds.button(label="Create BlendShape ", w=295, h=30, al="center",  c=self.blendShape) 

def blendShape (self, *args): 
        cmds.blendShape ( cmds.ls(sl=True)[1], cmds.ls(sl=True)[0],  frontOfChain=True, n= self.widgets["textfield"])

self.widgets["textfield"] 似乎不是一个有效的论点。

您想查询值文本字段小部件:

 blendshape_name = cmds.textField(self.widgets['textfield'], q=True, text=True)