Setup guide
to as “hooks”. You can enter Python commands directly inside these functions,
or use the functions to call an external script or executable.
NOTE To be able to run shell commands or external script using the os.system
Python statement, add the following line in the hook.py script, before the definition
of the first hook:
import os
Note the following about hook functions:
■ Functions in hook.py receive certain predefined parameters from the
application. These parameters contain specific details on the event that
occurred in the application, for example, the name of the project loaded.
Use these details to better customize the response action.
■ Functions in hook.py are executed in a separate thread from the application.
Thus, the application does not wait for a hook function to complete.
■ When a function is called by the application, it executes with the privileges
of the user account from which the application was launched. Make sure
your custom code in the hook.py file does not call external scripts or
executables that require more elevated user privileges.
■ Functions do not return any value to the application that called them.
Thus, the application cannot provide any feedback on whether your custom
code executed properly or not.
■ Actions defined in the hook.py file for one version of an application are
not automatically used by other versions or applications. To carry your
code over to another application or version, you must manually copy your
customized hook.py file into the python subdirectory of that application’s
home directory.
This chapter describes the functions available in the hook API. More functions
may be added by Autodesk in subsequent versions. Check the latest hook.py
file after installing new versions of the software, to see any new functions that
may have been added.
NOTE You must be logged in as root to edit the hook.py file.
void projectChanged(string projectName)
This hook is called by the Visual Effects and Finishing application when the
project is changed in the Project Management section of the Preferences menu.
This hook is not triggered when a project is loaded at application start-up.
182 | Chapter 6 Advanced Configuration and Troubleshooting