User guide
40
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 usefule 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
)
Shell Mode
Shell mode exposes Katana's Python interpreter in the terminal shell. Shell mode requires the --shell flag, and no
arguments. All of the modules available in the Python tab in Katana are available in Shell mode.
To start Katana in Shell mode:
1. Open a terminal.
6 KATANA LAUNCH MODES |