I'm trying to update a list of lights on the scene. For this I keep the 
last list and delete all the elements, and create new ones based on the new 
list... It deletes all the elements just fine, but when I try to update 
with the new ones.. it just crashes and says:

RuntimeError: Object's name 'textName1' is not unique. #

It's suposed to be deleted, isn't it??

this is the code of this part..


def updateList(self, name, totalLgt, *args):
    print "update %s" % name
    #create new buttons

    self.text = pm.text('textName'+str(totalLgt), label="Name: %s" %name)
    self.button = pm.button('btnName'+str(totalLgt), label="ON" ,command = 
lambda *args: self.turnOn(totalLgt, name))
    self.button = pm.button('btnNameS'+str(totalLgt), label="SOLO", command = 
lambda *args: self.turnSolo(totalLgt, name))
def update(self, totalLgt,lis, *args):
   totalLgt = 0
   for lgt in lis:
        totalLgt += 1

   i = 1
   print "updatea"
   print lis
   for i in range(totalLgt):
      if (pm.window('textName'+str(i+1), exists=True)):
         pm.deleteUI('textName'+str(i+1), control = True)
         pm.deleteUI('btnName'+str(i+1), control = True ) 
         pm.deleteUI('btnNameS'+str(i+1), control = True )

   lisN = pm.ls(type='light') 
   totalLgt = 0 
   #list all lights in scene
   for lgt in lisN: 
      totalLgt += 1
      nameLgt = lgt.longName()
      name = nameLgt.split("|")[1]
      self.updateList(name, totalLgt)


How should I do it so pressing update button I can get the new lights of 
the scene?? 

Thanks 1

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/a6036cfe-30e3-4b2a-9b5f-1bbd35bb6450%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to