def createWindow(self):
        '''
            creates main GUI window and it's contents
        '''

        BaseToolWindow.createWindow(self)

        self.targetUI = TargetDataDisplay()
        self.actions = MainUiActions(self.windowName)

        self.mainMenu = MainMenu()
        self.mainMenu.create()

        # putting tabs in a from targetUiLayout is needed to workaround maya2011
        # bug with an additional empty tab appearing otherwise
        #        form = FormLayout(parent=self.windowName)
        #        targetUiLayout = self.targetUI.create(form)
        #        form.attachForm(targetUiLayout, 0, Constants.MARGIN_SPACING_HORIZONTAL,None,Constants.MARGIN_SPACING_HORIZONTAL)
        #
        #        self.mainTabLayout = cmds.tabLayout(childResizable=True,parent=form,scrollable=False,innerMarginWidth=3)
        #        form.attachControl(self.mainTabLayout, targetUiLayout, Constants.MARGIN_SPACING_VERTICAL, None,None,None)
        #        form.attachForm(self.mainTabLayout, None, 0,0,0)

        self.splitPosition = PersistentValueModel(
            name="ngSkinTools_mainWindow_splitPosition", defaultValue=50)

        def updateSplitPosition(*args):
            size = cmds.paneLayout(horizontalSplit, q=True, paneSize=True)
            # returns (widht, height, width, height)
            self.splitPosition.set(size[1])

        horizontalSplit = cmds.paneLayout(
            configuration="horizontal2",
            width=100,
            height=200,
            separatorMovedCommand=updateSplitPosition)
        if Utils.getMayaVersion() >= Utils.MAYA2011:
            cmds.paneLayout(horizontalSplit, e=True, staticHeightPane=2)
        cmds.paneLayout(horizontalSplit,
                        e=True,
                        paneSize=(1, 100, self.splitPosition.get()))
        cmds.paneLayout(horizontalSplit,
                        e=True,
                        paneSize=(2, 100, 100 - self.splitPosition.get()))

        targetUiLayout = self.targetUI.create(horizontalSplit)
        self.mainTabLayout = cmds.tabLayout(childResizable=True,
                                            parent=horizontalSplit,
                                            scrollable=False,
                                            innerMarginWidth=3)

        self.tabPaint = self.addTab(TabPaint())
        self.tabMirror = self.addTab(TabMirror())
        self.tabRelax = self.addTab(TabSkinRelax())
        self.tabAssignWeights = self.addTab(TabAssignWeights())
        self.tabSettings = self.addTab(TabSettings())

        self.actions.updateEnabledAll()
Beispiel #2
0
    def createWindow(self):
        '''
            creates main GUI window and it's contents
        '''
        
        BaseToolWindow.createWindow(self)
        
        self.targetUI = TargetDataDisplay()
        self.actions = MainUiActions(self.windowName)
        
        self.mainMenu = MainMenu()
        self.mainMenu.create();
        
        
        

        # putting tabs in a from targetUiLayout is needed to workaround maya2011 
        # bug with an additional empty tab appearing otherwise
#        form = FormLayout(parent=self.windowName)
#        targetUiLayout = self.targetUI.create(form)
#        form.attachForm(targetUiLayout, 0, Constants.MARGIN_SPACING_HORIZONTAL,None,Constants.MARGIN_SPACING_HORIZONTAL)
#        
#        self.mainTabLayout = cmds.tabLayout(childResizable=True,parent=form,scrollable=False,innerMarginWidth=3)
#        form.attachControl(self.mainTabLayout, targetUiLayout, Constants.MARGIN_SPACING_VERTICAL, None,None,None)
#        form.attachForm(self.mainTabLayout, None, 0,0,0)
        
        
        self.splitPosition = PersistentValueModel(name="ngSkinTools_mainWindow_splitPosition", defaultValue=50)
        def updateSplitPosition(*args):
            size = cmds.paneLayout(horizontalSplit,q=True,paneSize=True)
            # returns (widht, height, width, height)
            self.splitPosition.set(size[1])
        horizontalSplit = cmds.paneLayout(configuration="horizontal2",width=100,height=200,separatorMovedCommand=updateSplitPosition)
        if Utils.getMayaVersion()>=Utils.MAYA2011:
            cmds.paneLayout(horizontalSplit,e=True,staticHeightPane=2)
        cmds.paneLayout(horizontalSplit,e=True,paneSize=(1,100,self.splitPosition.get()))
        cmds.paneLayout(horizontalSplit,e=True,paneSize=(2,100,100-self.splitPosition.get()))
        
        
        
        targetUiLayout = self.targetUI.create(horizontalSplit)
        self.mainTabLayout = cmds.tabLayout(childResizable=True,parent=horizontalSplit,scrollable=False,innerMarginWidth=3)        
        
        
        
        self.tabPaint = self.addTab(TabPaint())
        self.tabMirror = self.addTab(TabMirror())
        self.tabRelax = self.addTab(TabSkinRelax())
        self.tabAssignWeights = self.addTab(TabAssignWeights())
        self.tabSettings = self.addTab(TabSettings())
        

        self.actions.updateEnabledAll()
class MainWindow(BaseToolWindow):
    WINDOW_NAME = 'ngSkinToolsMainWindow'
    WINDOW_DEFAULT_WIDTH = 400
    WINDOW_DEFAULT_HEIGHT = 500

    @staticmethod
    @Utils.visualErrorHandling
    def open():
        '''
        just a shortcut method to construct and display main window
        '''

        window = MainWindow.getInstance()
        window.showWindow()

        # don't know where to fit this in, it's just an utility warning for those trying to run
        # this on a different maya version
        if Utils.getMayaVersion() == Utils.MAYAUNSUPPORTEDVERSION:
            Utils.displayError('unsupported Maya version detected.')

        Utils.silentCheckForUpdates()

        return window

    @staticmethod
    def getInstance():
        '''
        returns instance of a main window; returned value is only valid while window is opened.
        '''

        return BaseToolWindow.getWindowInstance(MainWindow.WINDOW_NAME,
                                                MainWindow)

    def __init__(self, windowName):
        log.debug("creating main window")

        BaseToolWindow.__init__(self, windowName)

        self.windowTitle = self.createWindowTitle()

        self.mainTabLayout = None
        self.tabs = []

        # layer target UI - compound for layers list/no layer data ui
        self.targetUI = None

        self.actions = None

        self.defaultWidth = MainWindow.WINDOW_DEFAULT_WIDTH
        self.defaultHeight = MainWindow.WINDOW_DEFAULT_HEIGHT

        self.sizeable = True

    def createWindowTitle(self):
        '''
        creates main window title
        '''
        return Version.getReleaseName()

    def createWindow(self):
        '''
            creates main GUI window and it's contents
        '''

        BaseToolWindow.createWindow(self)

        self.targetUI = TargetDataDisplay()
        self.actions = MainUiActions(self.windowName)

        self.mainMenu = MainMenu()
        self.mainMenu.create()

        # putting tabs in a from targetUiLayout is needed to workaround maya2011
        # bug with an additional empty tab appearing otherwise
        #        form = FormLayout(parent=self.windowName)
        #        targetUiLayout = self.targetUI.create(form)
        #        form.attachForm(targetUiLayout, 0, Constants.MARGIN_SPACING_HORIZONTAL,None,Constants.MARGIN_SPACING_HORIZONTAL)
        #
        #        self.mainTabLayout = cmds.tabLayout(childResizable=True,parent=form,scrollable=False,innerMarginWidth=3)
        #        form.attachControl(self.mainTabLayout, targetUiLayout, Constants.MARGIN_SPACING_VERTICAL, None,None,None)
        #        form.attachForm(self.mainTabLayout, None, 0,0,0)

        self.splitPosition = PersistentValueModel(
            name="ngSkinTools_mainWindow_splitPosition", defaultValue=50)

        def updateSplitPosition(*args):
            size = cmds.paneLayout(horizontalSplit, q=True, paneSize=True)
            # returns (widht, height, width, height)
            self.splitPosition.set(size[1])

        horizontalSplit = cmds.paneLayout(
            configuration="horizontal2",
            width=100,
            height=200,
            separatorMovedCommand=updateSplitPosition)
        if Utils.getMayaVersion() >= Utils.MAYA2011:
            cmds.paneLayout(horizontalSplit, e=True, staticHeightPane=2)
        cmds.paneLayout(horizontalSplit,
                        e=True,
                        paneSize=(1, 100, self.splitPosition.get()))
        cmds.paneLayout(horizontalSplit,
                        e=True,
                        paneSize=(2, 100, 100 - self.splitPosition.get()))

        targetUiLayout = self.targetUI.create(horizontalSplit)
        self.mainTabLayout = cmds.tabLayout(childResizable=True,
                                            parent=horizontalSplit,
                                            scrollable=False,
                                            innerMarginWidth=3)

        self.tabPaint = self.addTab(TabPaint())
        self.tabMirror = self.addTab(TabMirror())
        self.tabRelax = self.addTab(TabSkinRelax())
        self.tabAssignWeights = self.addTab(TabAssignWeights())
        self.tabSettings = self.addTab(TabSettings())

        self.actions.updateEnabledAll()

    def addTab(self, tab):
        '''
        adds tab object to tab UI, creating it's ui and attaching to main window
        '''
        cmds.setParent(self.mainTabLayout)
        layout = tab.createUI(self.mainTabLayout)
        cmds.tabLayout(self.mainTabLayout,
                       edit=True,
                       tabLabel=((layout, tab.getTitle())))
        tab.parentWindow = self
        self.tabs.append(tab)

        return tab

    def findTab(self, tabClass):
        for i in self.tabs:
            if isinstance(i, tabClass):
                return i

        return None
Beispiel #4
0
class MainWindow(BaseToolWindow):
    WINDOW_NAME = 'ngSkinToolsMainWindow'
    DOCK_NAME = 'ngSkinToolsMainWindow_dock'

    @staticmethod
    @Utils.visualErrorHandling
    def open():
        '''
        just a shortcut method to construct and display main window
        '''

        window = MainWindow.getInstance()

        if cmds.control(MainWindow.DOCK_NAME, q=True, exists=True):
            cmds.control(MainWindow.DOCK_NAME, e=True, visible=True)
        else:
            cmds.dockControl(MainWindow.DOCK_NAME,
                             l=window.createWindowTitle(),
                             content=MainWindow.WINDOW_NAME,
                             area='right',
                             allowedArea=['right', 'left'],
                             width=window.preferedWidth.get(),
                             floating=window.preferedFloating.get(),
                             visibleChangeCommand=window.visibilityChanged)

            if window.preferedFloating.get():
                cmds.window(MainWindow.DOCK_NAME,
                            e=True,
                            topEdge=window.preferedTop.get(),
                            leftEdge=window.preferedLeft.get(),
                            w=window.preferedWidth.get(),
                            h=window.preferedHeight.get())

            Utils.silentCheckForUpdates()

        # bring tab to front; evaluate lazily as sometimes UI can show other errors and this command somehow fails
        cmds.evalDeferred(lambda *args: cmds.dockControl(
            MainWindow.DOCK_NAME, e=True, r=True))

        # a bit of a fake, but can't find a better place for an infrequent save
        LayerEvents.layerAvailabilityChanged.addHandler(
            window.savePrefs, MainWindow.DOCK_NAME)

        return window

    def visibilityChanged(self, *args):
        hidden = cmds.control(MainWindow.DOCK_NAME, q=True, isObscured=1)

        if hidden:
            self.savePrefs()

    def savePrefs(self):
        if cmds.dockControl(MainWindow.DOCK_NAME, exists=True):
            self.preferedFloating.set(
                cmds.dockControl(MainWindow.DOCK_NAME, q=True, floating=True))
            self.preferedWidth.set(
                cmds.dockControl(MainWindow.DOCK_NAME, q=True, w=True))

        if cmds.window(MainWindow.DOCK_NAME, exists=True):
            self.preferedWidth.set(
                cmds.window(MainWindow.DOCK_NAME, q=True, w=True))
            self.preferedHeight.set(
                cmds.window(MainWindow.DOCK_NAME, q=True, h=True))
            self.preferedTop.set(
                cmds.window(MainWindow.DOCK_NAME, q=True, topEdge=True))
            self.preferedLeft.set(
                cmds.window(MainWindow.DOCK_NAME, q=True, leftEdge=True))

    @staticmethod
    def getInstance():
        '''
        returns instance of a main window; returned value is only valid while window is opened.
        '''

        return BaseToolWindow.getWindowInstance(MainWindow.WINDOW_NAME,
                                                MainWindow)

    def __init__(self, windowName):
        log.debug("creating main window")

        BaseToolWindow.__init__(self, windowName)

        self.windowTitle = self.createWindowTitle()

        self.mainTabLayout = None
        self.tabs = []

        # layer target UI - compound for layers list/no layer data ui
        self.targetUI = None

        self.actions = None

        self.preferedWidth = PersistentValueModel(
            'ngSkinToolsMainWindow_preferedWidth', 400)
        self.preferedHeight = PersistentValueModel(
            'ngSkinToolsMainWindow_preferedHeight', 400)
        self.preferedTop = PersistentValueModel(
            'ngSkinToolsMainWindow_preferedTop')
        self.preferedLeft = PersistentValueModel(
            'ngSkinToolsMainWindow_preferedLeft')
        self.preferedFloating = PersistentValueModel(
            'ngSkinToolsMainWindow_preferedFloating', False)

        self.useUserPrefSize = False

        self.defaultWidth = self.preferedWidth.get()
        self.defaultHeight = self.preferedHeight.get()

        self.sizeable = True

    def createWindowTitle(self):
        '''
        creates main window title
        '''
        return Version.getReleaseName()

    def createWindow(self):
        '''
            creates main GUI window and it's contents
        '''

        BaseToolWindow.createWindow(self)

        self.targetUI = TargetDataDisplay()
        self.actions = MainUiActions(self.windowName)

        self.mainMenu = MainMenu()
        self.mainMenu.create()

        # putting tabs in a from targetUiLayout is needed to workaround maya2011
        # bug with an additional empty tab appearing otherwise

        self.splitPosition = PersistentValueModel(
            name="ngSkinTools_mainWindow_splitPosition", defaultValue=50)

        def updateSplitPosition(*args):
            size = cmds.paneLayout(horizontalSplit, q=True, paneSize=True)
            # returns (widht, height, width, height)
            self.splitPosition.set(size[1])

        horizontalSplit = cmds.paneLayout(
            configuration="horizontal2",
            width=100,
            height=200,
            separatorMovedCommand=updateSplitPosition)
        if Utils.getMayaVersion() >= Utils.MAYA2011:
            cmds.paneLayout(horizontalSplit, e=True, staticHeightPane=2)
        cmds.paneLayout(horizontalSplit,
                        e=True,
                        paneSize=(1, 100, self.splitPosition.get()))
        cmds.paneLayout(horizontalSplit,
                        e=True,
                        paneSize=(2, 100, 100 - self.splitPosition.get()))

        targetUiLayout = self.targetUI.create(horizontalSplit)
        self.mainTabLayout = cmds.tabLayout(childResizable=True,
                                            parent=horizontalSplit,
                                            scrollable=False,
                                            innerMarginWidth=3)

        self.tabPaint = self.addTab(TabPaint())
        self.tabMirror = self.addTab(TabMirror())
        self.tabRelax = self.addTab(TabSkinRelax())
        self.tabAssignWeights = self.addTab(TabAssignWeights())
        self.tabSettings = self.addTab(TabSettings())

        self.actions.updateEnabledAll()

    def addTab(self, tab):
        '''
        adds tab object to tab UI, creating it's ui and attaching to main window
        '''
        cmds.setParent(self.mainTabLayout)
        layout = tab.createUI(self.mainTabLayout)
        cmds.tabLayout(self.mainTabLayout,
                       edit=True,
                       tabLabel=((layout, tab.getTitle())))
        tab.parentWindow = self
        self.tabs.append(tab)

        return tab

    def findTab(self, tabClass):
        for i in self.tabs:
            if isinstance(i, tabClass):
                return i

        return None
Beispiel #5
0
class MainWindow(BaseToolWindow):
    WINDOW_NAME = 'ngSkinToolsMainWindow'
    WINDOW_DEFAULT_WIDTH = 400;
    WINDOW_DEFAULT_HEIGHT = 500;
    
    @staticmethod
    @Utils.visualErrorHandling
    def open():
        '''
        just a shortcut method to construct and display main window
        '''

        window = MainWindow.getInstance()
        window.showWindow()
        
        # don't know where to fit this in, it's just an utility warning for those trying to run
        # this on a different maya version
        if Utils.getMayaVersion()==Utils.MAYAUNSUPPORTEDVERSION:
            Utils.displayError('unsupported Maya version detected.')
            
        Utils.silentCheckForUpdates()
        
        return window
        
    @staticmethod
    def getInstance():
        '''
        returns instance of a main window; returned value is only valid while window is opened.
        '''
        
        return BaseToolWindow.getWindowInstance(MainWindow.WINDOW_NAME,MainWindow)
        
        
    def __init__(self,windowName):
        log.debug("creating main window")
        
        BaseToolWindow.__init__(self,windowName)
        
        self.windowTitle = self.createWindowTitle()
        
        self.mainTabLayout = None
        self.tabs = []
        
        
        # layer target UI - compound for layers list/no layer data ui
        self.targetUI = None
        
        self.actions = None
        
        self.defaultWidth = MainWindow.WINDOW_DEFAULT_WIDTH
        self.defaultHeight = MainWindow.WINDOW_DEFAULT_HEIGHT
        
        self.sizeable = True


    def createWindowTitle(self):
        '''
        creates main window title
        '''
        return Version.getReleaseName()
    
    def createWindow(self):
        '''
            creates main GUI window and it's contents
        '''
        
        BaseToolWindow.createWindow(self)
        
        self.targetUI = TargetDataDisplay()
        self.actions = MainUiActions(self.windowName)
        
        self.mainMenu = MainMenu()
        self.mainMenu.create();
        
        
        

        # putting tabs in a from targetUiLayout is needed to workaround maya2011 
        # bug with an additional empty tab appearing otherwise
#        form = FormLayout(parent=self.windowName)
#        targetUiLayout = self.targetUI.create(form)
#        form.attachForm(targetUiLayout, 0, Constants.MARGIN_SPACING_HORIZONTAL,None,Constants.MARGIN_SPACING_HORIZONTAL)
#        
#        self.mainTabLayout = cmds.tabLayout(childResizable=True,parent=form,scrollable=False,innerMarginWidth=3)
#        form.attachControl(self.mainTabLayout, targetUiLayout, Constants.MARGIN_SPACING_VERTICAL, None,None,None)
#        form.attachForm(self.mainTabLayout, None, 0,0,0)
        
        
        self.splitPosition = PersistentValueModel(name="ngSkinTools_mainWindow_splitPosition", defaultValue=50)
        def updateSplitPosition(*args):
            size = cmds.paneLayout(horizontalSplit,q=True,paneSize=True)
            # returns (widht, height, width, height)
            self.splitPosition.set(size[1])
        horizontalSplit = cmds.paneLayout(configuration="horizontal2",width=100,height=200,separatorMovedCommand=updateSplitPosition)
        if Utils.getMayaVersion()>=Utils.MAYA2011:
            cmds.paneLayout(horizontalSplit,e=True,staticHeightPane=2)
        cmds.paneLayout(horizontalSplit,e=True,paneSize=(1,100,self.splitPosition.get()))
        cmds.paneLayout(horizontalSplit,e=True,paneSize=(2,100,100-self.splitPosition.get()))
        
        
        
        targetUiLayout = self.targetUI.create(horizontalSplit)
        self.mainTabLayout = cmds.tabLayout(childResizable=True,parent=horizontalSplit,scrollable=False,innerMarginWidth=3)        
        
        
        
        self.tabPaint = self.addTab(TabPaint())
        self.tabMirror = self.addTab(TabMirror())
        self.tabRelax = self.addTab(TabSkinRelax())
        self.tabAssignWeights = self.addTab(TabAssignWeights())
        self.tabSettings = self.addTab(TabSettings())
        

        self.actions.updateEnabledAll()
        
        
        
    def addTab(self,tab):
        '''
        adds tab object to tab UI, creating it's ui and attaching to main window
        '''
        cmds.setParent(self.mainTabLayout)
        layout = tab.createUI(self.mainTabLayout)
        cmds.tabLayout( self.mainTabLayout, edit=True, tabLabel=((layout, tab.getTitle())));
        tab.parentWindow = self
        self.tabs.append(tab)
        
        return tab
        

        
    def findTab(self,tabClass):
        for i in self.tabs:
            if isinstance(i,tabClass):
                return i
            
        return None    
Beispiel #6
0
class MainWindow(BaseToolWindow):
    WINDOW_NAME = 'ngSkinToolsMainWindow'
    DOCK_NAME = 'ngSkinToolsMainWindow_dock'
    
    @staticmethod
    @Utils.visualErrorHandling
    def open():
        '''
        just a shortcut method to construct and display main window
        '''

        window = MainWindow.getInstance()
        
        if cmds.control(MainWindow.DOCK_NAME,q=True,exists=True):
            cmds.control(MainWindow.DOCK_NAME,e=True,visible=True)
        else:
            cmds.dockControl(MainWindow.DOCK_NAME,l=window.createWindowTitle(),content=MainWindow.WINDOW_NAME,
                             area='right',allowedArea=['right', 'left'],
                             width=window.preferedWidth.get(),
                             floating=window.preferedFloating.get(),
                             visibleChangeCommand=window.visibilityChanged)
            
            if window.preferedFloating.get():
                cmds.window(MainWindow.DOCK_NAME,e=True,
                            topEdge=window.preferedTop.get(),leftEdge=window.preferedLeft.get(),
                            w=window.preferedWidth.get(),h=window.preferedHeight.get())
        
            Utils.silentCheckForUpdates()
        
        # bring tab to front; evaluate lazily as sometimes UI can show other errors and this command somehow fails
        cmds.evalDeferred(lambda *args: cmds.dockControl(MainWindow.DOCK_NAME,e=True,r=True));
        
        # a bit of a fake, but can't find a better place for an infrequent save
        LayerEvents.layerAvailabilityChanged.addHandler(window.savePrefs, MainWindow.DOCK_NAME)
        
        return window
    
    def visibilityChanged(self,*args):
        hidden = cmds.control(MainWindow.DOCK_NAME,q=True,isObscured=1)
            
        if hidden:
            self.savePrefs()

    def savePrefs(self):
        if cmds.dockControl(MainWindow.DOCK_NAME,exists=True):
            self.preferedFloating.set(cmds.dockControl(MainWindow.DOCK_NAME,q=True,floating=True))
            self.preferedWidth.set(cmds.dockControl(MainWindow.DOCK_NAME,q=True,w=True))

        if cmds.window(MainWindow.DOCK_NAME,exists=True):
            self.preferedWidth.set(cmds.window(MainWindow.DOCK_NAME,q=True,w=True))
            self.preferedHeight.set(cmds.window(MainWindow.DOCK_NAME,q=True,h=True))
            self.preferedTop.set(cmds.window(MainWindow.DOCK_NAME,q=True,topEdge=True))
            self.preferedLeft.set(cmds.window(MainWindow.DOCK_NAME,q=True,leftEdge=True))
        
        
    @staticmethod
    def getInstance():
        '''
        returns instance of a main window; returned value is only valid while window is opened.
        
        :rtype: MainWindow
        '''
        
        return BaseToolWindow.getWindowInstance(MainWindow.WINDOW_NAME,MainWindow)
        
        
    def __init__(self,windowName):
        log.debug("creating main window")
        
        BaseToolWindow.__init__(self,windowName)
        
        self.windowTitle = self.createWindowTitle()
        
        self.mainTabLayout = None
        self.tabs = []
        
        
        # layer target UI - compound for layers list/no layer data ui
        self.targetUI = None
        
        self.actions = None
        
        self.preferedWidth = PersistentValueModel('ngSkinToolsMainWindow_preferedWidth', 400);
        self.preferedHeight = PersistentValueModel('ngSkinToolsMainWindow_preferedHeight',400);
        self.preferedTop = PersistentValueModel('ngSkinToolsMainWindow_preferedTop');
        self.preferedLeft = PersistentValueModel('ngSkinToolsMainWindow_preferedLeft');
        self.preferedFloating = PersistentValueModel('ngSkinToolsMainWindow_preferedFloating',False)
        
        self.useUserPrefSize = False
        
        self.defaultWidth = self.preferedWidth.get()
        self.defaultHeight = self.preferedHeight.get()
        
        self.sizeable = True
        


    def createWindowTitle(self):
        '''
        creates main window title
        '''
        return Version.getReleaseName()
    
    def createWindow(self):
        '''
            creates main GUI window and it's contents
        '''
        
    
        BaseToolWindow.createWindow(self)
        
        self.targetUI = TargetDataDisplay()
        self.actions = MainUiActions(self.windowName)
        
        self.mainMenu = MainMenu()
        self.mainMenu.create();
        
        
        

        # putting tabs in a from targetUiLayout is needed to workaround maya2011 
        # bug with an additional empty tab appearing otherwise
        
        
        self.splitPosition = PersistentValueModel(name="ngSkinTools_mainWindow_splitPosition", defaultValue=50)
        def updateSplitPosition(*args):
            size = cmds.paneLayout(horizontalSplit,q=True,paneSize=True)
            # returns (widht, height, width, height)
            self.splitPosition.set(int(size[1]))
        horizontalSplit = cmds.paneLayout(configuration="horizontal2",width=100,height=200,separatorMovedCommand=updateSplitPosition)
        cmds.paneLayout(horizontalSplit,e=True,staticHeightPane=2)
        cmds.paneLayout(horizontalSplit,e=True,paneSize=(1,100,self.splitPosition.get()))
        cmds.paneLayout(horizontalSplit,e=True,paneSize=(2,100,100-self.splitPosition.get()))
        
        
        
        targetUiLayout = self.targetUI.create(horizontalSplit)
        self.mainTabLayout = cmds.tabLayout(childResizable=True,parent=horizontalSplit,scrollable=False,innerMarginWidth=3)        
        
        
        
        self.tabPaint = self.addTab(TabPaint())
        self.tabMirror = self.addTab(TabMirror())
        self.tabRelax = self.addTab(TabSkinRelax())
        self.tabAssignWeights = self.addTab(TabAssignWeights())
        self.tabSettings = self.addTab(TabSettings())
        
        self.actions.updateEnabledAll()
        
        
        
    def addTab(self,tab):
        '''
        adds tab object to tab UI, creating it's ui and attaching to main window
        '''
        cmds.setParent(self.mainTabLayout)
        layout = tab.createUI(self.mainTabLayout)
        cmds.tabLayout( self.mainTabLayout, edit=True, tabLabel=((layout, tab.getTitle())));
        tab.parentWindow = self
        self.tabs.append(tab)
        
        return tab
        

        
    def findTab(self,tabClass):
        for i in self.tabs:
            if isinstance(i,tabClass):
                return i
            
        return None