【发布时间】:2019-01-10 19:44:30
【问题描述】:
在执行下面的代码时,窗口是在运行代码的第一个实例上创建的。如果我尝试编辑方法 createCustomUI.... 会出现问题。
我收到以下错误
错误:第 1 行:对象的名称“testUI”不是唯一的。
....并且没有创建窗口。我正在尝试找出为什么会出现此错误并找到一个好的解决方案。
import pymel.core as pm
from functools import partial
class ControlCurveTools_UI(object):
def __init__(self):
self.windowName = "testUI"
self.windowHeight = 1000
self.windowWidth = 250
self.createUI(self.windowName, self.windowHeight, self.windowWidth, True, False)
def createUI(self, windowName, windowHeight, windowWidth, dock, scroll):
if dock == True:
if pm.dockControl(windowName + "_dock", exists = True):
pm.deleteUI(windowName + "_dock")
else:
if pm.window(windowName, exists = True):
pm.deleteUI(windowName)
print "here"
print self.windowName
self.window = pm.window(windowName, title = windowName, w = windowWidth, h = windowHeight, mnb = False, mxb = False)
print "here2"
self.mainlayout = pm.columnLayout(adj = True)
# Uniqe UI stuff
self.createCustomUI()
print "here3"
if dock == True:
pm.dockControl(windowName + "_dock", label = windowName + "_dock", area = "left", content = self.window, w = self.windowWidth)
else:
pm.showWindow(self.window)
def createCustomUI(self):
pm.rowColumnLayout(nc = 1, parent = self.mainlayout, w = self.windowWidth, e=1)
pm.button(label = "Replace Curve With Selected", p=self.mainlayout)
pm.button(label = "Mirror Selected Curve", p=self.mainlayout)
# print "creatingCustomUI"
【问题讨论】:
-
搜索“对象的名称不是唯一的”并且有很多命中。研究一下,如果没有帮助,edit这个问题并告诉我们你做了什么。
标签: python oop user-interface maya