Python maya.cmds.error() Examples

The following are 10 code examples of maya.cmds.error(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module maya.cmds , or try the search function .
Example #1
Source File: uExport.py    From uExport with zlib License 6 votes vote down vote up
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) 
Example #2
Source File: assetImporter4.py    From tutorials with MIT License 6 votes vote down vote up
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) 
Example #3
Source File: assetImporter4.py    From tutorials with MIT License 6 votes vote down vote up
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)) 
Example #4
Source File: assetImporter2.py    From tutorials with MIT License 6 votes vote down vote up
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) 
Example #5
Source File: assetImporter2.py    From tutorials with MIT License 6 votes vote down vote up
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)) 
Example #6
Source File: assetImporter3.py    From tutorials with MIT License 6 votes vote down vote up
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) 
Example #7
Source File: shakeNodeCmd.py    From tutorials with MIT License 6 votes vote down vote up
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 
Example #8
Source File: pyMyPlugin.py    From MayaDev with MIT License 5 votes vote down vote up
def doIt(self, args):
        print('starting %s'%kPluginCmdName)
        try:
            import MyWindow
            reload(MyWindow)
            MyWindow.main()
        except Exception as ex:
            cmds.error(ex.message()) 
Example #9
Source File: MyWindow.py    From MayaDev with MIT License 5 votes vote down vote up
def btnCallCppPlugin_clicked(self):
        print('btnCallCppPlugin_clicked')
        try:
            cmds.loadPlugin('HelloMaya')
            cmds.myCmd1()
            cmds.hello()
        except Exception as ex:
            cmds.error(ex.message) 
Example #10
Source File: MyWindow.py    From MayaDev with MIT License 5 votes vote down vote up
def btnCallCSPlugin_clicked(self):
        print('btnCallCSPlugin_clicked')
        try:
            cmds.loadPlugin('HiMaya2017')
            cmds.csHi()
        except Exception as ex:
            cmds.error(ex.message)