View Full Version : 'modelPanel1' is not unique ??

05 May 2012, 08:00 AM
Hi all

Im trying to query all the viewport panels and turn off twoSidedLighting but I keep getting the following error for each panel:

# Error: RuntimeError: Object's name 'modelPanel1' is not unique. #

my code looks like this:

panelNames = cmds.getPanel(type='modelPanel')
print panelNames
for each in panelNames:
print '--Disabling twoSidedLighting in panel:', each
cmds.modelEditor(each, twoSidedLighting=False)

Any ideas why the panel names are not unique?

05 May 2012, 08:46 AM
you are not querying! you are creating a new modelPanel each time. if you want to query (or edit) an existing control, make sure you include the appropriate query=True or edit=True flags!

05 May 2012, 02:59 PM
Hi Nathan, thanks for your response.

I think you meant to say I was not Editing, because i was querying with the getPanel Command.

I added edit=True to cmds.modelEditor(Each, tsl=True, edit=True) and the problem is solved.

because the command was called modelEditor I thought it would be editing by default which is where I was confused, but now I see where I went wrong when reading the docs. Thanks for pointing me in the right direction.


05 May 2012, 03:02 PM
ah yeah! sorry.. I got confused because you said you were querying at the start! At least I had the foresight to mention edit flags too though!

CGTalk Moderation
05 May 2012, 03:02 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.