Share

What's New in Previous Releases

This topic covers updates to the Python API, by release.

What's New in 2024.2

New PyObject: PyResolution

A new PyObject named PyResolution can be used to get and set the resolution of a node.

Command: flame.PyResolution()

Type: Constructor

Description: Used to define a resolution unit.

The following arguments can be passed:

  • resolution One of the following values must be set:

    • The string corresponding to a resolution in the Resolution List.
    • “Custom Resolution"
    • "Project Resolution"
  • width An integer value must be set.

  • height An integer value must be set.

  • bit_depth One of the following must be set:

    • 8
    • 10
    • 12
    • 16
    • 32
  • frame_ratio A float value must be set.

  • scan_mode One of the following must be set:

    • F1
    • F2
    • P
Note:

It is not possible to set only the desired parameters directly in the constructor. One of three predefined constructors must be used.

  • flame.PyResolution() In this scenario, the individual attributes can be set afterward. If no attributes are set the Project Resolution is used.
  • flame.PyResolution(resolution)
  • flame.PyResolution(width, height, bit_depth, frame_ratio, scan_mode)



Command: <PyNode>.resolution

Type: Attribute

Description: Used to get or set the resolution of a node in Batch, Batch FX, and Modular Keyer.

Examples:

# Print the resolution of a node
print(flame.batch.get_node("resize78").resolution.get_value().resolution)

# Copy the resolution settings between nodes
res = flame.batch.get_node("col78").resolution.get_value()
flame.batch.get_node("col83").resolution = res

# Set the resolution of a node using a preset
res = flame.PyResolution("HD 1080 16:9 (1920 x 1080")
resize = flame.batch.get_node("resize01")
resize.resolution = res

# Set the resolution of a node using individual values
res = flame.PyResolution()
res.width = 1920
res.height = 1080
res.bit_depth = 16
res.frame_ratio = 1.778
res.scan_mode = "P"
resize = flame.batch.get_node("resize01")
resize.resolution = res

Updated PyObject: PyExport

Attributes have been added to the PyExport Object to control how to deal with the Subtitles of a clip.

Command: flame.PyExporter.include_subtitles

Type: Attribute

Description: Used to set if the Subtitles must be included in an exported clip. One of the following values must be set:

  • True
  • False

Command: flame.PyExporter.export_subtitles_as_files

Type: Attribute

Description: Used to select the Subtitles Export mode between Export as Files and Burn in Image. One of the following values must be set:

  • True (the Export as Files option is selected)
  • False (the Burn in Image option is selected)

Command: flame.PyExporter.export_all_subtitles

Type: Attribute

Description: Used to select if a file will be created for the current Subtitle track or all Subtitle tracks. One of the following values must be set:

  • True (the All Subtitles Track option is selected)
  • False (the Current Subtitle Track option is selected)

Updated Commands: Batch

Most settings in the Colour Source nodes are now available as attributes in the Python API.

Command: <PyNode>.mode

Type: Attribute

Description: Used to get or set the mode in the Colour Source node. One of the following values must be passed as a string to set the mode:

  • Colour
  • Colour Noise
  • Gradient
  • Noise
  • PAL Bars
  • SMPTE Bars

Examples:

# Set the mode of a Colour Source node to Gradient
cs = flame.batch.create_node("Colour Source") cs.mode = "Gradient"

Command: <PyNode>.colour

Type: Attribute

Description: Used to get or set the colour in the Colour Source node. The colour is used in the Colour mode.

A tuple with three values (Red, Green, and Blue) must be passed to set the colour.

Examples:

# Set the colour of a Colour Source node to black
cs = flame.batch.create_node("Colour Source")
cs.mode = "Colour"
cs.colour = (0.0, 0.0, 0.0)

Command: <PyNode>.luminance

Type: Attribute

Description: Used to get or set the luminance in the Colour Source node. The luminance is used in all modes but Gradient. One of the following values must be passed as an argument to set the luminance:

  • 75
  • 100

Examples:

# Set the luminance of a Colour Source node to 75%
cs = flame.batch.create_node("Colour Source")
cs.luminance = 75

Command: <PyNode>.bars_softness

Type: Attribute

Description: Used to get or set the bars softness in the Colour Source node. The luminance is used in the SMPTE Bars and PAL Bars mode. An int value between 0 and 100 must be passed as an argument to set the bars softness.

Examples:

# Set the colour bars softness of a Colour Source node to 3
cs = flame.batch.create_node("Colour Source")
cs.mode = "SMPTE Bars"
cs.bars_softness = 3

Command: <PyNode>.gradient_mode

Type: Attribute

Description: Used to get or set the gradient mode in the Colour Source node. The gradient mode is used in the Gradient mode. One of the following values must be passed as a string to set the gradient mode:

  • 2
  • 4

Examples:

# Set the gradient mode of a Colour Source node to 4 Pots.
cs = flame.batch.create_node("Colour Source")
cs.mode = "Gradient"
cs.gradient_mode = 4

Command: <PyNode>.gradient_direction_mode

Type: Attribute

Description: Used to get or set the gradient direction in the Colour Source node. The gradient direction is used in the Gradient mode. One of the following values must be passed as a string to set the gradient direction mode:

  • Circular
  • Horizontal
  • Vertical

Examples:

# Set the gradient direction mode of a Colour Source node to Vertical.
cs = flame.batch.create_node("Colour Source")
cs.mode = "Gradient"
cs.gradient_direction_mode = "Vertical"

Command: <PyNode>.gradient_circular_mode

Type: Attribute

Description: Used to get or set the gradient circular mode in the Colour Source node. The gradient circular mode is used in the Gradient mode. One of the following values must be passed as a string to set the gradient circular mode:

  • Diagonal
  • Height
  • Width

Examples:

# Set the gradient circular mode of a Colour Source node to Height.
cs = flame.batch.create_node("Colour Source")
cs.mode = "Gradient"
cs.gradient_direction_mode = "Circular"
cs.gradient_circual_mode = "Height"

Command: <PyNode>.bi_gradient_colour_one, <PyNode>.bi_gradient_colour_two

Type: Attribute

Description: Used to get or set the gradient colours in the Colour Source node. The colours are used in the Gradient mode set to 2 Pots. A tuple of three values (Red, Green, and Blue) must be passed to set a colour.

Examples:

# Set the colours of a Colour Source node's bi-gradient.
cs = flame.batch.create_node("Colour Source")
cs.mode = "Gradient"
cs.gradient_mode = 2
cs.bi_gradient_colour_one = (1.0, 0.0, 0.0)
cs.bi_gradient_colour_one = (0.0, 1.0, 0.0)

Command: <PyNode>.quad_gradient_colour_top_left, <PyNode>.quad_gradient_colour_top_right, <PyNode>.quad_gradient_colour_bottom_left, <PyNode>.quad_gradient_colour_bottom_right

Type: Attribute

Description: Used to get or set the gradient colours in the Colour Source node. The colours are used in the Gradient mode set to 4 Pots. A tuple of three values (Red, Green, and Blue) must be passed to set a colour.

Examples:

# Set the colours of a Colour Source node's bi-gradient.
cs = flame.batch.create_node("Colour Source")
cs.mode = "Gradient"
cs.gradient_mode = 4
cs.quad_gradient_colour_top_left = (1.0, 0.0, 0.0)
cs.quad_gradient_colour_top_right = (0.0, 1.0, 0.0)
cs.quad_gradient_colour_bottom_left = (1.0, 0.0, 1.0)
cs.quad_gradient_colour_bottom_right = (1.0, 1.0, 1.0)

Update Commands: Resize

The Resolution List, Adaptive, and Scaling Presets resizing modes can be set on the following nodes: Action, Colour Source, Clip, Gradient, Matchbox, Pybox, Render, Resize, Text, and Write File.

Command: <PyNode>.resolution_mode

Type: Attribute

Description: 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

Examples:

# Set the Resolution mode of a node
resize = flame.batch.create_node("Resize")
resize.resolution_mode = "Scaling Presets"

Command: <PyNode>.scaling_presets_value

Type: Attribute

Description: Used to get or set the Scaling Presets value. A float between must be passed as an argument to set the value. The value represents the scaling percentage.

Examples:

# Set the Scaling Presets value of a node
resize = flame.batch.create_node("Resize")
resize.resolution_mode = "Scaling Presets"
resize.scaling_presets_value = 50.0

Command: <PyNode>.adaptive_mode

Type: Attribute

Description: 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

Examples:

# Set the Resolution of a node using the Adaptive mode
res = flame.PyResolution()
res.width = 1920
res.frame_ratio = 1.778
resize = flame.batch.create_node("Resize")
resize.resolution_mode = "Adaptive"
resize.adaptive_mode = "Height based on Ratio"
resize.resolution = res

New Commands for Subtitles

A PySubtitleTrack object has been added, allowing subtitles to be imported or exported and the Timeline FX to be created. The following functions were already available, but updated for PySubtitleTrack.

The <subtitles name> token can be used in the file_name argument of the export_as_srt_file() function.

Command: <PySequence>. import_subtitles_file()

Type: Function

Description: Used to import a Subtitles file in a Sequence. The following arguments must be passed:

  • file_name (mandatory) The path and name of the file to import.

    • A string must be passed.
  • file_type The file type must be specified for files that do not have the .srt or .txt extension.

    • A string must be passed.
  • align_first_event_to_clip_start Force the first event to be aligned with the clip start. True or False must be passed.

    • True: The first subtitle event is aligned to the first video event.
    • False (default value): The first subtitle event is set to its specified time value inside the file.
  • convert_from_frame_rate The frame rate of the imported file (for txt files only).

    • A valid FCM must be passed in a string.

Examples:

# Import a Subtitle file to the current sequence
seq = flame.timeline.clip
seq.import_subtitles_file(file_name = "/tmp/mySubtitleFile.srt")

Command: <PySequence>.subtitles

Type: Read-Only Property

Description: Return a list of PySubtitleTrack object.

Examples:

# Return how many Subtitles tracks a sequence has
print(len(flame.media_panel.selected_entries[0].subtitles))

Command: <PySequence>. subtitles_track

Type: Attribute

Description: Used to get or set the current Subtitles track of a Sequence. A PySubtitleTrack object must be passed to the attribute to set it as current.

None can be passed to disable the visibility of all Subtitles track.

Examples:

# Set the Subtitles visibility to the Subtitles 1 track
flame.timeline.clip.subtitles_track = flame.timeline.clip.subtitles[0]
# Disable the visibility of all Subtitles tracks
flame.timeline.clip.subtitles_track = None

Command: <PySubtitleTrack>.parent

Type: Read-Only Property

Description: Return the parent object of a Subtitles track. The parent object is always a PyClip or PySequence.

Examples:

# Get the parent object of a Subtitle track
parent = flame.timeline.clip.subtitles[0].parent

Command: <PySequence>. create_subtitle()

Type: Function

Description: Used to create a Subtitles track.

Examples:

# Create a Subtitles track
flame.timeline.clip.create_subtitle()

Command: <PySubtitle>.name

Type: Attribute

Description: Used to get or set the name of a Subtitles Track. A string must be passed to the attribute to change the name.

Examples:

# Change the name of a Subtitles track
flame.timeline.clip.subtitles[0].name = "New Name"

Command: <PySubtitleTrack>. segments

Type: Read-Only Property

Description: Return a list of PySegments located on a Subtitles track.

Examples:

# Return how many segments a Subtitles track has
print(len(flame.media_panel.selected_entries[0].subtitles[0].segments))

Command: <PySegment>. create_effect("Subtitle")

Type: Function

Description: Used to add a Subtitle Timeline FX to a Timeline Segment. "Subtitle" must be passed as the argument to the function.

Examples:

# Create a Subtitle FX on the currently selected segment.
flame.timeline.current_segment.create_effect("Subtitle")

Command: flame.delete (PySubtitleTrack)

Type: Function

Description: Used to delete a PySubtitleTrack. A <PySubtitleTrack> object must be passed as the argument to the function.

Examples:

# Delete the first Subtitles track in the current Sequence.
flame.delete(flame.timeline.clip.subtitles[0])

Command: <PySubtitleTrack>. export_as_srt_file()

Type: Function

Description: Used to export a Subtitles Track as a file. The following arguments must be passed:

  • file_name (mandatory) The path and name of the file to write. A string must be passed.

  • character_based_attributes Export the bold, italic, and underline attributes information. True of False must be passed

    • True (default value): The attributes information is exported.
    • False: No attributes information is exported.
  • export_colours Export the text colours information. True of False must be passed.

    • True: The text colours information is exported.
    • False (default value): No text colours information is exported.
  • exclude_colour Specify a colour to ignore. A CSS colour or value in hex must be passed as a string.

  • use_original_colours Reuse the hexadecimal or CSS colour names from the imported file. True of False mut be passed.

    • True: The colours information from the original file are not exported.
    • False (default value): The colours information from the original file are not exported.
  • use_original_alignment Reuse the alignment tokens from the imported file. True of False must be passed.

    • True: The alignments information from the original file are not exported.
    • False (default value): The alignments information from the original file are not exported.
  • export_alignments Export the alignment information. True of False must be passed.

    • True: The alignment information is exported.
    • False (default value): No alignment information is exported.
  • alignment_type Set the alignment style tokens. a or an must be passed as a string.

  • exclude_alignment Specify an alignment to ignore. One of the default alignments must be passed as a string.

Examples:

# Export the current Subtitles track from the current sequence
for subtitle_track in flame.timeline.clip.subtitles:
subtitle_track.export_as_srt_file(file_name = "/tmp/<subtitles name>.srt", character_based_attributes = True, export_colours = False)

What's New in 2024.1

Now that you can burn a Metadata Overlay on media exported by a Batch Write File node, you can also enable and disable it using the Python API. For more details on Metadata Overlay in Batch, see the What's New in 2024.1.

Command Type Description
<PyWriteFileNode>.metadata_overlay Attribute

Used to enable or disable the Overlay button of a Write File node.

One of the following must be passed as an argument:

  • True (Enabled)
  • False (Disabled)

Enable the Metadata Overlay for a Write File node:

wf = flame.batch.get_node("writefile01")
wf.metadata_overlay = True
<PyWriteFileNode>.metadata_overlay_context Attribute

Used to select the node that provides the information for the Metadata Overlay.

One of the following must be passed as an argument:

  • Write File (default value)
  • Context 1
  • Context 2
  • Context 3
  • Context 4
  • Context 5
  • Context 6
  • Context 7
  • Context 8
  • Context 9
  • Context 10

Enable the Metadata Overlay for a Write File node:

wf = flame.batch.get_node("writefile01")
wf.metadata_overlay = True
wf.metadata_overlay_context = "Context 1"

What's New in 2024

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

The Start Frame information is now available in Python Hooks as startFrame.

Command Type Description
light bulb<PyNode>.smart_replace Attribute

Used to get or set the status of the Smart Replace setting in the Render and Write File nodes.

Start Frame Workflow

These new properties and functions allow control over the start frame.

Command Type Description
<PySegment>.start_frame

<PyClip>.start_frame
Read-Only Property

Used to get the Start Frame information of a PyClip or PySegment.

Get the Start Frame information from a Clip

print(<PyClip>.start_frame)
<PySegment>.change_start_frame()

<PyClip>.change_start_frame()
Function

Used to set the Start Frame information of a PyClip or PySegment.

The following attributes can be passed:

  • start_frame: the new Start Frame value. An int must be defined. Mandatory.
  • use_segment_connections: define if the connected segments must be updated. True or False must be passed.

Set the Start Frame information of a clip

<PyClip>.change_start_frame(1001, use_segment_connections = True)

What's New in 2023.2

Renamed Python Directories

The new directory /opt/Autodesk/&lt;version&gt;/python_utilities replaces the old /opt/Autodesk/&lt;version&gt;/python_examples directory. It contains a scripts directory for useful custom actions, and an examples directory for examples of python API uses.

Custom Layout in the Context Menu

You now have more control over the placement of custom actions in context menus.

  • You can now place custom actions at the first level of a context 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/&lt;version&gt;/python_utilities/examples.

Warning: Set the minimumVersion attribute to 2023.2.0.0 on your actions so the new structure only applies to this version and not previous releases.

Directory as arg

You can now pass a directory as an argument to flame.import_clips().

  • If the destination is a Library, the directory structure is imported as-is.
  • If the destination is a Reel, every clip found in the hierarchy is loaded at the first level of the Reel.

Changes to flame.batch.create_group()

You no longer have to set the duration argument for the flame.batch.create_group() function.

  • If you set the duration, it is set as the Batch group duration.
  • If you do not set the duration, the Batch group has a duration of 100 up until a clip is added to the Schematic: this sets the duration to that of the clip's.

New Attributes and Functions

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:

  • True
  • False

Enable the Add to Workspace option in a Write File node

wf = flame.batch.create_node("Write File")
wf.add_to_workspace = True
light bulb<PyRenderNode>.in_mark

light bulb<PyRenderNode>.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

Set the Render node Out Mark using a PyTime

time = flame.PyTime(10)
wf = flame.batch.create_node("Render")
wf.out_mark = time
light bulb<PyBatch>.current_iteration_number

light bulb<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

iteration = flame.batch.current_iteration_number
print(iteration)
light bulb<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:

  • show_extension
    • True or False must be passed.
    • Used to display or not the part with the frame range and filename extension.
  • translate_path
    • True or False must be passed.
    • Used to apply the Media Location Path Translation.
  • frame
    • A number must be passed.
    • Used to get the path of a specific frame.

Get the system disk path set in a selected Write File node

wf = flame.batch.current_node.get_value()
path = get_resolved_media_path(show_extension = False, translate_path = True)
print(path)
<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:

  • The channel to be modified. Either the channel index or current name can be used.
  • The new channel name.
    • For the Render node, the name of the Matte channel must be specified as well.

Change the first two channels of a Write File node

wf = flame.batch.get_node("writefile")
wf.set_channel_name(0, "Beauty")
wf.set_channel_name("rgb2", "Z")

Change the first two channels of a Render node

rn = flame.batch.get_node("render")
rn.set_channel_name(0, ("Beauty","Beauty_alpha"))
<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

wf = flame.batch.get_node("writefile")
print(wf.channels) 

What's New in 2023.1

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

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.

API New Attributes and Functions

Flame Family includes updates to the API in the following components:

  • Batch
  • MediaHub
  • Clips and Segments
  • Look node
  • Media Panel
  • Timeline
  • Transitions

General

Command Type Description
light bulbflame.messages.show_in_dialog() Function

Used to open a message dialog box and offer options to users. The following arguments can be passed:

  • title (mandatory)
    • The title of the message window. A string must be passed.
  • message (mandatory)
    • The message body. A string must be passed.
  • type (mandatory)
    • The message window's type. One of the following must be passed:
      • info
      • error
      • warning
      • question
  • buttons (optional)
    • Up to three user defined options in the form of buttons can be offered. The right most option is displayed in blue and can be selected using the Enter shortcut.
    • An additional option can be defined outside of the first list of buttons. That option is displayed on the left and can be selected the ESC (Flame) or ~ (Smoke Classic) shortcut.

Example:

Display a Dialog offering default colours for a new Reel.

reelgroup = flame.projects.current_project.current_workspace.desktop.reel_groups[0]

dialog = flame.messages.show_in_dialog( title ="Create Coloured Reel", message = "Which colour coding do you want to apply to your new Reel?", type = "question", buttons = ["Red", "Green", "Blue"], cancel_button = "Cancel")

if dialog == "Red": red = reelgroup.create_reel("red") red.colour = (0.75, 0.0, 0.0) if dialog == "Green": green = reelgroup.create_reel("green") green.colour = (0.0, 0.75, 0.0) if dialog == "Blue": blue = reelgroup.create_reel("blue") blue.colour = (0.0, 0.0, 0.75) if dialog == "Cancel": pass

flame.messages.show_in_console() Function

light bulbUsed to print a message in the message console at the bottom left of the screen. The following arguments can be passed:

  • message (Mandatory)
    • The message to be printed in the console.
  • type
    • The message type. Must be one of:
      • error
      • warning
      • info
  • time
    • The amount of time (in seconds) the message must remain displayed on screen.

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.

Batch

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.

File Browser

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:

  • title
    • The title of the Browser window. A string must be passed.
  • default_path
    • The path set in the Browser. A string must be passed.
  • extension
    • Used to display only files with a defined extension. A string must be passed.
  • select_directory
    • Allows a directory to be selected, not only Files. One of the following must be passed:
      • True
      • False
  • multi_selection
    • Allows multiple files/directories to be selected. One of the following must be passed:
      • True
      • False
  • include_resolution
    • Enables the display of the resizing controls. One of the following must be passed:
      • True
      • False
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.

MediaHub

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:

  • Fill
  • Crop Edges
  • Letterbox
  • Centre/Crop
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:

  • Lanczos
  • Shannon
  • Gaussian
  • Quadratic
  • Bicubic
  • Mitchell
  • Triangle
  • Impulse
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:

  • Same as Source
  • Project Resolution
  • Custom Resolution
  • Any resolution presets available.
    • Example: "RED 4.5K 16x9 (4224 x 2376)"
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.

  • From Source
  • A float value between 0.01 and 100.00 must be passed 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.

  • 8
  • 10
  • 12
  • 16
  • 32
  • From Source
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.

  • F1
  • F2
  • P
  • From Source
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:

  • True.
    • Sets the option to "File Sequence"
  • False
    • Sets the option to "Frames"
light bulbflame.import_clips() Function

Use one of the following to import a file sequence as a single clip:

  • flame.import_clips( [ "file.0001.exr", "file.0002.exr", "file.0003.exr" ], destination )
  • flame.import_clips( [ "file.[0001-0003].exr" ], destination )
  • flame.import_clips( "file.[0001-0003].exr", destination )

Clip & Segment

Command Type Description
<PyClip>.get_colour_space

<PySegment>.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.

Transitions

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.

Look

Command Type Description
<PyNode>.slope_red

<PyNode>.slope_green

<PyNode>.slope_blue
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

<PyNode>.offset_green

<PyNode>.offset_blue
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

<PyNode>.power_green

<PyNode>.power_blue
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:

  • No Clamping
  • ASC v1.2
<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:

  • True
  • False

Media Panel

Command Type Description
light bulb<PyArchiveEntry>.clear_colour() Function

Used to remove the colour coding on every entry of the Media Panel that can be colour coded.

Timeline

Command Type Description
<PyClip>.cut()

<PyTrack>.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

time = flame.PyTime(10)
.cut(time)

Create a cut on a single track at 10:00:01:00

time = flame.PyTime("10:00:01:00", "23.976 fps")
.cut(time)
<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:

  1. Contain selected segments, if any.
  2. If there is no selected segment, contain what is between the in and out marks.
  3. If there is only one mark, contain from start to out or from in to end.
  4. If there is no selection and no marks then all segments are contained.
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

<PySequence>.padding_end
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

time = flame.PyTime("09:59:00:00", "23.976 fps")
<PySequence>.padding_start = time
<PySegment>.create_unlinked_segment() Function

Used to turn a Gap into an unlinked media segment. The following arguments can be passed:

  • source_name
    • A string must be passed.
  • tape_name
    • A string must be passed.
  • start_time
    • A PyTime or an integer number must be passed.
  • source_duration
    • A PyTime, a number of frames, or "Infinite" must be passed.
  • head
    • An integer number must be passed.
  • file_path
    • A string must be passed.
  • source_audio_track
    • An integer number must be passed.
  • width
    • An integer number must be passed. 0 can be used to set it to the sequence's width.
  • height
    • An integer number must be passed. 0 can be used to set it to the sequence's height.
  • ratio
    • A float number must be passed. 0.0 can be used to set it to the sequence's frame ratio.
  • bit_depth
    • One of 8, 10t, 12, 16, or 32 must be passed. 0 can be used to set it to the sequence's bit depth.
  • scan_mode
    • One of P, F1, F2, or Same As Sequence must be passed.
  • frame_rate
    • One of 60 fps, 59.54 NDF, 59.94 DF, 50 fps, 30 fps, 29.97 NDF, 29.97 DF, 25 fps, 24 fps, 23.976 fps, or Same As Sequence must be passed.
<PySegment>.source_audio_track Read-Only Property Used to get the audio track from the source media.

Transitions

Command Type Description
<PyTrack>.insert_transition() Function

Used to create a transition on a <PyTrack>. The following arguments can be passed:

  • record_time
    • At what frame the transition is added. A PyTime must be passed.
  • type
    • The transition type. One of the following must be passed.
      • Dissolve
      • Cut
      • Wipe
      • Action
      • OpenFX
      • Matchbox
      • Fade
  • duration
    • The transition duration. An integer number must be passed.
  • alignment
    • The transition alignment. One of the following must be passed.
      • Centered
      • From Cut
      • Up To Cut
      • Custom
  • in_offset
    • The offset between the record_time (cut point) and the start time of the transition. An integer number must be passed.
  • sync
    • Used to apply changes to all transitions part of a sync group (only available for Dissolve or Fade). One of the following must be passed:

      • True
      • False

Example:

Create a new up to cut transition at frame 24 in a Sequence

time = flame.PyTime(24)
track = flame.timeline.clip.versions[0].tracks[0]
track.insert_transition(record_time = time, type = "Dissolve", duration = 10, alignment = "Centred")
<PyTransition>.set_transition() Function

Used to set attributes on an existing transition. The following arguments can be passed:

  • type
    • The transition type. One of the following must be passed.
      • Dissolve
      • Cut
      • Wipe
      • Action
      • OpenFX
      • Matchbox
      • Fade
  • duration
    • The transition duration. An integer number must be passed.
  • alignment
    • The transition alignment. One of the following must be passed.
      • Centered
      • From Cut
      • Up To Cut
      • Custom
  • in_offset
    • The offset between the record_time (cut point) and the start time of the transition. An integer number must be passed.

Example:

Change an existing cut into a dissolve

cut = flame.timeline.clip.versions[0].tracks[0].transitions[5]
cut.set_transition(type = "Dissolve", duration = 10, alignment = "Centred")
<PyTransition>.slide() Function

Used to slide a transition. The following arguments can be passed:

  • offset
    • The amount number of frame to slide the transition by. An integer number must be passed.
  • sync
    • Used to apply changes to all transitions part of a sync group (only available for Dissolve or Fade). One of the following must be passed:

      • True
      • False
<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.

  • Centered
  • From Cut
  • Up To Cut
  • Custom
<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.

What's New in 2023

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

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.

GMask Tracer & Image

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.

API New Attributes and Functions

Flame Family includes updates to the API in the following components:

  • MediaHub
  • Media Panel
  • Sequence
  • Timeline

MediaHub

Command Type Description
light bulbflame.mediahub.files.options.multi_channel_mode Attribute

Sets the Multi-Channel mode in the MediaHub. The possible modes are:

  • Multi-Channel Clip
  • Include Alpha Clip
  • Ignore Alpha Channel
  • Create Matte Container
  • Matte Container With Comp
  • Matte Container (Full)

Example:

Set the multi-channel mode

flame.mediahub.files.options.multi_channel_mode = "Multi-Channel Clip"
flame.mediahub.files.options.cache_mode Attribute

Set the Media Cache mode in the MediaHub. The possible modes are:

  • True (Cache is enabled)
  • False

Example:

Set the media caching mode

flame.mediahub.files.options.cache_mode = True
flame.mediahub.files.options.proxies_mode Attribute

Set the Media Proxies mode in the MediaHub. The possible modes are:

  • True (Proxies in enabled)
  • False

Example:

Set the media proxies mode

flame.mediahub.files.options.proxies_mode = True
flame.mediahub.files.options.cache_and_proxies_all_versions Attribute

Set the Clip Version mode in the MediaHub. The possible modes are:

  • True (All Versions is selected)
  • False (Current Version is selected)

Example:

Set the clip version mode

flame.mediahub.files.options.cache_and_proxies_all_versions = True

Media Panel

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

library = <PyLibrary>
<PyDesktop>.destination = library
<PyReelGroup>.save()

<PyBatch>.opened

<PyLibrary>.opened

Read-Only Property Returns True if a Batch Group or Library is opened and False if it's closed.  

Sequence

Command Type Description

<PySequence>.insert()

<PySequence>.overwrite()

Function

Inserts or Overwrites a source clip in a Sequence. The following arguments can be set:

  • source_clip: A PyClip or a PySequence must be specified. Mandatory.
  • insert_timeoroverwrite_time: A PyTime must be specified.
  • destination_track: A PyTrack or a PyAudioTrack Channel must be specified.

Examples

Overwrite the selected clip inside a sequence

clip = flame.media_panel.selected_entries[0]
sequence = <PySequence>
overwrite_time = <PyTime>
track = sequence.versions[0].tracks[0]
sequence.overwrite(clip, overwrite_time, track)

Insert an Audio Track inside a sequence

clip = flame.media_panel.selected_entries[0]
sequence = <PySequence>
insert_time = <PyTime>
track = sequence.audio_tracks[0].channels[0]
sequence.insert(clip, insert_time, track)

<PySequence>.copy_selection_to_media_panel()

<PySequence>.extract_selection_to_media_panel()

<PySequence>.lift_selection_to_media_panel()

Function

Copy the selected segments to a destination in the Media Panel. The following arguments can be set:

  • destination: A PyReel, PyLibrary, or PyFolder must be specified. Mandatory.
  • duplicate_action: Specify the add or replace behaviour if an object of the same name is present in the destination. Add is applied if the argument is not set.

Example:

Copy the selected segment to the Media Panel

reel = <PyReel>
<PySequence>.copy_selection_to_media_panel(reel, replace)

Timeline

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.delete(<PySegment>)
flame.timeline.type Attribute

Focuses a Timeline tab in the user interface. The possible arguments are:

  • Source
  • Sequence
  • Container

Example:

Focus the sequence tab in the Timeline

flame.timeline.type = "Sequence"
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

clip = flame.timeline.clip
   clip.name = "new name"

flame.timeline.current_segment

flame.timeline.current_marker

flame.timeline.current_effect

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

segment = flame.timeline.current_segment
segment.name = "new name"

<PySegment>.set_gap_colour()

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

<PySegment>.set_gap_colour(0.0,0.5,0.0)

<PySegment>.match()

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:

  • destination: A PyReel, PyLibrary or PyFolder can be specified. Mandatory.
  • preserve_handle: Used to enable or disable the Preserve Handle option. Must be set to True or False.
  • use_sequence_info: Used to enable or disable the Use Sequence Info option. Must be set to True or False.
  • include_nested_content: Used to enable or disable the Include Nested Content option. Must be set to True or False.
  • include_timeline_fx: Used to enable or disable the Include Timeline FX option. Must be set to True or False.

Example:

Match a Timeline segment to a Reel

reel = <PyReel>
<PySegment>.match(reel, include_timeline_fx = False)

<PySegment>.smart_replace()

<PySegment>.smart_replace_media()

Function

Replaces a Timeline segment with a source clip. A PyClip must be specified.

  • smart_replace()replaces the entire segment.
  • smart_replace_media()replaces only the media. Timeline FX present on the PySegment are kept.

Example:

Replace the media of a Timeline segment

clip = flame.media_panel.selected_entries[0]
<PySegment>.smart_replace_media(clip)

<PySegment>.trim_head()

<PySegment>.trim_tail()

<PySegment>.slip()

Function

Applies Trim, Slip, and Slide editorial operations. The following arguments can be set:

  • offset: The amount of frame applied to the operation. Mandatory.
  • ripple: The equivalent of the Ripple button in the Timeline interface. False is applied by default if the argument is not specified.
  • sync: The equivalent of the Sync button in the Timeline interface. False is applied by default if the argument is not specified.
  • keyframes_move_mode: The equivalent of the Shift/Pin/PropSync drop-down button in the Timeline interface. Shift is applied by default if the argument is not specified.

Example:

Trim the head of a Timeline segment

<PySegment>.trim_head(offset = 10, ripple = False, sync = True, keyframes_move_mode = "Shift" )

<PySegment>.slide_keyframes()

<PyTimelineFX>.slide_keyframes()

Function

Applies the Slide Keyframe editorial operation. The following arguments can be set:

  • offset: The amount of frame applied to the operation. Mandatory.
  • sync(only valid on a PySegment): The equivalent of the Sync button in the Timeline interface. False is applied by default if the argument is not specified.

Example:

Slide keyframes of a Timeline segment

<PySegment>.slide_keyframes(offset = 10, sync = False)

<PySegment>.copy_to_media_panel()

<PyTrack>.copy_to_media_panel()

<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:

  • destination: A PyReel, PyLibrary or PyFolder must be specified. Mandatory.
  • duplicate_action: Specify the add or replace behaviour if an object of the same name is present in the destination. Add is applied if the argument is not set.

Example:

Copy a segment to a Reel

reel = <PyReel>
<PySegment>.copy_to_media_panel(reel, replace)

<PySegment>

Read-Only Property

The following PyClip/PySequence information can be obtained through the PySegment properties.

PySegment (source, gap, bfx):

  • source_width
  • source_height
  • source_bit_depth
  • source_ratio
  • source_scan_mode
  • source_colour_primaries
  • source_matrix_coefficients
  • source_transfer_characteristics

PySegment with source media:

  • source_cached
  • source_has_history
  • source_unlinked
  • source_essence_uid
  • source_uid
  • original_source_uid

PySegment on an audio track:

  • source_sample_rate

Example:

Get the Width and Height of the current segment

segment = <PySegment>
print(segment.source_width, segment.source_height)

<PySegment>.rgb_channels

<PySegment>.matte_channels

Read-Only Property

Return the lists of RGB and Matte channels.

 

<PySegment>.rgb_channel

<PySegment>.matte_channel

Read-Only Property

Return the current RGB and Matte channels.

 

<PySegment>.matte_mode

Read-Only Property

Return the Matte mode. The possible values are:

  • Follow RGB
  • No Matte
  • Custom Matte
 

<PySegment>.set_rgb_channels()

<PySegment>.set_matte_channels()

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:

  • channel_name: Selects a channel using its name.
  • channel_index: Selects a channel using its index in the list.
  • scope: Sets the scope among connected segments. The modes are:
    • No Sharing
    • Follow Preferences
    • Follow Source Sharing
    • Follow Connected Segments

Also the matte_mode can be set for the Matte channel. The modes are:

  • Follow RGB
  • No Matte
 

<PyMarker>.tokenized_name

<PyMarker>.dynamic_name

<PyMarker>.tokenized_comment

<PyMarker>.dynamic_comment

<PySegment>.tokenized_name

<PySegment>.dynamic_name

<PySegment>.tokenized_shot_name

<PySegment>.dynamic_shot_name

<PySegment>.tokenized_comment

<PySegment>.dynamic_comment

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

<PySegment>.tokenized_name = "<segment>_<record frame>"

Enable the Dynamic setting in the Marker's comment field

<PyMarker>.dynamic_comment = "True"

What's New in 2022

Moving to Python 3.7

Flame, Flare and Flame Assist now use Python 3.7. This means that you need to convert your Python 2 scripts to Python 3.

The process for converting your scripts from Python 2 to Python 3 is outside the scope of this documentation. But here a few pointers for doing just that.

  • Read the Python Software Foundation Porting Python 2 Code to Python 3 documentation. Get familiar with the process of porting your scripts to Python 3, and with Python 3 differences from Python 2.
  • Update your scripts to Python 3 using Futurize or Modernize.

Futurize and Modernize cannot fix everything automatically: you still need to verify your script compiles correctly.

To test to see if your script compiles and will run in Python 3:

  1. From the command line, run:

    python3 -m compileall <your_script>
  2. In the shell, look at the compilation feedback:

    • If there are no compilation errors, chances are your script is fine. Try running it in Flame.
    • If the compiler complains, you'll need to go in and fix your script.

Python Console Update

The Python console, Flame menu > Python > Python Console, now benefits from the following improvements:

  • Modify the indentation of multiple lines: select the lines and then press Tab (increase indent) or Shift-Tab (decrease indent).
  • Comment and uncomment multiple lines with Control + / (Linux) or Command + / on (macOS).
  • New lines start at the same indentation level as the previous one.
  • New lines after a : character start with a 4-space indentation.
  • Indentation made with Tab are converted to spaces.
  • Saved scripts now default to the .py extension.
  • The new colour scheme improves legibility.

Python API Updates

Expanded PyActionNode Reach

Every functions, attributes, and properties available in the PyActionNode object are now available in GMask Tracer and Image.

New Sample Script

The script path_of_selected_clips.py shows how to get the path and file name of a media file in MediaHub.

Support for //

The // operator is now supported in the Python API. Python 3 differentiates between / (float division) and // (integer division).

New in Action

Command Type Description Example
<PyActionNode>.object_dual_mode Attribute

Set the Object menu display mode to Single or Dual.

One of the following must be passed as an argument:

  • True
  • False

Set the Object menu to Dual display mode.

<PyActionNode>.object_dual_mode = True

<PyActionNode>.left_tabs

<PyActionNode>.right_tabs

<PyActionNode>.all_tabs

Read-only property

Get a list of tabs currently displayed in the Object menu.

  • `left_tabs` and `right_tabs` must be used in the Dual display mode.
  • `all_tabs` must be used in the Single display mode.

Get the list of tabs currently displayed in the Left panel of the Object menu set in Dual mode.

print(<PyActionNode>.left_tabs)

<PyActionNode>.current_left_tab

<PyActionNode>.current_right_tab

<PyActionNode>.current_tab

Attribute

Set a tab as current in the Object menu.

  • `current_left_tab` and `current_right_tab` must be used in the Dual display mode.
  • `current_tab` must be used in the Single display mode.

The name of a tab must be passed as an argument.

Select the Default Camera tab in the Object menu's single panel mode.

<PyActionNode>.current_tab = "Default"

New in Action/Image/Gmask Tracer

Command Type Description
flame.duplicate(<PyObject>) Function

The standard flame.duplicate() function can duplicate an object inside a PyActionNode, PyImageNode, and PyGMaskTracerNode.

New in Media Panel

Command Type Description Example

<PyDesktop>.children

<PyReelGroup>.children

<PyReel>.children

<PyLibrary>.children

<PyFolder>.children

Read-only property

Get a list of children <PyObjects> located under the specified <PyObject> in the Media Panel Hierarchy.

Get a list of children located under the Desktop.

print(flame.projects.current_project.current_workspace.desktop.children)

<PyMediaPanel>.copy()

<PyMediaPanel>.move()

Function

The Duplicate Name Check dialog is now bypassed when the copy and move functions are used. The `duplicate_action` argument can be set to either add or replace. The Add option will be executed if the argument is not set.

Replace a clip while moving another clip with the same name to that Reel.

clip = flame.project.current_project.current_workspace.desktop.reel_groups[0].reels[3].clips[0]
reel = flame.project.current_project.current_workspace.desktop.reel_groups[0].reels[2]
flame.media_panel.move(source_entries = clip, destination = reel, duplicate_action = 'replace')

<PyReel>.type

Read-only property

Used to get a Reel's type. The possible type are:

  • Reel
  • Schematic
  • Sequences
  • Shelf

Print a Reel's type.

print(<PyReel>.type)

New in Timeline

Command Type Description
<PySegment>.create_connection() Function

Used to create a connected segment connection on a segment. Only works for segments inside a Reel Group.

<PySegment>.remove_connection() Function

Used to remove a connected segment connection on a segment. Only works for segments inside a Reel Group.

<PySegment>.sync_connected_segments() Function

Used to sync the connected segments. Only works for segments inside the same Reel Group.

<PySegment>.connected_segments() Function

Returns a list of connected segments. Only works for segments inside the same Reel Group.

<PySegment>.duplicate_source() Function

Used to duplicate the source media of a segment.

<PySegment>.shared_source_segments() Function

Returns a list of segments sharing the same source media.

New TimelineFX

Command Type Description
<PyTimelineFx>.sync_connected_segments() Function

Used to sync a specific Timeline FX on connected segments inside the same Reel Group. This cannot be called on a Timewarp.

What's New in 2021.2

New in the Python API for Flame Family 2021.2 Update:

  • New functions for MediaHub: set or get MediaHub file or archive paths.

  • New attributes for the following Batch nodes:

    • Deinterlace
    • Difference Matte
    • Exposure
    • Monochrome
    • Write File

MediaHub

Command Type Description

flame.mediahub.files.get_path()

flame.mediahub.files.set_path()

flame.mediahub.archives.get_path()

flame.mediahub.archives.set_path()

Function

Used to get or set the path of the MediaHub in the Files and Archives tabs.

A path must be passed as an argument when the path is set.

Batch - Deinterlace

Command Type Description
<PyNode>.dominance Attribute

Used to get or set the dominance. One of the following must be passed as an argument to set the attribute:

  • Auto
  • Field 1
  • Field 2
<PyNode>.interpolation Attribute

Used to get or set the interpolation. One of the following must be passed as an argument to set the attribute:

  • True
  • False

Batch - Difference Matte

Command Type Description
<PyNode>.tolerance_red

<PyNode>.tolerance_green

<PyNode>.tolerance_blue

<PyNode>.tolerance_y

<PyNode>.tolerance_u

<PyNode>.tolerance_v
Attribute

Used to get or set the Tolerance values. A number must be passed as an argument when the attribute is set.

<PyNode>.softness_red

<PyNode>.softness_green

<PyNode>.softness_blue

<PyNode>.softness_y

<PyNode>.softness_u

<PyNode>.softness_v
Attribute

Used to get or set the Softness values. A number must be passed as an argument when the attribute is set.

<PyNode>.gain_rgb

<PyNode>.gain_yu

Attribute

Used to get or set the Gain value. A number must be passed as an argument when the attribute is set.

<PyNode>.lift_rgb

<PyNode>.lift_yuv
Attribute

Used to get or set the Lift value. A number must be passed as an argument when the attribute is set.

<PyNode>.channel_red

<PyNode>.channel_green

<PyNode>.channel_blue

<PyNode>.channel_y

<PyNode>.channel_u

<PyNode>.channel_v

Attribute

Used to get or set the status of a channel. One of the following must be passed as an argument to set the attribute:

  • True (to enable the channel)
  • False (to disable the channel)
<PyNode>.space_rgb Attribute

Used to select the colour space. One of the following must be passed as an argument to set the attribute:

  • True (to select RGB)
  • False (to select YUV)

Batch - Exposure

Command Type Description

<PyNode>.input_data_type

Attribute

Used to get or set the input data type.

One of the following must be passed as an argument to set the attribute:

  • Video
  • Logarithmic
  • Linear (Scene referred)
<PyNode>.exposure_red

<PyNode>.exposure_green

<PyNode>.exposure_blue
Attribute

Used to get or set the red, green and blue exposure values.

A number between -10 000 and 10 000 must be passed as an argument when the attribute is set.

<PyNode>.contrast_red

<PyNode>.contrast_green

<PyNode>.contrast_blue
Attribute

Used to get or set the red, green and blue contrast values.

A number between -10 000 and 10 000 must be passed as an argument when the attribute is set.

<PyNode>.pivot_red

<PyNode>.pivot_green

<PyNode>.pivot_blue
Attribute

Used to get or set the red, green and blue pivot values.

A number between 0.0 and 1.0 must be passed as an argument when the attribute is set.

Batch - Monochrome

Command Type Description

<PyNode>.channel

Attribute

Used to get or set the channel.

One of the following must be passed as an argument to set the attribute:

  • Luminance
  • Red
  • Green
  • Blue
  • Y
  • U
  • V
  • Hue
  • Saturation
  • Lightness

Batch - Write File

Command Type Description

<PyNode>.level

Attribute

Used to get or set the Png compression level of the Write File node.

A number between 0 and 9 must be passed as an argument when the attribute is set.

What's New in 2021.1

The Python API is augmented with additional methods and properties in the Flame module, Action, Batch, and Timeline groups and segments.

Flame

Command

Type

Description

Example

flame.get_current_tab()

Function

Get the currently selected tab.

Print which tab is currently selected in the software:

print(flame.get_current_tab())

flame.set_current_tab()

Function

Open the tab.

One of the following can be passed as an argument:

  • MediaHub
  • Conform
  • Timeline
  • Effects
  • Batch
  • Tools

Go to the Timeline Tab:

flame.set_current_tab("Timeline")

Action

Command

Type

Description

Example

<PyCoNode>.parents()

Read-only Property

Get the list of parent nodes for a node.

One of the following must be passed as the link type:

  • Default (a normal link)
  • look at
  • gmask
  • gmask exclusive
  • light
  • light exclusive
  • mimic

Returns an empty list if there is no parent for the given link.

Print the name of the parent nodes:

action = flame.batch.get_node("action100")
axis3 = action.get_node("axis3")
for node in axis3.parents("default"):
    print(node.name)

<PyCoNode>.children()

Read-only Property

Get the list of children for a node.

One of the following must be passed as the link type:

  • Default (a normal link)
  • look at
  • gmask
  • gmask exclusive
  • light
  • light exclusive
  • mimic

Returns an empty list if there are no children for the given link.

Print the name of the children nodes:

action = flame.batch.get_node("action100")
axis3 = action.get_node("axis3")
for node in axis3.children("default"):
    print(node.name)

<PyActionNode>.disconnect_nodes()

Function

Break a link between two Action nodes.

Three arguments must be passed:

  • The parent node
  • The children node
  • The link type.

One of the following must be passed as the link type:

  • Default (a normal link)
  • look at
  • gmask
  • gmask exclusive
  • light
  • light exclusive
  • mimic

Disconnect a link between two nodes in Action:

action = flame.batch.create_node("Action")
axis = action.create_node("Axis")
light = action.create_node("Light")
action.connect_nodes(axis, light, "default")
action.disconnect_nodes(axis, light, "default")

Batch

Command

Type

Description

Example

flame.batch.disconnect_node()

Function

Disconnect the links from a node's input sockets.

Disconnect a single input link from a node:

image = flame.batch.get_node("image11")
flame.batch.disconnect_node(image, "Matte")

Disconnect all input links from a node:

image = flame.batch.get_node("image11")
for socket in image.input_sockets:
    flame.batch.disconnect_node(image, socket)

Timeline Groups

Command

Type

Description

Example

<PySequence>.create_group()

Function

Create a group in a clip or sequence.

A string must be passed as an argument to define the name of the group.

Create a group in a clip:

<PySequence>.create_group("MyGroup")

<PySequence>.groups

Read-only Property

Get the list of groups available in a clip or sequence.

Print the list of groups of a Clip:

for group in <PySequence>.groups:
    print(group.name)

<PySequenceGroup>.segments

Read-only Property

Get the list of timeline segments that are part of a group.

Print all the segments included in a group:

for segment in <PySequence>.groups[0].segments:
    print(segment.name)

<PySequenceGroup>.parent

Read-only Property

Get the parent clip or sequence object of a group.

Print the name of a group's parent clip:

print(<PySequence>.groups[0].parent.name)

<PySequenceGroup>.name

Attribute

Get or set the same of a group.

A sting must be passed as an argument when the name is set.

Rename a Group:

<PySequence>.groups[0] = "New Name"

<PySequenceGroup>.add()

Function

Add a segment to a group.

One of the following can be passed as an argument:

  • A PySegment object.
  • A list of PySegment objects.

Add a Timeline segment to a group:

segment = <PyTrack>.segments[0]
<PySequence>.groups[0].add(segment)

<PySequenceGroup>.remove()

Function

Remove a segment from a group.

One of the following can be passed as an argument:

  • A PySegment object.
  • A list of PySegment objects.

Remove a Timeline segment from a group:

segment = <PyTrack>.segments[0]
<PySequence>.groups[0].remove(segment)

<PySegment>.groups

Read-only Property

Get a list of groups a timeline segment is part of.

Print the name of all the groups a segment is part of:

for group in <PyTrack>.segments[0].groups:
    print(group.name)

Timeline Segments

Command

Type

Description

Example

<PySegment>.type

Read-only Property

Get the type of a PySegment object.

One of the following is returned:

  • Video Segment
  • Audio Segment
  • Video Container
  • Audio Container
  • Unlinked Video
  • Unlinked Audio
  • Matte Container
  • Batch FX
  • Gap
  • Gap Batch FX
  • Gap Timeline FX
  • Gap HDR FX

Print the type of a Timeline segment:

print(<PySegment>.type)

<PySegment>.head

<PySegment>.tail

Read-only Property

Get the number of head of tail frames of a PySegment object.

Print the head and tail information of all segments on a track:

index = 1
for segment in <PyTrack>.segments:
    print("Segment " + str(index))
    print("Head = " + str(segment.head))
    print("Tail = " + str(segment.tail))
    print("----")
    index += 1

What's New in 2021

The Python API is augmented with additional methods in Action, Batch, and Project management.

Action

<PyActionNode>.selected_nodes can now be used to deselect all nodes in Action by passing an empty list as argument.

Command Type Description Example
<PyCoNode>.pos_x

<PyCoNode>.pos_y
Attribute Used to set or get the position of a node in the Action schematic. Requires an integer. Set the position of a node in the Action Schematic:

axis = <PyActionNode>.create_node("Axis")

axis.pos_x = 100

axis.pos_y = 50
<PyActionNode>.cursor_position Read-Only Property Return a list that provides the cursor position in the Action Schematic. The first value is the x position. The second value is the y position. This is useful in the context of the custom actions as it is now possible to add nodes in the desired location. Add a node under cursor

cursor = <PyActionNode>.cursor_position

axis = <PyActionNode>.create_node("Axis")

axis.pos_x = cursor[0]

axis.pos_y = cursor[1]

Batch - Clip

Command Type Description Example
<PyClipNode> Read-Only Property <PyClip> properties accessible from the Media Panel are now accessible from its corresponding <PyClipNode> object in the Batch Schematic. Get the bit depth information from a Clip node

clip = flame.batch.get_node("clip99").clip

print(clip.bit_depth)

Batch - General

Command Type Description Example
flame.batch.cursor_position Read-Only Property Returns a list that provides the cursor position in the Batch Schematic. The first value is the x position. The second value is the y position. This is useful in the context of the custom actions as it is now possible to add nodes in the desired location. Add a node under cursor

cursor = flame.batch.cursor_position

mux = flame.batch.create_node("Mux")

mux.pos_x = cursor[0]

mux.pos_y = cursor[1]

Batch - Write File

Command Type Description Example
<PyNode>.compress_mode Attribute Used to set or get the Compress mode of a Write File node. One of the following options must be passed as an argument: Uncompressed, RLE, LZW, Scanline, Multi_Scanline, PIZ, PXR24, B44, B44A, DWAA, DWAB, PIXSPAN, Packed. Set a Write Node's Compress mode

wf = flame.batch.create_node("Write File")

wf.compress_setting = "PIZ"
<PyNode>. colour_type Attribute Used to set or get the DPX Colour Type of a Write File node. One of the following options must be passed as an argument: Printing Density, Unspecified, SMPTE 274M, CCIR 709-4, CCIR 601 (625), CCIR 601 (525), NTSC, PAL Set a Write Node's DPX Colour Type

wf = flame.batch.create_node("Write File")

wf.colour_space = "CCIR 601 (625)"

Project

Command Type Description Example
flame.project.current_project.nickname Read-Only Property Returns the Project's Nickname. Print the Project's Nickname

print(flame.project.current_project.nickname)

What's New in 2020.2

Here are the updates to the Python API for this 2020.2 Update release.

  • Attributes for the Comp and Burn-In Letterbox Timeline FX can now be modified on a timeline segment.

  • Python functions can be executed asynchronously at an undetermined time in Flame's idle loop using the flame.schedule_idle_event().

    • The software automatically triggers the Flame idle loop when it doesn't register any activity (pointer movement, playback, rendering, etc.) for a given period of time. Everything waiting for the software to be in idle mode will be executed the moment the next idle loop starts.
    • You cannot interact with the software until the script finishes its execution. You'll have to wait if the script takes a long time to run.
    • A script named watch_folder.py shows how to use this function. You can find it in the python examples directory, /opt/Autodesk/flame_2020.2/python_examples.
  • <PyTimelineFx>.save_setup(): Save a Timeline FX setup.

  • <PyTimelineFx>.load_setup(): Load a Timeline FX setup.

What's New in 2020.1

Here are the updates to the Python API for this 2020.1 Update release.

  • flame.execute_shortcut(): Execute the specified keyboard shortcut.

Updates to Action:

  • <PyNodeObject>.cache_range(): You can now cache range on Z-Depth and Normals map, in addition to the previously accessible Motion Vectors map.
  • Compass Node: Use a Compass node in Action. Create it with <PyCoNode>.encompass_nodes.

Updates to Batch:

  • flame.batch.create_node(): Create Matchbox, Pybox, or Sparks nodes, specifying the shader, handler, or Spark as required.

  • <PyNode>.shader_name: Get the name of the shader loaded in a Matchbox node.

  • <PyNode>.handler_name: Get the name of the handler loaded in a Pybox node.

  • <PyNode>.sparks_name: Get the name of the Spark loaded in a Sparks node.

  • <PyOpenFX: Create an OpenFX node and then load an Open FX plug-in.

  • <PyNode>.bypass: Bypass nodes in the Batch schematic.

  • MUX improvements:

More control over the Media Panel:

  • <PyObject>.selected: Objects derived from PyArchiveEntry now have the selected property used to select the object.

  • PyMediaPanel controls the state and contents of the Media Panel.

    • <PyMediaPanel>.move(): Move a media panel entry to a different location.
    • <PyMediaPanel>.copy(): Copy a media panel entry to a different location.
    • <PyMediaPanel>.selected_entries: Set or get the list of selected entries in the Media Panel.
    • Additional attributes allow you to set the layout of the Media Panel.

Changes to the PyProject object:

  • flame.projects is now equivalent to flame.project.

Now with User (Profile) management:

Deprecated Entities

The property <PyProject>.current_name is now deprecated and replaced with <PyProject>.name.

What's New in 2020

We've augmented the Python API with the following:

  • <PyObject>.parent: Get the parent of the object.
  • flame.import_clips(): Import a clip to a specified PyReel, PyLibrary, PyFolder or PySharedLibrary.

New Batch Nodes are now available with the Python API:

To support the import of UDIM textures, some <PyActionNode> functions are augmented:

To help you implement these new features, the following examples have been added to the /opt/Autodesk/<application_version>/python_examples folder:

  • clean_batch_iteration.py
  • cache_motion_vectors.py
  • import_using_qt_file_dialog.py

What's New in 2019.2

New Classes:

  • PyMarker: Get and set information on Markers and Segment Markers.
  • PySegment: Access a sequence's segment, adding Timeline FX or read its source path.
  • PyTime: Define a time in frame or timecode that can then be used in a variety of attributes and functions.
  • PyTimelineFX: Get a Timeline FX, or bypass it.

Notable updates to classes:

  • PyBatch : The Render Node supports for bit depth and render destination.
  • PyClip now has the same properties and attributes as the PySequence class, and you can reformat or render it.
  • PyCoNode now gives you access to the 3D camera.
  • PySequence can now manage tracks.

Also, a new look for the Flame module documentation, as well as some Flame API Code Samples.

What's New in 2019.1

General Improvements

Arguments passed for an attribute or a function are no longer case sensitive if they reference an option in the Flame user interface.

You can now pass float values (between 0.0 and 1.0) to attributes that require R, G and B arguments. Setting R, G, and B arguments can still be done with integer values, but getting the colour values always returns floating point values.

Action Scriptability

With the Python API, you create scripts to:

  • Create nodes
  • Manage the Action schematic
  • Assign media
  • Manage render passes
  • Manage PBR parameters of shaders nodes
  • Manage Transform parameters of an axis node
  • Manage Light, Projector, and Camera
  • Trigger motion vectors caching
Tip: Use PyActionNode.node_types to get a list of Action's scriptable nodes, and PyActionNode.output_types for a list the available outputs.

Media Management

You can now create a sequence with PyReel.create_sequence(),PyLibrary.create_sequence(), and PyFolder.create_sequence().

You can now find clip by name, UID, or wiretap node ID.

Import & Export

You can now import (flame.import_clips()) or export clips (using the new PyExporter class).

What's New in 2019

Media Panel Scriptability

You can now script the Media Panel.

Scriptable Media Panel components:

  • Workspace
  • Desktop
  • Reel Groups and Reels
  • Batch Groups and Iterations
  • Libraries and Folders

The API has also been augmented with additional Batch commands.

Catching Exception

Exceptions can now be caught in a Python script. For example, the following will now work:

from flame import batch
try:
   batch.import_clip("bad_path", "bad_reel_name")
except Exception as e:
   print(str(e))

Additional Python API Improvements

  • The address of a python object is now preserved, allowing for two variables to share a single address pointing to the same python object.
  • The default names defined for the Render and Write File nodes set using the Preferences or Python Hooks are now respected when one of these nodes is created using <PyBatch>.create_node.
  • flame.project is now available, but no Flame project attributes can be modified using the Python API. It is only used to store the current Project and Workspace in variables.

Was this information helpful?