Module mayaBackEnd
[hide private]
[frames] | no frames]

Source Code for Module mayaBackEnd

 1  ''' 
 2  A class that provides a dynamic allocation model for Maya 
 3  ''' 
 4  #====================================== 
 5  #  $Revision: #1 $ 
 6  #  $Change: 13599 $ 
 7  #====================================== 
 8   
 9  import sys 
10  import qb.backend.pythonChildBackEnd 
11   
12   
13 -class MayaBackEnd(qb.backend.pythonChildBackEnd.PythonChildBackEnd):
14 """ 15 A backend for a jobtype that runs an instance of Nuke in a child process. 16 17 This will allow for the Maya session to persist for the duration of the subjob. 18 """ 19
20 - def getSubprocessArgs(self, port):
21 """ 22 Get the arguments to start the child python process. 23 24 @param port: The port number for the CmdDispatchers socket server 25 @type port: C{int} 26 27 @return: Return a tuple of a list of args to start the python interpreter, 28 and a list of python commands to initialize the python working environment. 29 30 @rtype: C{tuple} C{([childArgs], [pyInitCmds])} 31 """ 32 33 args = [] 34 if sys.platform != 'win32': 35 args.extend(['/bin/tcsh', '-c']) 36 37 mayaArgs = self.job['package'].get('mayaArgs', '') 38 if not mayaArgs: 39 mayaArgs = '' 40 41 pyCmdLine = '%s -u %s "%s" --port %s --kind %s' % (self.pyExecutable, mayaArgs, self.childBootstrapper, port, self.job['kind']) 42 43 args.append(pyCmdLine) 44 45 pyInitCmds = [ 46 'import maya.standalone', 47 'maya.standalone.initialize(name="python")', 48 'import maya.cmds as mc', 49 'import maya.mel as mm' 50 ] 51 52 return args, pyInitCmds
53