Python

Indicates a feature suggested and voted up by users on the Flame Feedback portal.



Python API

The following additions have been made to the Python API.


PyBatch

Nodes in the User, Project, and Shared bins can be added using the create_node() function of a PyBatch.

Example

# Add the node named MyKey from the User bin.
flame.batch.create_node("MyKey")

PyClrMgmtNode

Command Type Description
<PyClrMgmtNode>.import_transform() Function Used to import a CDL, CTF, LUT, or 3D LUT. The path to a valid file must be passed as an argument.

Example

# Import a CTF into a Colour Management node.
clr_mgmt = flame.batch.create_node("Colour Mgmt")
clr_mgmt.import_transform("/var/tmp/my_colour_transform.ctf")

PyClrMgmtTimelineFX

Command Type Description
<PyClrMgmtTimelineFX>.import_transform() Function Used to import a CDL, CTF, LUT, or 3D LUT. The path to a valid file must be passed as an argument.

Example

# Import a CTF into a Colour Management Timeline FX.
segment = flame.timeline.current_segment
clr_mgmt = segment.create_effect("Colour Mgmt")
clr_mgmt.import_transform("/var/tmp/my_colour_transform.ctf")

PyLensDistortionNode

Command Type Description
<PyLensDistortionNode>.mode Attribute Used set or get the distortion mode.
One of the following must be passed as the argument when the attribute is set:
  • Distort
  • Undistort
<PyLensDistortionNode>.calculate() Function Used to calculate the amount of distorsion based on the position of vertices.

Example

# Set the mode of a Lens Distortion node to Distort and calculate the distortion.
clip = flame.batch.get_node("my_clip")
grid = flame.batch.get_node("grid_clip")
lens_distort = flame.batch.create_node("Lens Distortion")
flame.batch.connect_nodes(clip, "Default", lens_distort, "Front")
flame.batch.connect_nodes(grid, "Default", lens_distort, "Lens Grid")
lens_distort.mode = "Distort"
lens_distort.calculate()

PyOFXNode

Command Type Description
<PyOFXNode>.preserve_input_colour_space Attribute Used to get or set the status of Preserve Input Colour Space
One of the following must be passed as the argument when the attribute is set:
  • True
  • False

Example

# Get the status of the Preserve Input Colour Space setting in an OpenFX node
ofx = flame.batch.create_node("OpenFX")
ofx.change_plugin("OFX Colourspace Full Example")
print(ofx.preserve_input_colour_space)

PyProject

The get_available_colour_spaces() function has been removed as it was used to get the colour spaces available in SynColor, which has been replaced with OCIO in the 2026 version.

Command Type Description
<PyProject>.description Read-Only Property Used to get the description of the current project.

Example

# Get the Description of a Project
print(flame.projects.current_project.description)

PyTimewarpNode

Command Type Description
<PyTimewarpNode>.mode Attribute Used to get or set the Timewarp mode.
One of the following must be passed as the argument when the attribute is set:
  • Speed
  • Timing
<PyTimewarpNode>.frame_interpolation_mode Attribute Used to get or set the Frame Interpolation mode.
One of the following must be passed as the argument when the attribute is set:
  • Motion
  • Trails
  • Mix
  • ML(2026)
  • ML(2025.1)
<PyTimewarpNode>.sample_mode Attribute Used to get or set the Sample Mode being for the Mix and Trails frame interpolation modes.
One of the following must be passed as the argument when the attribute is set:
  • Start
  • Middle
  • End
<PyTimewarpNode>.mix_amount Attribute Used to get or set the Amount for the Mix frame interpolation mode. A float number between 0.0 and 1000.0 must be passed as an argument when the attribute is set.
<PyTimewarpNode>.get_speed() Function Used to get the Speed value at the requested frame. A float number representing the frame must be passed as the argument.
<PyTimewarpNode>.get_timing() Function Used to set the Timing value at the requested frame. A float number representing the frame must be passed as the argument.
<PyTimewarpNode>.get_speed_timing() Function Used to get the Timing value for the current frame while in the Speed mode. A float number representing the frame must be passed as the argument.
<PyTimewarpNode>.get_duration_timing() Function Used to get the Timing value for the current frame while in the duration mode. A float number representing the frame must be passed as the argument.
<PyTimewarpNode>.set_speed() Function Used to set the Speed value at the requested frame.
Two arguments must be set:
  • A float number representing the frame.
  • A float number representing the new speed value.
<PyTimewarpNode>.set_timing() Function Used to set the Timing value at the requested frame.
Two arguments must be set:
  • A float number representing the frame.
  • A float number representing the new timing value.

Example

# Create a Timewarp node, apply a 50% speed change, and use a Machine Learning model on a clip node named MyClip.
clip = flame.get_node("my_clip")
tw = flame.batch.create_node("Timewarp")
flame.batch.connect_nodes(MyClip, "Default", tw, "Front")
tw.mode = "Speed"
tw.set_speed(1, 50.0)
tw.frame_interpolation_mode = "ML(2026)"

PyTimewarpTimelineFX

Command Type Description
<PyTimewarpNode>.mode Attribute Used to get or set the Timewarp mode.
One of the following must be passed as the argument when the attribute is set:
  • Speed
  • Timing
  • Duration
<PyTimewarpNode>.duration Attribute Used to get or set the Duration value for timeline segment. An integer number must be passed as the argument when the attribute is set.
<PyTimewarpNode>.duration_speed Attribute Used to get the Speed value for the current frame while in the Duration mode.
<PyTimewarpNode>.frame_interpolation_mode Attribute Used to get or set the Frame Interpolation mode.
One of the following must be passed as the argument when the attribute is set:
  • Motion
  • Trails
  • Mix
  • ML(2026)
  • ML(2025.1)
<PyTimewarpNode>.sample_mode Attribute Used to get or set the Sample Mode being for the Mix and Trails frame interpolation modes.
One of the following must be passed as the argument when the attribute is set:
  • Start
  • Middle
  • End
<PyTimewarpNode>.mix_amount Attribute Used to get or set the Amount for the Mix frame interpolation mode. A float number between 0.0 and 1000.0 must be passed as an argument when the attribute is set.
<PyTimewarpNode>.get_speed() Function Used to get the Speed value at the requested frame. A float number representing the frame must be passed as the argument.
<PyTimewarpNode>.get_timing() Function Used to set the Timing value at the requested frame. A float number representing the frame must be passed as the argument.
<PyTimewarpNode>.get_speed_timing() Function Used to get the Timing value for the current frame while in the Speed mode. A float number representing the frame must be passed as the argument.
<PyTimewarpNode>.get_duration_timing() Function Used to get the Timing value for the current frame while in the Duration mode. A float number representing the frame must be passed as the argument.
<PyTimewarpNode>.set_speed() Function Used to set the Speed value at the requested frame.
Two arguments must be set:
  • A float number representing the frame.
  • A float number representing the new speed value.
<PyTimewarpNode>.set_timing() Function Used to set the Timing value at the requested frame.
Two arguments must be set:
  • A float number representing the frame.
  • A float number representing the new timing value.

PyTypeNode / PyTypeTimelineFX

The following attributes, functions, and read-only properties apply to both the PyTypeNode and PyTypeTimelineFX.

Command Type Description
<PyTypeNode>.selected_layers Attribute Used to access the attributes, functions, and read-only properties of the selected layers.
<PyTypeNode>.current_layer Attribute Used to access the attributes, functions, and read-only properties of the current layer.
<PyTypeNode>.swaa Attribute Used to get or set the amount of software anti-aliasing samples.
One of the following must be passed as the argument when the attribute is set:
  • SWAA 1x
  • SWAA 4x
  • SWAA 9x
  • SWAA 16x
  • SWAA 25x
  • SWAA 36x
  • SWAA 49x
  • SWAA 64x
<PyTypeNode>.use_hwaa Attribute Used to get or set the status of Use HWAA
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeNode>.motion_blur Attribute Used to get or set the status of Motion Blur
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeNode>.motion_blur_samples Attribute Used to get or set the amount of motion blur samples. An integer number between 2 and 100 must be passed as an argument when the attribute is set.
<PyTypeNode>.motion_blur_phase Attribute Used to get or set the motion blur phase. A float number between -1.0 and 1.0 must be passed as an argument when the attribute is set.
<PyTypeNode>.motion_blur_shutter Attribute Used to get or set the motion blur shutter. A float number between 0.10 and 50.0 must be passed as an argument when the attribute is set.
<PyTypeNode>.resolution_mode Attribute Used to get or set the resolution mode.
One of the following must be passed as a string to set the mode:
  • Resolution List
  • Adaptive
  • Scaling Presets
<PyTypeNode>.scaling_presets_value Attribute Used to get or set the Scaling Presets value. A float must be passed as an argument to set the value. The value represents the scaling percentage.
<PyTypeNode>.adaptive_mode Attribute Used to get or set the Adaptive mode.
One of the following must be passed as a string to set the mode:
  • Width based on Ratio
  • Height based on Ratio
<PyTypeNode>.add_layer() Function Used to create a new PyTypeLayer.
One of the following must be passed as an argument to set the Layer type:
  • Left
  • Centre
  • Right
  • Roll
  • Crawl
<PyTypeNode>.append_type_setup() Function Used to append a file setup to the existing Type setup.
A file path including the filename must be passed as an argument.
<PyTypeNode>.layers Read-Only Property Returns the list of layers.

PyTypeLayer

A Type layer as its own set of attributes and read-only property.

Command Type Description
<PyTypeLayer>.hidden Attribute Used to get or set the visibility status of a Layer.
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeLayer>.text Attribute Used to get or set the characters of a Layer. A string must be passed as an argument to change the characters.
<PyTypeLayer>.font Attribute Used to get or set the characters font. A tuple with a maximum of three values between Font Family, Font Style, and Project Font Index is returned when getting the current font.
When the attribute is set, one of the following values can be used:
  • Font Family: A string representing the name of the Font Family
  • Font Style: A string representing the name of the Font Style
  • Font Path: A string representing the path to a font
  • Project Font Index: An integer number representing the index of the Font in the Project Fonts table.

One of the following combinations must used when the attribute is set:
  • (Font Family, Font Style)
  • (Font Family, Font Style, Project Font Index)
  • (Font Path, Font Style)
  • Font Path
  • Project Font Index
<PyTypeLayer>.font_size Attribute Used to get or set the characters Size. A float number between 0.0 and 2000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.fill Attribute Used to get or set the status of the Fill Active button.
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeLayer>.fill_colour Attribute Used to get or set the Fill Colour of the characters. A tuple with three values (Red, Green, and Blue) must be passed to set the colour.
<PyTypeLayer>.fill_opacity Attribute Used to get or set the characters Opacity. A float number between 0.0 and 100.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.italic_angle Attribute Used to get or set the characters Italic angle. A float number between -60.0 and 60.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.kerning Attribute Used to get or set the characters Kerning. A float number between -100000.0 and 10000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.tracking Attribute Used to get or set the characters Tracking. A float number between -100000.0 and 10000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.underline Attribute Used to get or set the status of the Underline Active button.
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeLayer>.underline_width Attribute Used to get or set the Underline Width. A float number between -9999.0 and 9999.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.underline_offset_y Attribute Used to get or set the Underline Y Offset. A float number between -9999.0 and 9999.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.outline Attribute Used to get or set the status of the Outline Active button.
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeLayer>.outline_colour Attribute Used to get or set the Outline Colour of the characters. A tuple with three values (Red, Green, and Blue) must be passed to set the colour.
<PyTypeLayer>.outline_width Attribute Used to get or set the Outline Width. A float number between 1.0 and 500.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.outline_join Attribute Used to get or set the Outline Join mode.
One of the following must be passed as the argument when the attribute is set:
  • Round Join
  • Square Join
  • Bevel Join
  • Miter Join
<PyTypeLayer>.outline_miter_limit Attribute Used to get or set the Outline Miter Limit. A float number between 0.0 and 100.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.case Attribute Used to get or set the characters Case.
One of the following must be passed as the argument when the attribute is set:
  • Original
  • Uppercase
  • Lowercase
  • Title Caps
  • Small Caps
<PyTypeLayer>.superscript Attribute Used to get or set the status of the Superscript option.
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeLayer>.subscript Attribute Used to get or set the status of the Subscript option.
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeLayer>.strikeout Attribute Used to get or set the status of the Strikeout option.
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeLayer>.mask_mode Attribute Used to get or set the Mask mode.
One of the following must be passed as the argument when the attribute is set:
  • Disabled
  • Top
  • Bottom
  • Left
  • Right
<PyTypeLayer>.mask_position Attribute Used to get or set the Mask Position. A float number between 0.0 and 100.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.background Attribute Used to get or set the status of the Background Active button.
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeLayer>.background_colour Attribute Used to get or set the Background Colour. A tuple with three values (Red, Green, and Blue) must be passed to set the colour.
<PyTypeLayer>.background_opacity Attribute Used to get or set the Background Opacity. A float number between 0.0 and 100.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.background_radius Attribute Used to get or set the Background Radius. A float number between 0.0 and 1.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.background_offset Attribute Used to get or set the Background Offset. Float numbers for the X and Y values must be passed as arguments when the attribute is set.
<PyTypeLayer>.background_scale Attribute Used to get or set the Background Scale. A tuple with two float values (X, Y) must be passed as an argument when the attribute is set.
<PyTypeLayer>.background_outline Attribute Used to get or set the status of the Background Outline.
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeLayer>.background_outline_colour Attribute Used to get or set the Background Outline Colour. A tuple with three values (Red, Green, and Blue) must be passed to set the colour.
<PyTypeLayer>.background_outline_width Attribute Used to get or set the Background Outline Width. A float number between 1.0 and 500.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.background_outline_join Attribute Used to get or set the Background Outline Join mode.
One of the following must be passed as the argument when the attribute is set:
  • Round Join
  • Square Join
  • Bevel Join
  • Miter Join
<PyTypeLayer>.background_outline_miter_limit Attribute Used to get or set the Background Outline Miter Limit. A float number between 0.0 and 100.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.shadow Attribute Used to get or set the status of the Shadow Active button.
One of the following must be passed as the argument when the attribute is set:
  • True
  • False
<PyTypeLayer>.shadow_colour Attribute Used to get or set the Shadow Colour of the characters. A tuple with three values (Red, Green, and Blue) must be passed to set the colour.
<PyTypeLayer>.shadow_opacity Attribute Used to get or set the Shadow Opacity. A float number between 0.0 and 100.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.shadow_blur Attribute Used to get or set the Shadow Blur. A tuple with two float values (X, Y) between 0.0 and 100.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.shadow_position Attribute Used to get or set the Shadow Position. A tuple with two float values (X, Y) between -1000000.0 and 1000000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.shadow_scale Attribute Used to get or set the Shadow Scale. A tuple with two float values (X, Y) between -1000000.0 and 1000000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.shadow_shear Attribute Used to get or set the Shadow Shear. A tuple with two float values (X, Y) between -60.0 and 60.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.shadow_rotation Attribute Used to get or set the Shadow Rotation. A float number between -1000000.0 and 1000000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.position Attribute Used to get or set the Layer Position. A tuple with two float values (X, Y) between -1000000.0 and 1000000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.scale Attribute Used to get or set the Layer Scale. A tuple with two float values (X, Y) between -1000000.0 and 1000000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.shear Attribute Used to get or set the Layer Shear. A tuple with two float values (X, Y) between -60.0 and 60.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.rotation Attribute Used to get or set the Layer Rotation. A float number between -1000000.0 and 1000000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.centre Attribute Used to get or set the Layer Centre. A tuple with two float values (X, Y) between -1000000.0 and 1000000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.axis_alignment Attribute Used to get or set the Layer Axis Alignment.
One of the following must be passed as the argument when the attribute is set:
  • Bottom / Right
  • Bottom
  • Bottom / Left
  • Right
  • Centre
  • Left
  • Top / Right
  • Top
  • Top / Left
<PyTypeLayer>.width Attribute Used to get the Layer Width.
<PyTypeLayer>.justification Attribute Used to get or set the Layer Justification.
One of the following must be passed as the argument when the attribute is set:
  • Left
  • Centre
  • Right
  • Justified
<PyTypeLayer>.leading Attribute Used to get or set the Layer Leading. A float number between -1000000.0 and 1000000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.separation Attribute Used to get or set the Layer Separation. A float number between -999.0 and 999.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.indent Attribute Used to get or set the Layer Indent. An integer number between 0 and 1000.0 must be passed as an argument when the attribute is set.
<PyTypeLayer>.type Read-Only Property Returns the layer type.

Examples

# Create a Type node, add a left-justified layer containing the sentence "This was added using the Python API.", and change some attributes
ty = flame.batch.create_node("Type")
ty_layer = ty.add_layer("Left")
ty_layer.text = "This was added using the Python API."
ty_layer.font = ("Discreet","Bold")
ty_layer.size = 75.0
# Get the layer type of all layers in the setup of a Type node named my_type.
ty = flame.batch.get_node("my_type")
for layer in ty.layers:
    print(layer.type)
    print(layer.text)
    print("=====")


Python Hooks

Use the isSnapshot key in the pre_export_asset and post_export_asset hooks available in the /opt/Autodesk/<application version>/python/export_hook.py file to trigger a python hook when a Player Snapshot is created.

New hooks for project creation, conversion, edition, and deletion are available. See Projects Python hooks for details.