コード例 #1
0
def openMainWindow():
    '''
    opens main window. shelf setup with reload:

    .. code-block:: python

        from ngSkinTools.debug import reloader
        reload(reloader)
        reloader.unload()
        from ngSkinToolsTest import debugToolbarButtons
        debugToolbarButtons.openMainWindow()
    
    '''
    from ngSkinTools import log
    log.LoggerFactory = log.SimpleLoggerFactory()
    
    from ngSkinTools.context import applicationContext
    from ngSkinToolsTest.debugApplicationSetup import DebugApplicationSetup
    applicationContext.setup = DebugApplicationSetup()
    
    
    from ngSkinTools.utils import Utils
    Utils.DEBUG_MODE = True
    from ngSkinTools.ui.mainwindow import MainWindow
    MainWindow.open()
コード例 #2
0
def ng_skin_tools():
    """
    Opens ngSkinTools tool if available
    First, we try to open ngSkinTools2 and if it is not available, we launch ngSkinTools1
    :return: bool
    """

    plugin_names = ['ngSkinTools2.mll', 'ngSkinTools.mll']
    for plugin_name in plugin_names:
        if not dcc.is_plugin_loaded(plugin_name):
            dcc.load_plugin(plugin_name, quiet=True)
        if dcc.is_plugin_loaded(plugin_name):
            if plugin_name == 'ngSkinTools2.mll':
                try:
                    import ngSkinTools2
                    ngSkinTools2.open_ui()
                    return True
                except Exception as exc:
                    LOGGER.warning(
                        'Impossible to launch ngSkinTool2. Trying to launch ngSkinTools1: "{}"'
                        .format(exc))
                    continue
            else:
                try:
                    from ngSkinTools.ui.mainwindow import MainWindow
                    MainWindow.open()
                    return True
                except Exception as exc:
                    'Impossible to launch ngSkinTool1: "{}"'.format(exc)
                    continue

    return False
コード例 #3
0
def ngskin():
    try:
        from ngSkinTools.ui.mainwindow import MainWindow
        MainWindow.open()
    except Exception, err:
        webbrowser.open("http://www.ngskintools.com/")
        raise ValueError, "Failed to load. Go get it. | {0}".format(err)
コード例 #4
0
ファイル: place.py プロジェクト: guileschool/ls-rigging-tools
def place():
    '''
    '''
    mel.cgmToolbox()
    MainWindow.open()
    placerMappings = data.placerMappings
    indMappings = data.independentMappings
    baseFilePath = data.baseFilePath
    meshNames = {'face':'CT_face_geo',
                 'leftEye':'LT_eyeball_geo',
                 'rightEye':'RT_eyeball_geo'}
    win = fui.newUI(baseFilePath, placerMappings, indMappings, meshNames)
コード例 #5
0
ファイル: layerListsUI.py プロジェクト: jonntd/Tapp
    def createInfluenceListRMBMenu(self):
        from ngSkinTools.ui.mainwindow import MainWindow
        actions = MainWindow.getInstance().actions

        self.controls.inflListMenu = cmds.popupMenu(
            parent=self.controls.influenceDisplay.control)
        actions.copyWeights.newMenuItem('Copy Influence Weights')
        actions.cutWeights.newMenuItem('Cut Influence Weights')
        actions.pasteWeightsAdd.newMenuItem('Paste Weights (Add)')
        actions.pasteWeightsReplace.newMenuItem('Paste Weights (Replace)')
        cmds.menuItem(divider=True)

        cmds.radioMenuItemCollection()
        self.controls.menuAllInfluences = cmds.menuItem(
            label='List All Influences',
            enable=True,
            radioButton=True,
            command=self.influenceMenuChangeCommand)
        self.controls.menuActiveInfluences = cmds.menuItem(
            label='List Only Active Influences',
            enable=True,
            radioButton=False,
            command=self.influenceMenuChangeCommand)

        cmds.menuItem(divider=True)

        actions.convertMaskToTransparency.newMenuItem(
            'Convert Mask to Transparency')
        actions.convertTransparencyToMask.newMenuItem(
            'Convert Transparency to Mask')

        cmds.menuItem(divider=True)

        actions.influenceFilter.newMenuItem('Show/Hide Influence Filter')
コード例 #6
0
    def createUI(self, parent):
        from ngSkinTools.ui.mainwindow import MainWindow

        mainActions = MainWindow.getInstance().actions
        self.setTitle('Mirror')

        # base layout
        self.cmdLayout = self.createCommandLayout(
            [('Mirror Weights', mainActions.mirrorWeights, '')],
            SkinToolsDocs.UI_TAB_MIRROR)

        self.mirroringOptions = VertexMirroringOptions()
        self.mirroringOptions.createUI(self.cmdLayout.innerLayout)

        #configurationGroup = self.createUIGroup(self.cmdLayout.innerLayout, 'Configuration',defaultCollapsed=True)
        self.vertexMappingConfiguration = VertexMappingConfiguration()
        self.vertexMappingConfiguration.createUI(
            parent=self.cmdLayout.innerLayout)
        self.influenceMappingConfiguration = InfluencesMappingConfiguration()
        self.influenceMappingConfiguration.createUI(
            parent=self.cmdLayout.innerLayout)

        def update():
            cmds.layout(self.cmdLayout.outerLayout.layout,
                        e=True,
                        enable=selectionState.getLayersAvailable())

        selectionState.selectionInfo.changed.addHandler(update, parent)

        update()

        return self.cmdLayout.outerLayout.layout
コード例 #7
0
 def testAddManualInfluence(self):
     openMayaFile('simplemirror.ma')
     cmds.select("testMeshY")
     mll = MllInterface()
     mll.initLayers()
     mll.setCurrentLayer(mll.createLayer("test layer"))
     
     
     window = MainWindow.open()
     mirrorTab = window.findTab(TabMirror)
     
     initWindow = mirrorTab.execInitMirror()
     
     def selectPairAndClickOk(dialog):
         log.info("running inside modal dialog "+str(dialog))
         dialog.sourceDropdown.setValue(2)
         dialog.destinationDropdown.setValue(3)
         dialog.chkSelfReference.setValue(False)
         #dialog.closeDialogWithResult(BaseDialog.BUTTON_OK)
         closeNextDialogWithResult(BaseDialog.BUTTON_OK)
         
     log.info("modal dialog setup")
     runInNextModalDialog(selectPairAndClickOk)
     log.info("modal dialog setup ended")
         
     initWindow.content.addPairAction.execute()
     
     self.assertEquals(str(initWindow.content.items[0]),"[M] L_joint2 <-> L_joint3", "manual pair addition failed")
コード例 #8
0
ファイル: actions.py プロジェクト: lazerdaze/lancer
 def execute(self):
     '''
     button handler for "Mirror Skin Weights"
     '''
     from ngSkinTools.ui.mainwindow import MainWindow
     mirrorTab = MainWindow.getInstance().tabMirror
     mirrorTab.executeMirror()
コード例 #9
0
    def createInfluenceListRMBMenu(self):
        from ngSkinTools.ui.mainwindow import MainWindow
        actions = MainWindow.getInstance().actions
        
        self.controls.inflListMenu = cmds.popupMenu( parent=self.controls.influenceDisplay.control )
        actions.copyWeights.newMenuItem('Copy Influence Weights')
        actions.cutWeights.newMenuItem('Cut Influence Weights')
        actions.pasteWeightsAdd.newMenuItem('Paste Weights (Add)')
        actions.pasteWeightsReplace.newMenuItem('Paste Weights (Replace)')
        cmds.menuItem( divider=True)
        
        
        cmds.radioMenuItemCollection()
        self.controls.menuAllInfluences = cmds.menuItem(label='List All Influences',
                enable=True, radioButton=True,command=self.influenceMenuChangeCommand )
        self.controls.menuActiveInfluences = cmds.menuItem(label='List Only Active Influences',
                enable=True, 
                radioButton=False,command=self.influenceMenuChangeCommand )
        
        cmds.menuItem( divider=True)
        
        actions.convertMaskToTransparency.newMenuItem('Convert Mask to Transparency')
        actions.convertTransparencyToMask.newMenuItem('Convert Transparency to Mask')

        cmds.menuItem( divider=True)
        
        actions.influenceFilter.newMenuItem('Show/Hide Influence Filter')
コード例 #10
0
ファイル: actions.py プロジェクト: xtoof/Tapp
    def execute(self):
        '''
        button handler for "Mirror Skin Weights"
        '''
        from ngSkinTools.ui.mainwindow import MainWindow
        from ngSkinTools.ui.tabMirror import TabMirror

        # any problems? maybe cache is not initialized/outdated?
        layerData = LayerDataModel.getInstance()
        layerData.updateMirrorCacheStatus()
        if not layerData.mirrorCache.isValid:
            Utils.displayError(layerData.mirrorCache.message)
            return False

        try:
            mirrorTab = MainWindow.getInstance().tabMirror

            mirrorDirection = MirrorDirection.DIRECTION_POSITIVETONEGATIVE
            if mirrorTab.controls.mirrorDirection.getValue() == 0:  # guess
                mirrorDirection = MirrorDirection.DIRECTION_GUESS
            if mirrorTab.controls.mirrorDirection.getValue(
            ) == 2:  # negative to positive
                mirrorDirection = MirrorDirection.DIRECTION_NEGATIVETOPOSITIVE
            if mirrorTab.controls.mirrorDirection.getSelectedText(
            ) == TabMirror.MIRROR_FLIP:
                mirrorDirection = MirrorDirection.DIRECTION_FLIP

            with LayerDataModel.getInstance().mll.batchUpdateContext():
                for layerId in LayerDataModel.getInstance(
                ).layerListsUI.getSelectedLayers():
                    LayerDataModel.getInstance().mll.mirrorLayerWeights(
                        layerId,
                        mirrorWidth=mirrorTab.controls.mirrorWidth.getValue(),
                        mirrorLayerWeights=mirrorTab.controls.mirrorWeights.
                        getValue(),
                        mirrorLayerMask=mirrorTab.controls.mirrorMask.getValue(
                        ),
                        mirrorDualQuaternion=mirrorTab.controls.mirrorDq.
                        getValue(),
                        mirrorDirection=mirrorDirection)

            # if layer list is filtered, might be handy to refresh influence list now - not that it costs much
            LayerEvents.influenceListChanged.emit()

            return True
        except:
            import traceback
            traceback.print_exc()
            Utils.displayError("unknown error")
            # we're not sure what's wrong in this case, just re-raise
            raise
コード例 #11
0
 def createLayersListRMBMenu(self):
     from ngSkinTools.ui.mainwindow import MainWindow
     self.controls.layerListMenu = cmds.popupMenu( parent=self.controls.layerDisplay.control )
     
     actions = MainWindow.getInstance().actions
     actions.newLayer.newMenuItem("New Layer...")
     actions.duplicateLayer.newMenuItem("Duplicate Selected Layer(s)")
     actions.deleteLayer.newMenuItem("Delete Selected Layer(s)")
     cmds.menuItem( divider=True)
     actions.moveLayerUp.newMenuItem("Move Current Layer Up")
     actions.moveLayerDown.newMenuItem("Move Current Layer Down")
     actions.enableDisableLayer.newMenuItem("Toggle Layer On/Off")
     cmds.menuItem( divider=True)
     actions.layerProperties.newMenuItem("Properties...")
コード例 #12
0
def openMainWindow():
    '''
    opens main window. shelf setup with reload:

    .. code-block:: python

        from ngSkinTools.debug import reloader
        reload(reloader)
        reloader.unload()
        from ngSkinToolsTest import debugToolbarButtons
        debugToolbarButtons.openMainWindow()
    
    '''
    from ngSkinTools import log
    log.LoggerFactory = log.SimpleLoggerFactory()

    from ngSkinTools.context import applicationContext
    from ngSkinToolsTest.debugApplicationSetup import DebugApplicationSetup
    applicationContext.setup = DebugApplicationSetup()

    from ngSkinTools.utils import Utils
    Utils.DEBUG_MODE = True
    from ngSkinTools.ui.mainwindow import MainWindow
    MainWindow.open()
コード例 #13
0
ファイル: layerListsUI.py プロジェクト: jonntd/Tapp
    def createLayersListRMBMenu(self):
        from ngSkinTools.ui.mainwindow import MainWindow
        self.controls.layerListMenu = cmds.popupMenu(
            parent=self.controls.layerDisplay.control)

        actions = MainWindow.getInstance().actions
        actions.newLayer.newMenuItem("New Layer...")
        actions.duplicateLayer.newMenuItem("Duplicate Selected Layer(s)")
        actions.deleteLayer.newMenuItem("Delete Selected Layer(s)")
        cmds.menuItem(divider=True)
        actions.moveLayerUp.newMenuItem("Move Current Layer Up")
        actions.moveLayerDown.newMenuItem("Move Current Layer Down")
        actions.enableDisableLayer.newMenuItem("Toggle Layer On/Off")
        cmds.menuItem(divider=True)
        actions.layerProperties.newMenuItem("Properties...")
コード例 #14
0
ファイル: actions.py プロジェクト: leandropim/Tapp
    def execute(self):
        '''
        button handler for "Mirror Skin Weights"
        '''
        from ngSkinTools.ui.mainwindow import MainWindow
        from ngSkinTools.ui.tabMirror import TabMirror
        

        # any problems? maybe cache is not initialized/outdated?
        layerData = LayerDataModel.getInstance() 
        layerData.updateMirrorCacheStatus()
        if not layerData.mirrorCache.isValid:
            Utils.displayError(layerData.mirrorCache.message)
            return False

        try:
            mirrorTab = MainWindow.getInstance().tabMirror
            
            mirrorDirection = MirrorDirection.DIRECTION_POSITIVETONEGATIVE
            if mirrorTab.controls.mirrorDirection.getValue()==0: # guess
                mirrorDirection = MirrorDirection.DIRECTION_GUESS;
            if mirrorTab.controls.mirrorDirection.getValue()==2: # negative to positive
                mirrorDirection = MirrorDirection.DIRECTION_NEGATIVETOPOSITIVE;
            if mirrorTab.controls.mirrorDirection.getSelectedText()==TabMirror.MIRROR_FLIP: 
                mirrorDirection = MirrorDirection.DIRECTION_FLIP;
            
            with LayerDataModel.getInstance().mll.batchUpdateContext():
                for layerId in LayerDataModel.getInstance().layerListsUI.getSelectedLayers():
                    LayerDataModel.getInstance().mll.mirrorLayerWeights(layerId,
                            mirrorWidth=mirrorTab.controls.mirrorWidth.getValue(),
                            mirrorLayerWeights=mirrorTab.controls.mirrorWeights.getValue(),
                            mirrorLayerMask=mirrorTab.controls.mirrorMask.getValue(),
                            mirrorDualQuaternion=mirrorTab.controls.mirrorDq.getValue(),
                            mirrorDirection=mirrorDirection
                        )
            
            # if layer list is filtered, might be handy to refresh influence list now - not that it costs much
            LayerEvents.influenceListChanged.emit()
            
            return True
        except:
            import traceback;traceback.print_exc();
            Utils.displayError("unknown error")
            # we're not sure what's wrong in this case, just re-raise
            raise        
コード例 #15
0
    def ngSkinTools_pushButton_released(self):

        from ngSkinTools.ui.mainwindow import MainWindow
        MainWindow.open()
コード例 #16
0
ファイル: tabPaint.py プロジェクト: leandropim/Tapp
 def commandButtons():
     yield ('Mirror',MainWindow.getInstance().actions.mirrorWeights,'')
     yield ('Paint',self.execPaint,'')
コード例 #17
0
 def setUp(self):
     MainWindow.closeAllWindows()
コード例 #18
0
ファイル: actions.py プロジェクト: lazerdaze/lancer
 def execute(self):
     from ngSkinTools.ui.mainwindow import MainWindow
     MainWindow.getInstance().targetUI.layersUI.filterUi.toggle()
     self.onExecuted.emit(True)
コード例 #19
0
 def tearDown(self):
     MainWindow.closeAllWindows()
コード例 #20
0
ファイル: actions.py プロジェクト: leandropim/Tapp
 def execute(self):
     from ngSkinTools.ui.mainwindow import MainWindow
     MainWindow.getInstance().targetUI.layersUI.filterUi.toggle() 
     self.onExecuted.emit(True)
コード例 #21
0
 def commandButtons():
     yield ('Mirror',MainWindow.getInstance().actions.mirrorWeights,'')
     yield ('Paint',self.execPaint,'')
コード例 #22
0
 def testOpenClose(self):
     MainWindow.open()
     MainWindow.closeAllWindows()
コード例 #23
0
 def testOpenWithInvalidOptions(self):
     MainWindow.closeAllWindows()
     cmds.optionVar(stringValue=['ngSkinToolsMirrorTab_mirrorDirection','x'])
     MainWindow.open()
コード例 #24
0
"""
SCRIPT NgSkinTools
AUTHOR: Isaac Buzzola/[email protected]
DATE: Friday 11 December 2020 15:53

SCRIPT FOR ZOMBIE STUDIO
"""

try:
    from maya import cmds

    from ngSkinTools.ui.mainwindow import MainWindow
    MainWindow.open()
except Exception as error:
    print(error)
コード例 #25
0
def ngskin_tool():
    'ngSkinTool 실행'
    from ngSkinTools.ui.mainwindow import MainWindow
    MainWindow.open()
コード例 #26
0
ファイル: gui.py プロジェクト: mkolar/Tapp
    def ngSkinTools_pushButton_released(self):

        from ngSkinTools.ui.mainwindow import MainWindow
        MainWindow.open()
コード例 #27
0
ファイル: copySkinLayers.py プロジェクト: darkuress/arFace
 def copySkinLayers(self, *args):
     '''
     '''
     uv = None
     #=======================================================================
     # get layers that we want to copy
     #=======================================================================
     
     # print 'selLayers: ', self.controls.selLayers.getValue()
     if self.controls.selLayers.getValue():
         # if set to "Selected layers in lister"
         layerLister = MainWindow.getInstance().targetUI.layersUI.getSelectedLayers()
         # print 'LayerLister: ', layerLister
     else:
         # use all layers
         layerLister = []
     
     #===================================================================
     # surface association
     #===================================================================
     if self.controls.radioClosestPoint.getValue():
         surfaceAssociation = 'closestPoint'
     elif self.controls.radioRaycast.getValue():
         surfaceAssociation = 'rayCast'
     elif self.controls.radioClosestComponent.getValue():
         surfaceAssociation = 'closestComponent'
     elif self.controls.radioUVSpace.getValue():
         surfaceAssociation = 'closestPoint'
         uvSets = mc.polyUVSet(q=True, currentUVSet=True)
         if len(uvSets) > 0:
             srcSet = uvSets[0]
             destSet = uvSets[-1]
             uv = srcSet, destSet
     else:
         mc.warning('Unknown surface association')
         
     sampleSpace = self.controls.sampleSpace.getValue()
     
     #=======================================================================
     # influence association
     #=======================================================================
     associationNameMap = {'None': None,
                         'Closest joint': 'closestJoint',
                         'Closest bone': 'closestBone',
                         'One to one': 'oneToOne',
                         'Label': 'label',
                         'Name': 'name'}
     
     influenceAssociation = []
     for index in range(3):
         association = self.controls.__dict__['influenceAssoc%d' % (index+1)].getSelectedText()
         influenceAssociation.append(associationNameMap[association])
     
     normalize = 1 - self.controls.normalization.getValue()
     
     '''
     print surfaceAssociation
     print sampleSpace
     print influenceAssociation
     print layerLister
     print normalize
     '''
     
     sel = mc.ls(os=True)
     if len(sel) == 2:
         srcMeshName, destMeshName = sel[:2]
     else:
         mc.error('Select source mesh, then shift-select destination mesh.')
     
     args = [srcMeshName, destMeshName, layerLister, 
            influenceAssociation, surfaceAssociation, 
            sampleSpace, normalize]
     
     if uv:
         args.append(uv)
     
     copySkinLayers(*args)
     
     mc.select(destMeshName)