#!usr/bin/python ######################################################### # Author: Kenneth Stojevich # # Program: Main executable function that brings in # # and executes any and all scripts to compile # # together our end result of a composited image # # using Maya, Renderman, and Shake. # # Date: 03/11/2006 # ######################################################## # Import modules required import getopt, sys, os, commands # Import the classes required from MayaBatch import MayaBatch from MTOR import MTOR from ShakeComp import ShakeComp maya = "" mtor = "" shake = "" ######################################################### # Help function to give the user basic help on proper # # use of the program. # ######################################################### def helpMe(): print "Command options: [-h] [-m] [-r] [-s]" print " [--help] [--maya] [--renderman] [--shake]" print "" print "USAGE: [-h] [--help] You are reading it right now" print " [-m] [--maya] Use Maya's to edit a scene using MEL commands" print " [-r] [--renderman] Use Renderman to render the Maya scene out" print " [-s] [--shake] Use Shake to composite two images together" print "" print "All commands require additional arguments see example for full use" print "" print "Example of use: " print 'Maya Scene: python Main.py -m -m \'-command \"setAttr \"lampShape.dropoff\" 350; file -f -save;\"\' -f 1 -l 5 -b 0.5 -i /home/student/Ken/images light2.mb' print "" print 'Render Scene with Maya: python Main.py -m -m \'-command \"setAttr \"lampShape.dropoff\" 350; file -f -save;\"\' -f 1 -l 5 -b 0.5 -i /home/student/Ken/images light2.mb' print "" print 'Renderman RIB Gen: python Main.py -r -f 1 -l 5 -i /home/student/Ken/images light2.mb' print "" print 'Renderman Render Scene: python Main.py -r -r -f 1 -l 5 -b 180 -r -i /home/student/Ken/images light2.mb' print "" print 'Shake Composite Scene: python Main.py -s -t NTSC -d -b myBackground.tif -f myForeground.tif -o myCompositedImage.tif' print "" print "To get the command options or help with either of these modules:" print "Maya: python Main.py -m -h" print "Renderman: python Main.py -r -h" print "Shake: python Main.py -s -h" ######################################################### # Main loop # ######################################################### def main(): print "Main loop" ################################################# # Test to see if there were any arguments given # # If no arguments are given call the help # # function to show the user how to use this # # script. # ################################################# if (len(sys.argv) == 1): helpMe() raise SystemExit ################################################# # Test to make sure our arguments are read # # correctly and if they are not go to help # # function to show the user how to use the # # script. # ################################################# if (sys.argv[1] == "-h" or sys.argv[1] == "--help"): helpMe() sys.exit() elif (sys.argv[1] == "-m" or sys.argv[1] == "--maya"): print "Maya" maya = MayaBatch() # To edit the scene and render using Maya's renderer #print arguments[1:] maya.setupMaya(sys.argv[2:]) maya.execute() elif (sys.argv[1] == "-r" or sys.argv[1] == "--renderman"): print "Renderman" mtor = MTOR() # To render the scene in Renderman mtor.setupMTOR(sys.argv[2:]) mtor.execute() elif (sys.argv[1] == "-s" or sys.argv[1] == "--shake"): print "Shake" shake = ShakeComp() # To composite the images to the end final image shake.setupShake(sys.argv[2:]) shake.compositeImages() else: print "Invalid argument" helpMe() sys.exit() if __name__ == "__main__": main()