Script Mode
Script mode allows you to execute Python scripts in Katana's Python environment. Script mode requires the --script flag, followed by a single argument specifying the script you want to run. This launch mode is most useful for testing. You can import most Katana modules, and perform tasks such as loading Katana scenes, changing some parameters, and rendering.
For example, to start Katana in Script mode using a script named yourScript.py:
1. | Open a terminal. |
2. | Navigate to the directory where you installed Katana. |
3. | Enter: |
./katana --script /yourDirectory/yourScript.py
To open a scene and start rendering from the scene's Render node, open the following Python script in Script mode:
import NodegraphAPI from Katana import KatanaFile from Katana import RenderManager def messageHandler( sequenceID, message ): print message yourKatanaScene = "/yourDirectory/yourFile.katana" KatanaFile.Load( yourKatanaScene ) # Loading scene /yourDirectory/yourFile.katana RenderNode = NodegraphAPI.GetNode('Render') # Getting Render node RenderManager.StartRender( node=RenderNode, # Starting render hotRender=True, frame = 1, asynch = False, interactive = False, asynch_renderMessageCB = messageHandler )