• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.Utils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中ngSkinTools.utils.Utils的典型用法代码示例。如果您正苦于以下问题:Python Utils类的具体用法?Python Utils怎么用?Python Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Utils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: open

    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
开发者ID:leandropim,项目名称:Tapp,代码行数:30,代码来源:mainwindow.py


示例2: parseSelectionList

 def parseSelectionList(self,selectionList):
     '''
     calculates compacted internal selection list from the MSelectionList
     '''
     selection = []
     if selectionList is None or selectionList.isEmpty():
         return selection
     
     #compact selection list first
     mergedList = om.MSelectionList()
     mergedList.merge(selectionList,om.MSelectionList.kMergeNormal)
                              
     for i in Utils.mIter(om.MItSelectionList(mergedList)):
         # read selection item
         path = om.MDagPath()
         compSelection = om.MObject()
         i.getDagPath(path,compSelection)
         if not i.hasComponents() or not compSelection.hasFn(self.componentType):
             continue
         
         # create selection entry and fill it with components
         selEntry = MeshSelectEntry(path)
         for c in Utils.mIter(om.MItMeshVertex(path,compSelection)):
             selEntry.components.append(c.index())
         selection.append(selEntry)
     return selection
开发者ID:BigMacchia,项目名称:ngSkinTools,代码行数:26,代码来源:meshselectrow.py


示例3: closeNextDialogWithResult

def closeNextDialogWithResult(result):
    '''
    close next modal dialog with given result
    '''
    if Utils.getMayaVersion()>=Utils.MAYA2011:
        mUtils.executeDeferred(lambda:BaseDialog.currentDialog.closeDialogWithResult(result))
    else:
        Utils.displayError("hurray for maya 2009, close dialog manually with result "+result)
开发者ID:BigMacchia,项目名称:ngSkinTools,代码行数:8,代码来源:testUtils.py


示例4: selectPaintWeightsInfluence

    def selectPaintWeightsInfluence(self,infl):
        '''
        tries to select influence (provided as string) in current maya's paint weights context and UI
        if skin paint context is not available, nothing happens
        '''
        if not Utils.isCurrentlyPaintingWeights():
            return
        
        # influence name can come in any form ('joint3', 'joint2|joint3', 'joint1|joint2|joint3')
        # get the absolute shortest possible (but still unique) and longest
        try:
            longName = cmds.ls(infl,l=True)[0]
            shortName = cmds.ls(longName,l=False)[0]

            log.info("selecting in paint weights: influence %s" % str(infl))
        
            # try to work around with the mess in the earlier versions of 
            # maya's paint weights UI:
            if Utils.getMayaVersion()<Utils.MAYA2011:
                itemName = Utils.mel('artAttrSkinShortName("%s")'%shortName)
                Utils.mel('artSkinSelectInfluence("artAttrSkinPaintCtx","%s","%s");' % (shortName,itemName));
            else:
                Utils.mel('artSkinSelectInfluence("artAttrSkinPaintCtx","%s");' % shortName);
                
            # show paint weights interface
            cmds.toolPropertyWindow()
        except:
            # problems listing given influence.. just die here
            Utils.displayError('problem selecting influence %s' % infl)
开发者ID:seokkwan,项目名称:Tapp,代码行数:29,代码来源:tabInfluenceList.py


示例5: initialize

    def initialize(self):
        log.debug("creating headless data host")
        
        LayerDataModel.reset()
        restartEvents()

        Utils.loadPlugin()

        MayaEvents.registerScriptJobs()
        
        LayerDataModel.getInstance()
开发者ID:leandropim,项目名称:Tapp,代码行数:11,代码来源:headlessDataHost.py


示例6: closeDialogWithResult

 def closeDialogWithResult(self, buttonID):
     if buttonID==self.BUTTON_OK:
         self.controls.name.setValue(self.controls.name.getValue().strip())
         
         
         # check if valid layer name was entered
         # new layer mode should allow empty value
         if not self.newLayerMode and self.layerNameValue.get().strip()=='':
             Utils.confirmDialog( title='Validation Error', message="layer name cannot be blank", button=['Ok'], defaultButton='Ok')
             return
     
     
     BaseDialog.closeDialogWithResult(self, buttonID)
开发者ID:leandropim,项目名称:Tapp,代码行数:13,代码来源:dlgLayerProperties.py


示例7: execCleanNodes

 def execCleanNodes(self,*args):
     if not LayerUtils.hasCustomNodes():
         Utils.confirmDialog(icon='information', title='Info', message='Scene does not contain any custom ngSkinTools nodes.', button=['Ok']);
         return
     
     message = 'This command deletes all custom nodes from ngSkinTools plugin. Skin weights will be preserved, but all layer data will be lost. Do you want to continue?'
     if Utils.confirmDialog(
             icon='warning',
             title='Warning', 
             message=message, 
             button=['Yes','No'], defaultButton='No')!='Yes':
         return
     
     LayerDataModel.getInstance().cleanCustomNodes()
开发者ID:BigMacchia,项目名称:ngSkinTools,代码行数:14,代码来源:mainwindow.py


示例8: execute

 def execute(self):
     ldm = LayerDataModel.getInstance()
     for layerId in ldm.layerListsUI.getSelectedLayers():
         if ldm.mll.getLayerIndex(layerId)==0:
             Utils.displayError("Cannot merge lowest layer")
             return
         
         ldm.mll.layerMergeDown(layerId)
         
         
     
         
     LayerEvents.layerListModified.emit()
     self.onExecuted.emit()
开发者ID:leandropim,项目名称:Tapp,代码行数:14,代码来源:actions.py


示例9: initialize

    def initialize(self):
        log.debug("creating headless data host")
        self.scriptJobs = []

        LayerDataModel.reset()
        restartEvents()

        Utils.loadPlugin()

        self.registerScriptJob("SelectionChanged", MayaEvents.nodeSelectionChanged.emit)
        self.registerScriptJob("Undo", MayaEvents.undoRedoExecuted.emit)
        self.registerScriptJob("Redo", MayaEvents.undoRedoExecuted.emit)
        self.registerScriptJob("ToolChanged", MayaEvents.toolChanged.emit)

        LayerDataModel.getInstance()
开发者ID:jonntd,项目名称:ngSkinTools,代码行数:15,代码来源:headlessDataHost.py


示例10: update

 def update(self):
     if self.data.layerDataAvailable:
         return
     
     attachPoint = self.data.getLayersCandidateFromSelection()
     
     attachPossible = len(attachPoint)!=0
     selection = cmds.ls(sl=True,o=True)
     selectionAvailable = selection is not None and len(selection)>0
     
     if attachPossible:
         self.controls.label1.setLabel('Skin selected:')
         self.controls.label2.setLabel("%s (%s)" % tuple(map(Utils.shortName,tuple(attachPoint))))
     elif selectionAvailable:
         self.controls.label1.setLabel("Layer data cannot be attached to:")
         self.controls.label2.setLabel(Utils.shortName(selection[0]))
     else:
         self.controls.label1.setLabel("Nothing is selected")
         self.controls.label2.setLabel('')
     
     self.controls.label1.setEnabled(selectionAvailable)
     self.controls.label2.setEnabled(selectionAvailable)
     
     cmds.button(self.controls.addLayerDataButton,e=True,enable=attachPossible)
     
开发者ID:BigMacchia,项目名称:ngSkinTools,代码行数:24,代码来源:noLayersUI.py


示例11: getLogicalInfluenceIndex

 def getLogicalInfluenceIndex(self,influenceName):
     try:
         path = Utils.getDagPathForNode(influenceName)
     except:
         raise MessageException("Could not find influence '%s' in %s" % (influenceName, self.skinCluster))
         
     return self.fn.indexForInfluenceObject(path)
开发者ID:BigMacchia,项目名称:ngSkinTools,代码行数:7,代码来源:skinClusterFn.py


示例12: open

    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
开发者ID:BigMacchia,项目名称:ngSkinTools,代码行数:16,代码来源:mainwindow.py


示例13: useSkinClusterInputMesh

 def useSkinClusterInputMesh(self,skinCluster):
     '''
     sets skincluster's input mesh as source mesh
     '''
     skinClusterObject = Utils.getMObjectForNode(skinCluster)
     geomFilter = oma.MFnGeometryFilter(skinClusterObject)
     self.meshMObject = geomFilter.inputShapeAtIndex(0)
开发者ID:leandropim,项目名称:Tapp,代码行数:7,代码来源:meshDataExporter.py


示例14: getSelectionDagPaths

    def getSelectionDagPaths(hilite):
        """
        similar functionality to cmds.ls, but returns transform nodes where shapes might be selected,
        and does not return components.
        """

        from maya import OpenMaya as om

        selection = om.MSelectionList()
        if hilite:
            om.MGlobal.getHiliteList(selection)
        else:
            om.MGlobal.getActiveSelectionList(selection)

        result = []
        for i in Utils.mIter(om.MItSelectionList(selection)):
            path = om.MDagPath()
            i.getDagPath(path)

            selectionPath = path.fullPathName()

            # if it's a shape node, extend upwards
            if path.node().hasFn(om.MFn.kShape):
                parentPath = om.MDagPath()
                om.MFnDagNode(om.MFnDagNode(path).parent(0)).getPath(parentPath)
                selectionPath = parentPath.fullPathName()

            if not selectionPath in result:
                result.append(selectionPath)

        return result
开发者ID:jonntd,项目名称:ngSkinTools,代码行数:31,代码来源:SelectHelper.py


示例15: getFormats

 def getFormats():
     '''
     returns iterator to available exporters
     '''
     yield Formats.getXmlFormat()
     if Utils.getMayaVersion() > Utils.MAYA2010:
         yield Formats.getJsonFormat()
开发者ID:IsaacPeral,项目名称:ngSkinTools,代码行数:7,代码来源:importExport.py


示例16: execRelax

    def execRelax(self,*args):
        '''
            relax button click handler. this is where it actually 
            executes skin relax, whoop-tee-doo.
        '''
        try:

            args = {}
            args['numSteps']=self.controls.numSteps.getValue()
            args['stepSize']=self.controls.stepSize.getValue()
            
            # do we need soft selection?
            self.controls.softSelection.addToArgs(args)
            
                
            # do we need volume association?
            if self.controls.useVolumeAssociation.getValue():
                args['abv']=1
                args['avr']=self.controls.volumeAssociationRadius.getValue()

            # add selection+highlight as arguments
            # we need highlight as second argument because
            # other meshes for simulation might be included only through highlight.
            #
            # This will never be an empty list as we tested for vertex selection available earlier
            def makeList(listOrNull):
                if listOrNull is None:
                    return []
                return listOrNull
            
            objects = makeList(cmds.ls(sl=True))+makeList(cmds.ls(hl=True))
            
            if len(objects)==0:
                raise MessageException("Nothing is selected")
            
            # execute stuff  
            try:
                cmds.waitCursor(state=True)
                cmds.ngSkinRelax(objects,**args)
            finally:
                cmds.waitCursor(state=False)
                
            Utils.refreshPaintWeightsTool()
            
        except MessageException,err:
            raise err
开发者ID:leandropim,项目名称:Tapp,代码行数:46,代码来源:tabSkinRelax.py


示例17: doInflListPaintWeights

 def doInflListPaintWeights(self,*args):
     '''
     opens paint weights tool and paints on locally selected influence  
     '''
     if not Utils.isCurrentlyPaintingWeights():
         cmds.ArtPaintSkinWeightsTool()
         
     self.doInfluenceListItemSelected()
开发者ID:seokkwan,项目名称:Tapp,代码行数:8,代码来源:tabInfluenceList.py


示例18: doStartPaint

    def doStartPaint(self):
        if not cmds.artUserPaintCtx(self.TOOL_PAINT,exists=True):
            cmds.artUserPaintCtx(self.TOOL_PAINT);

        cmds.artUserPaintCtx(self.TOOL_PAINT,e=True,
            tsc=Utils.createMelProcedure(self.paintCtxSetupProcedure, [('string','toolContext')]),
            toolCleanupCmd=Utils.createMelProcedure(self.paintCtxCleanupProcedure, [('string','toolContext')]),
            initializeCmd="ngLayerPaintCtxInitialize",
            finalizeCmd="ngLayerPaintCtxFinalize",
            setValueCommand="ngLayerPaintCtxSetValue", 
            getValueCommand="ngLayerPaintCtxGetValue",
            whichTool="userPaint",
            fullpaths = True
            )
        self.configurePaintValues()

        cmds.setToolTo(self.TOOL_PAINT);
开发者ID:leandropim,项目名称:Tapp,代码行数:17,代码来源:tabPaint.py


示例19: createLayerListsUI

    def createLayerListsUI(self,parent):
        cmds.setParent(parent)
        #self.outerFrame = cmds.frameLayout(label='Skinning Layers',collapsable=False,borderVisible=True,borderStyle="etchedIn",labelAlign="center")

        if Utils.getMayaVersion()<Utils.MAYA2011:
            # pane layout is ugly if it's non-QT UI; just use simple 50:50 form layout
            paneLayout = FormLayout(numberOfDivisions=100)
        else:
            paneLayout = cmds.paneLayout(configuration="vertical2",width=100,height=200)
            
        

        leftForm = form = FormLayout()
        label = cmds.text("Layers:",align="left",font='boldLabelFont')
        list = self.controls.layerDisplay = LayersTreeView()
        list.onSelectionChanged.addHandler(self.layerSelectionChanged)
        
        form.attachForm(label,10,0,None,Constants.MARGIN_SPACING_HORIZONTAL)
        form.attachForm(list.control,None,0,0,Constants.MARGIN_SPACING_HORIZONTAL)
        form.attachControl(list.control,label,3,None,None,None)
        
        cmds.setParent("..")
        rightForm = form = FormLayout()
        label = cmds.text("Influences:",align="left",font='boldLabelFont')
        

        list = self.controls.influenceDisplay = TreeViewIDList(allowMultiSelection=True)
        list.onSelectionChanged.addHandler(self.execInfluenceSelected)
        
        self.createLayersListRMBMenu()
        self.createInfluenceListRMBMenu()

        form.attachForm(label,10,Constants.MARGIN_SPACING_HORIZONTAL,None,0)
        form.attachForm(list.control,None,Constants.MARGIN_SPACING_HORIZONTAL,0,0)
        form.attachControl(list.control,label,3,None,None,None)

        

        if Utils.getMayaVersion()<Utils.MAYA2011:
            paneLayout.attachForm(leftForm, 0, None, 0, 0)
            paneLayout.attachForm(rightForm, 0, 0, 0, None)
            cmds.formLayout(paneLayout,e=True,attachPosition=[[leftForm,'right',3,50],[rightForm,'left',3,50]])
            
        return paneLayout
开发者ID:BigMacchia,项目名称:ngSkinTools,代码行数:44,代码来源:layerListsUI.py


示例20: __init__

 def __init__(self,allowMultiSelection=True):
     self.items = []
     selectCommand = self.selectionChanged
     editCommand = self.editLabelCommand
     
     if Utils.getMayaVersion()<Utils.MAYA2012:
         selectCommand = Utils.createMelProcedure(self.selectionChanged, [('int','item'),('int','state')],returnType="int")
         editCommand = Utils.createMelProcedure(self.editLabelCommand, [('string','item'),('string','newName')])
         
     self.control = cmds.treeView(numberOfButtons=0, height=100, selectCommand=selectCommand, editLabelCommand=editCommand,dragAndDropCommand=self.handleDragDropCommand)
     
     cmds.treeView(self.control,e=True,enableKeys=True)
     
     # list of selected IDs
     self.selectedItems = []
     self.onSelectionChanged = Signal()
     
     self.__selectionChanging = False
     self.__itemNameChanging = False
开发者ID:leandropim,项目名称:Tapp,代码行数:19,代码来源:layerListsUI.py



注:本文中的ngSkinTools.utils.Utils类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pwallet.PersistentWallet类代码示例发布时间:2022-05-27
下一篇:
Python layerDataModel.LayerDataModel类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap