What's New in Previous Releases

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

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.

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:

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:

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.

What's New in 2020.1

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

Updates to Action:

Updates to Batch:

More control over the Media Panel:

Changes to the PyProject object:

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:

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:

What's New in 2019.2

New Classes:

Notable updates to classes:

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:

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:

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