當前位置: 首頁>>代碼示例>>Python>>正文


Python cmds.error方法代碼示例

本文整理匯總了Python中maya.cmds.error方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.error方法的具體用法?Python cmds.error怎麽用?Python cmds.error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maya.cmds的用法示例。


在下文中一共展示了cmds.error方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: connectRenderMeshes

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import error [as 別名]
def connectRenderMeshes(self, renderMeshes, LOD=0):
        try:
            cmds.undoInfo(openChunk=True)
            lodAttr = None
            if LOD >=0 or LOD <=4:
                lodAttr = self.node + '.rendermeshes_LOD' + str(LOD)
                conns = cmds.listConnections(lodAttr, plugs=1, destination=1)
                if conns:
                    for conn in cmds.listConnections(lodAttr, plugs=1, destination=1):
                        cmds.disconnectAttr(lodAttr, conn)
            if lodAttr:
                for mesh in renderMeshes:
                    msgConnect(lodAttr, mesh + '.uExport')
            else:
                cmds.error('connectRenderMeshes>>> please specify a LOD integer (0-4) for your meshes')

        except Exception as e:
            print e
        finally:
            cmds.undoInfo(closeChunk=True) 
開發者ID:chrisevans3d,項目名稱:uExport,代碼行數:22,代碼來源:uExport.py

示例2: setAssetRoot

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import error [as 別名]
def setAssetRoot(self, root):
        """
        setAssetRoot(string root) 
        
            Set the root level directory for the Asset manager.
            Show directories will live under this root, and
            Assets will live under shows.
            Creates the directory if it does not exist.
        """
        
        if not os.path.exists(root):
            
            try: 
                os.mkdir(root)
            
            except OSError, e:
                cmds.error("Could not create asset root directory. %s" % e) 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:19,代碼來源:assetImporter4.py

示例3: _getShowDir

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import error [as 別名]
def _getShowDir(self, show=''):
        """
        _getShowDir(string show='')  ->  string path
        
            Get the full path to a show directory, and create it if it 
            doesn't exist. If no show name is given, return the 
            current set show
        """
        
        if show:
            d = os.path.join(self._rootDir, show)
        else:
            d = self.showDir
        
        if not os.path.exists(d):
           
            try:
                os.mkdir(d)
                
            except OSError, e:
                cmds.error("Failed to create show directory '%s'. %s" % (d, e)) 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:23,代碼來源:assetImporter4.py

示例4: setAssetRoot

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import error [as 別名]
def setAssetRoot(self, root):
        """
        setAssetRoot(string root) 
        
            Set the root level directory for the Asset manager.
            Show directories will live under this root, and
            Assets will live under shows.
            Creates the directory if it does not exist.
        """
        
        if not os.path.exists(root):
            
            try: 
                os.makedirs(root)
            
            except OSError, e:
                cmds.error("Could not create asset root directory. %s" % e) 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:19,代碼來源:assetImporter2.py

示例5: createShakeNode

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import error [as 別名]
def createShakeNode(transform=None):
	"""
	createShakeNode (string transform=None) -> string node

		A helper command for creating a new shakeNode
		Optionally, a transform node path may be given
		to automatically connect the shakeNode output
		into the transform input.
	"""
	
	if not cmds.pluginInfo("shakeNode", query=True, loaded=True):
		cmds.error("shakeNode plugin is not loaded!")
	
	shake = cmds.createNode("shakeNode")
	cmds.connectAttr("time1.outTime", "%s.time" % shake)

	if transform:

		if not cmds.objExists(transform):
			cmds.error("transform does not exist: %s" % transform)

		cmds.connectAttr("%s.output" % shake, "%s.translate" % transform, f=True)

	return shake 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:26,代碼來源:shakeNodeCmd.py

示例6: doIt

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import error [as 別名]
def doIt(self, args):
        print('starting %s'%kPluginCmdName)
        try:
            import MyWindow
            reload(MyWindow)
            MyWindow.main()
        except Exception as ex:
            cmds.error(ex.message()) 
開發者ID:WendyAndAndy,項目名稱:MayaDev,代碼行數:10,代碼來源:pyMyPlugin.py

示例7: btnCallCppPlugin_clicked

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import error [as 別名]
def btnCallCppPlugin_clicked(self):
        print('btnCallCppPlugin_clicked')
        try:
            cmds.loadPlugin('HelloMaya')
            cmds.myCmd1()
            cmds.hello()
        except Exception as ex:
            cmds.error(ex.message) 
開發者ID:WendyAndAndy,項目名稱:MayaDev,代碼行數:10,代碼來源:MyWindow.py

示例8: btnCallCSPlugin_clicked

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import error [as 別名]
def btnCallCSPlugin_clicked(self):
        print('btnCallCSPlugin_clicked')
        try:
            cmds.loadPlugin('HiMaya2017')
            cmds.csHi()
        except Exception as ex:
            cmds.error(ex.message) 
開發者ID:WendyAndAndy,項目名稱:MayaDev,代碼行數:9,代碼來源:MyWindow.py


注:本文中的maya.cmds.error方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。