hook.py

hook.py contains generic hooks.

appStarted

Called every time Flame is started and reaches the splash screen.

def appStarted( info ):
   pass
info
Dictionary. Information about the Flame application that has been started.
Example used for reference below: Flame 2018.1
Key Description Example Data Type
homeDirectory Home directory of the started flame application. homeDirectory == "/opt/Autodesk/flame_2018.1.0" String
version Full version string of the started flame application. version == "2018.1.0" String
versionMajor Major version of the started flame application. versionMajor == "2018" String
versionMinor Minor version of the started flame application. versionMinor == "1" String
versionPatch Patch version of the started flame application. versionPatch == "0" String
configPath Path to the loaded flame application's config file. by default, configPath = "/opt/Autodesk/flame_2018.1.0/cfg/init.cfg" String

userChanged

Called every time a new user is loaded in the application. This includes the user selection on launch.

def userChanged( info ):
   pass

info: Dictionary. Information about the newly loaded flame user.

renderEnded

Called when a sequence finishes rendering, even if the render was unsuccessful due to factors such as a manual abort.

def renderEnded(moduleName, sequenceName, elapsedTimeInSeconds):
    pass
moduleName
String. Name of the rendering module.
sequenceName
String. Name of the rendered sequence.
elapsedTimeInSeconds
Float. Number of seconds it took to render the sequence named sequenceName.

playbackEnded

Called when a sequence finishes playback, successfully or not.

def playbackEnded(sequenceName, fps, debugInfo):
    pass
sequenceName
String. Name of the sequence that was played back.
fps
Float. The frames per second rate at which the sequence was played back.
debugInfo
Dictionary. Debugging playback information.

previewWindowConfigChanged

Called when the user changes the video preview device. The parameters for previewWindowConfigChanged are actually read from the init.cfg VideoPreviewDevice keyword.

def previewWindowConfigChanged(description,width,height,bitDepth,
rateString,syncString):
    pass
description
String. Description of the video preview device, such as 1920x1080@5994i_free.
width
Integer. Width of the selected preview device.
height
Integer. Height of the selected preview device.
bitDepth
Integer. Integer of the selected preview device.
rateString
String. Rate of the selected preview device, such as 6000i.
syncString
String. Sync source of the selected preview device, such as freesync.

getCustomUIActions

Hook returning the custom UI actions to display to the user in the contextual menu. It returns a tuple of group dictionaries. You can define as many group dictionaries as required.

def getCustomUIActions( ):
    return ()

In getCustomUIActions, a group dictionary defines a custom menu group,where keys define the group. A group dictionary has only two keys, name and actions.

Group Dictionary
name
String. The value of the name key defines the name of the action group displayed in the contextual menu in the application.
actions
Tuple. A tuple of action dictionaries. Each element of the tuple becomes a menu item in the menu created using the value of the name.

A dictionary of two keys, name and caption. Each action dictionary must appear in a group dictionary, as a value for the actions key.

Action Dictionary
name [string]
String. Name of the action that will be passed on customUIAction callback. Also used as the value for the actions key of a group dictionary.
caption [string]
String. Caption of the menu item displayed in the application. Displayed as child of the group dictionary.
The following code sample translates, in the contextual menu in a Creative Finishing application, into this menu structure:

Custom Group 1

Custom Group 2

def getCustomUIActions( ):
    action1 = {}
    action1[ "name" ] = "action1"
    action1[ "caption" ] = "Action Number 1"

    group1 = {}
    group1[ "name" ] = "Custom Group 1"
    group1[ "actions" ] = ( action1, )

    action2 = {}
    action2[ "name" ] = "action2"
    action2[ "caption" ] = "Action Number 2"
    
    action3 = {}
    action3[ "name" ] = "action3"
    action3[ "caption" ] = "Action Number 3"

    group2 = {}
    group2[ "name" ] = "Custom Group 2"
    group2[ "actions" ] = ( action2, action3)

    return ( group1, group2 )

getMainMenuCustomUIActions

Hook returning the custom UI actions to display to the user in the Flame main menu. It returns a tuple of group dictionaries. You can define as many group dictionaries as required.

def getMainMenuCustomUIActions( ):
    return ()

In getMainMenuCustomUIActions, a group dictionary defines a custom menu group, where keys define the group. A group dictionary has only two keys, name and actions.

Group Dictionary
name
String. The value of the name key defines the name of the action group displayed in the contextual menu in the application.
actions
Tuple. A tuple of action dictionaries. Each element of the tuple becomes a menu item in the menu created using the value of the name.

A dictionary of two keys, name and caption. Each action dictionary must appear in a group dictionary, as a value for the actions key.

Action Dictionary
name [string]
String. Name of the action that will be passed on customUIAction callback. Also used as the value for the actions key of a group dictionary.
caption [string]
String. Caption of the menu item displayed in the application. Displayed as child of the group dictionary.

See example from getCustomUIActions above for menu structure reference.

customUIAction

Hook called when a custom action is triggered in the menu.

def customUIAction( info, userData ):
    pass

Two parameters

timelineDefaultShotName

Hook called when starting the application and when switching project. The returned string is used as default for the Rename Shot dialog, and can contain tokens in brackets that will resolve at runtime. Timeline > Default Shot Name.

def timelineDefaultShotName( project ):
   return ""
project
String. Name of the project being opened.
The following code sample shows how you can define the default shot name with brackets for a dynamic naming convention:
if project == "project_name":
    return "<track>_<segment>_project"
return "<track>_<segment>_global"

timelineDefaultMarkerName

Hook called when starting the application and when switching project. The returned string is used as default for the marker name, and can contain tokens in brackets that will resolve at runtime. Timeline > Default Marker Name.

def timelineDefaultMarkerName( project ):
   return ""
project
String. Name of the project being opened.
The following code sample shows how you can define the default marker name with brackets for a dynamic naming convention:
if project == "project_name":
    return "<user>_<time>_project"
return "<user>_<time>_global"

timelineDefaultMarkerComment

Hook called when starting the application and when switching project. The returned string is used as default for the marker comment, and can contain tokens in brackets that will resolve at runtime. Overrides the preferences defined in Timeline > Default Marker Comment.

def timelineDefaultMarkerComment( project ):
   return ""
project
String. Name of the project being opened.
The following code sample shows how you can define the default marker name with brackets for a dynamic naming convention:
if project == "project_name":
    return "<user>_<time>_project"
return "<user>_<time>_global"