Your problem was a few things, I've only included a few basic sections of the code as the rest wasn't needed.
Problem one was __name__
, if this were quoted, we wouldn't have a problem, seeing as it's just a name and not anything special, I'm just going to rename this to name
.
Problem two was duplicate names on panels/panelTypes. IE:
pm.scriptedPanelType(self.__name__, u = True)
pm.scriptedPanel( self.__name__, edit=True, label=self._title )
Maya didn't like that both the panelType and the panel had the same names.
So:
import maya.cmds as cmds
import pymel.core as pm
import maya.mel as mel
class PanelWindow( object ):
def __init__(self, name, title):
self._name = name
self._title = title
self.panelTypeName = self._name + "Type"
if not pm.scriptedPanelType(self.panelTypeName, query=True, exists=True):
pm.scriptedPanelType(self.panelTypeName, unique=True)
if not pm.scriptedPanel(self._title, query=True, exists=True):
## Only allows one instance
pm.scriptedPanel(self._title, menuBarVisible=1, unParent=True, type=self.panelTypeName, label=self._title )
def _addCallback(self):
"""Create UI and parent any editors."""
print 'ADD CALLBACK'
def show( self ):
mel.eval('tearOffPanel "%s" "%s" true;' % (self._title, self._name) )
PanelWindow('lightControlType1', 'lightControl').show()