The Flame Python API is a tool for any Flame user looking to script their workflow and automate tedious tasks.
The Python API is accessed via the Flame Python Console. This console gives you a place to write and execute code while working in Flame.
The Flame module is the core of the Python API. This module contains all that you need to use the Flame Python API.
The Python API uses Python version 3.9.7, since Flame Family 2023.
Write Your First Python API Script shows a small and basic example to get you started.
The Flame API Code Samples contains code snippets that should give some ideas on the structure of the API, and how to use it. You will also find examples of scripts in /opt/Autodesk/<flame_version>/python_examples.
The new directory /opt/Autodesk/<version>/python_utilities replaces the old /opt/Autodesk/<version>/python_examples directory. It contains a scripts directory for useful custom actions, and an examples directory for examples of python API uses.
You now have more control over the placement of custom actions in contextual menus.
You can now place custom actions at the first level of a contextual menu or inside a submenu hierarchy.
You can now set the order attribute on a submenu or an action set the order in which they are displayed. Custom actions that do no
t have an order attribute are sorted alphabetically.
Use the separator attribute to add a separator between custom actions or submenus. Make sure to set the above or below attribute for each separator.You can find a custom layout example in /opt/Autodesk/<version>/python_utilities/examples.
minimumVersion attribute to 2023.2.0.0 on your actions so the new structure only applies to this version and not previous releases.You can now pass a directory as an argument to flame.import_clips().
flame.batch.create_group()You no longer have to set the duration argument for the flame.batch.create_group() function.
| Command | Type | Description |
|---|---|---|
<PyWriteFileNode>.add_to_workspace |
Attribute | Used to enable or disable the new Add to Workspace button available in the Write File node. One of the following must be set as an argument:
Enable the Add to Workspace option in a Write File node
|
![]() <PyWriteFileNode>.in_mark![]() <PyWriteFileNode>.out_mark |
Attribute | Used to set the in_mark and out_mark on a Render node. A frame or timecode information must be passed as an argument. This can be done by passing the information from another node or using a PyTime. Set the Render node In Mark based on a Clip's In Mark Enable the Add to Workspace option in a Write File node
Set the Render node Out Mark using a PyTime
|
![]() <PyBatch>.current_iteration_number![]() <PyBatchIteration>.iteration_number |
Read-Only Property | Used to get only the number part of a Batch Iteration name. Get the current iteration number of the current Batch Group
|
![]() <PyWriteFileNode>.get_resolved_media_path() |
Function | Used to get the media path of a write file node with resolved tokens. Three arguments can be set:
Get the system disk path set in a selected Write File node
|
<PyNode>.set_channel_name() |
Function | Used to set the name of a channel in the Render and Write File nodes. The following must be passed as arguments:
Change the first two channels of a Write File node
Change the first two channels of a Render node
|
<PyNode>.channels |
Read-Only Property | Used to print a tuple of the current channels present in a Render and Write File nodes. Print the name of channels present in a Write File node
|
You can now use the Python API to display Flame browser for users to select files. The PyBrowser object is used to set a file selection and settings as variables to be used by other functions like flame.import_clips(). The advantage of using a PyBrowser over a Qt dialog box is user interface consistency and access to features such as bookmarks.
Flame Family includes updates to the API in the following components:
| Command | Type | Description |
|---|---|---|
![]() flame.messages.show_in_dialog() |
Function | Used to open a message dialog box and offer options to users. The following arguments can be passed:
Example: Display a Dialog offering default colours for a new Reel. |
flame.messages.show_in_console() |
Function |
An example of how to use these functions are available in /opt/Autodesk/<version>/python_examples. |
flame.messages.clear_console() |
Function | Used to clear the content of the message console. |
| Command | Type | Description |
|---|---|---|
flame.batch.import_clips() |
Function | Allow to import multiple clips at once, as opposed to flame.batch.import_clip() which always imports the frames found in a path as a single clip node. |
You can now use the Python API to open a Flame file browser for users to select files. The PyBrowser object itself is only used to set a file selection and settings as variables that can be used by other functions like flame.import_clips(). The advantage of using a PyBrowser over a Qt dialog box is user interface consistency and access to features such as the Flame bookmarks.
| Command | Type | Description |
|---|---|---|
flame.browser.show() |
Function | Used to open a <PyBrowser> window. The Resolution dropdown is set to Same as Source by default. The Width, Height, and Ratio settings are disabled when the resolution is set to Same as Source. In this scenario None is returned for Width, Height, and Ratio. The following arguments can be passed:
|
flame.browser.selection |
Read-Only Property | Returns a list of the selected files/directories. |
flame.browser.resolution |
Read-Only Property | Returns a resolution preset name. |
flame.browser.width |
Read-Only Property | Returns the width set in the Resolution controls. |
flame.browser.height |
Read-Only Property | Returns the height set in the Resolution controls. |
flame.browser.bit_depth |
Read-Only Property | Returns the bit depth set in the Resolution controls. |
flame.browser.frame_ratio |
Read-Only Property | Returns the frame ratio set in the Resolution controls. |
flame.browser.scan_mode |
Read-Only Property | Returns the scan mode set in the Resolution controls. |
flame.browser.colour_space |
Read-Only Property | Returns the colour space set in the Resolution controls. |
flame.browser.resize_mode |
Read-Only Property | Returns the resizing mode set in the Resolution controls. |
flame.browser.resize_filter |
Read-Only Property | Returns the resizing filter set in the Resolution controls. |
flame.browser.sequence_mode |
Read-Only Property | Returns the state of the Sequences / Frames button in the file browser. |
| Command | Type | Description |
|---|---|---|
flame.mediahub.files.options.set_tagged_colour_space |
Attribute | Used to set the MediaHub's Colour Space to Tag Only with the defined colour space. |
flame.mediahub.files.options.resize_mode |
Attribute |
Used to get or set the MediaHub's Resizing mode. One of the following value must be passed as an argument when the attribute is set:
|
flame.mediahub.files.options.resize_filter |
Attribute |
Used to get or set the MediaHub's Resizing filter. One of the following value must be passed as an argument when the attribute is set:
|
flame.mediahub.files.options.resolution |
Attribute |
Used to get or set the MediaHub's Resolution. One of the following value must be passed as an argument when the attribute is set:
|
flame.mediahub.files.options.width |
Attribute | Used to get or set the MediaHub's Resolution width. An integer value between 24 and 16384 must be passed when the attribute is set. |
flame.mediahub.files.options.height |
Attribute | Used to get or set the MediaHub's Resolution height. An integer value between 24 and 16384 must be passed when the attribute is set. |
flame.mediahub.files.options.frame_ratio |
Attribute | Used to get or set the MediaHub's frame ratio. A float value between 0.01 and 100.00 must be passed when the attribute is set. |
flame.mediahub.files.options.pixel_ratio |
Attribute | Used to get or set the MediaHub's pixel ratio. This attribute is only used when the Resolution is set to "Same as Source" One of the following value must be passed as an argument when the attribute is set.
|
flame.mediahub.files.options.bit_depth |
Attribute |
Used to get or set the MediaHub's Bit Depth. One of the following value must be passed as an argument when the attribute is set.
|
flame.mediahub.files.options.scan_mode |
Attribute |
Used to get or set the MediaHub's Scan Mode. One of the following value must be passed as an argument when the attribute is set.
|
flame.mediahub.files.options.sequence_mode |
Attribute |
Used to set the MediaHub's sequence mode to File Sequence or Frame. One of the following must be passed as an argument:
|
![]() flame.import_clips() |
Function |
Use one of the following to import a file sequence as a single clip:
|
| Command | Type | Description |
|---|---|---|
<PyClip>.get_colour_space |
Function |
Used to get the colour space of a frame in time. A PyTime can be passed as an argument to get the colour space at a specific time. If no PyTime is specified the positioner is used fo the PyClip and the first frame is used for the PySegment. |
| Command | Type | Description |
|---|---|---|
<PyTransition>.set_dissolve_to_from_colour() |
Function |
Used to transform a dissolve into a To/From Colour transition. RGB values must be passed as an argument. |
<PyTransition>.set_fade_to_from_silence() |
Function | Used to transform an audio fade into a To/From Silence transition. |
| Command | Type | Description |
|---|---|---|
<PyNode>.slope_red |
Attribute |
Used to get or set the RGB Slope values. A float number must be passed as an argument when the attribute is set. |
<PyNode>.offset_red |
Attribute | Used to get or set the RGB Offset values. A float number must be passed as an argument when the attribute is set. |
<PyNode>.power_red |
Attribute | Used to get or set the RGB Power values. A float number must be passed as an argument when the attribute is set. |
<PyNode>.saturation |
Attribute | Used to get or set the Saturation value. A float number must be passed as an argument when the attribute is set. |
<PyNode>.style |
Attribute | Used to get or set the Style value. One of these must be passed as an argument when the attribute is set:
|
<PyNode>.invert |
Attribute | Used to get or set the Invert value. One of these must be passed as an argument when the attribute is set:
|
| Command | Type | Description |
|---|---|---|
![]() <PyArchiveEntry>.clear_colour() |
Function | Used to remove the colour coding on every entry of the Media Panel that can be colour coded. |
| Command | Type | Description |
|---|---|---|
<PyClip>.cut() |
Function | Used to create a cut on one or all tracks of a clip. Example: Create a cut on all tracks on the 10th frame
Create a cut on a single track at 10:00:01:00 |
<PySegment>.clear_colour() |
Function | Used to remove the colour coding on a Timeline Segment. |
PyClip.create_container() |
Function |
Used to create a Container. The following methods are used in order:
|
PySegment.container_clip() |
Read-Only Property | Returns the content of a container in the form of a PyClip object so some modifications normally made on a PyClip are accessible. |
PyClip.open_container() |
Function | Used to open a Container tab. |
PyClip.close_container() |
Function | Used to close a Container tab. |
<PySequence>.padding_start |
Attribute | Used to add a gap before or after the first/last Timeline segment of a Sequence. A PyTime defined up to which frame the gap must be extended must be passed as an argument. Example: Add a gap from 09:59:00:00 to 10:00:00:00 for a clip starting at 10:00:00:00 |
<PySegment>.create_unlinked_segment() |
Function |
Used to turn a Gap into an unlinked media segment. The following arguments can be passed:
|
<PySegment>.source_audio_track |
Read-Only Property | Used to get the audio track from the source media. |
| Command | Type | Description |
|---|---|---|
<PyTrack>.insert_transition() |
Function |
Used to create a transition on a <PyTrack>. The following arguments can be passed:
Example: Create a new up to cut transition at frame 24 in a Sequence |
<PyTransition>.set_transition() |
Function | Used to set attributes on an existing transition. The following arguments can be passed:
Example: Change an existing cut into a dissolve |
<PyTransition>.slide() |
Function |
Used to slide a transition. The following arguments can be passed:
|
<PyTransition>.name |
Attribute | Used to get or set the transition name. A string must be passed as an argument when the attribute is set. |
<PyTransition>.duration |
Attribute | Used to get or set the transition duration. An integer number must be passed as an argument when the attribute is set. |
<PyTransition>.alignment |
Attribute | Used to get or set the transition alignment. One of the following value must be passed as an argument when the attribute is set.
|
<PyTransition>.selected |
Attribute | Used to get or set the transition selection status. |
<PyTransition>.type |
Attribute | Return the transition type. |
<PyTransition>.record_time |
Read-Only Property | Returns the record time of the cut. |
<PyTransition>.in_offset |
Read-Only Property | Returns the offset between the record_time (cut point) and the start time of the transition. |
<PyTransition>.parent |
Read-Only Property | Return the PyTrack on which the transition is located. |
<PyClip>.selected_transitions |
Read-Only Property | Used to get or set the selected transitions of a clip. |
<PyTimeline>.current_transition |
Read-Only Property | Returns a PyTransition if the current element of the timeline is a transition. |
Flame Family now installs and uses Python 3.9.7 instead of version 3.7.9 used in Flame Family 2022.
The app_started python hook has been removed. Use the Python hook app_initialized instead.
Python hook get_action_custom_ui_actions, used by the Action family nodes to add custom actions, is now available in Image and GMask Tracer.
Flame Family includes updates to the API in the following components:
| Command | Type | Description |
|---|---|---|
![]() flame.mediahub.files.options.multi_channel_mode |
Attribute | Sets the Multi-Channel mode in the MediaHub. The possible modes are:
Example: Set the multi-channel mode |
flame.mediahub.files.options.cache_mode |
Attribute | Set the Media Cache mode in the MediaHub. The possible modes are:
Example: Set the media caching mode |
flame.mediahub.files.options.proxies_mode |
Attribute | Set the Media Proxies mode in the MediaHub. The possible modes are:
Example: Set the media proxies mode |
flame.mediahub.files.options.cache_and_proxies_all_versions |
Attribute | Set the Clip Version mode in the MediaHub. The possible modes are:
Example: Set the clip version mode |
| Command | Type | Description | |
|---|---|---|---|
<PyReelGroup>.save() |
Function | Saves a PyReelGroup to the current Destination in the Library. The function was previously available for other PyObjects present in the Desktop but was not for the PyReelGroup. Example: Save a Reel Group to the destination Library |
|
|
Read-Only Property | Returns True if a Batch Group or Library is opened and False if it's closed. |
| Command | Type | Description |
|---|---|---|
|
Function | Inserts or Overwrites a source clip in a Sequence. The following arguments can be set:
Examples Overwrite the selected clip inside a sequence
Insert an Audio Track inside a sequence |
|
Function | Copy the selected segments to a destination in the Media Panel. The following arguments can be set:
Example: Copy the selected segment to the Media Panel |
| Command | Type | Description | |
|---|---|---|---|
flame.delete(<PySegment>) |
Function | Deletes a Timeline segment. This call produces the same result as the Lift shortcut: the segment is deleted and the other segments are not rippled. Example: Delete a segment in the Timeline |
|
flame.timeline.type |
Attribute | Focuses a Timeline tab in the user interface. The possible arguments are:
Example: Focus the sequence tab in the Timeline |
|
flame.timeline.clip |
Read-Only Property | Returns the PyClip or PySequence associated to the clip shown in the Timeline. Useful when running scripts in the Python Console. Example: Rename the clip currently shown in the Timeline |
|
|
Read-Only Property | Returns a PySegment, PyMarker, or a PyTimelineFX depending on what is selected in the current clip. Useful when running scripts in the Python Console. Example: Rename the selected segment in the Timeline |
|
|
Function | Turns a gap into a colour source segment and modifies the colour of an existing colour source segment. Red, Green, and Blue values arguments must be set. Example: Turn the selected gap to a colour source in the Timeline |
|
|
Function | Matches a segment from the current sequence to a destination. Contrary to the Match operation performed using the user interface or the keyboard shortcut a new clip is always created. 5 arguments can be set:
Example: Match a Timeline segment to a Reel |
|
|
Function | Replaces a Timeline segment with a source clip. A PyClip must be specified.
Example: Replace the media of a Timeline segment |
|
|
Function | Applies Trim, Slip, and Slide editorial operations. The following arguments can be set:
Example: Trim the head of a Timeline segment |
|
|
Function | Applies the Slide Keyframe editorial operation. The following arguments can be set:
Example: Slide keyframes of a Timeline segment |
|
<PyVersion>.copy_to_media_panel()
<PyAudioTrack>.copy_to_media_panel()
|
Function | Creates a new clip into the specified destination in the Media Panel. The following arguments can be set:
Example: Copy a segment to a Reel |
|
|
Read-Only Property | The following PyClip/PySequence information can be obtained through the PySegment properties. PySegment (source, gap, bfx):
PySegment with source media:
PySegment on an audio track:
Example: Get the Width and Height of the current segment |
|
|
Read-Only Property | Return the lists of RGB and Matte channels. |
|
|
Read-Only Property | Return the current RGB and Matte channels. |
|
|
Read-Only Property | Return the Matte mode. The possible values are:
|
|
|
Function | Set the RGB and Matte channels using the channel names or indexes. The following arguments can be set for the RGB and Matte channels:
Also the matte_mode can be set for the Matte channel. The modes are:
|
|
|
Attribute | The tokenized attributes can be used to set the name and comment of a PySegment or PyMarker using tokens. A string must be passed as an argument. The dynamic attributes can be used to enabled or disable the Dynamic button in the Rename and Comment dialog boxes. True or False must be passed as an argument. Example: Set the name of a timeline segment using tokens
Enable the Dynamic setting in the Marker's comment field |