Python Improvements

Flame Family products now use Python 3.7, you can now encode exports with FFmpeg, access the new Python console. Plus Python API updates.

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

Moving to Python 3.7

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

The process for converting your scripts to 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:

FFmpeg Media Encoding with Python API

This release includes new Python API script examples showing how to encode Flame Family content using FFmpeg on CentOS and macOS

Important: You must install FFmpeg on your workstation if you want to run the example scripts. For more information, see the FFmpeg site.

The Python example file is located in /opt/Autodesk/flame_2022/python_examples/export_selection.py.

export_selection.py contains examples to:

The Python API encoding also uses some of the Wiretap tools already installed in /opt/Autodesk/io/bin. The Wiretap tools used are:

Since Timeline FX have to be rendered prior exporting with Python API, we have added in the example a way to pre-render content before exporting. If you create your own Python script, make sure to pre-render any Timeline FX to avoid black frames in your resulting files. Also, Audio mix down might be required if your content has more than two audio tracks.

The above script also shows how to export clips located in a Reel or a Folder, and displays a file browser to select a destination.

Python API limitations:

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 does the distinction between / (float division) and // (integer division).

New in Action

Command Type Description
<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 now be used to duplicate an object inside a PyActionNode, PyImageNode, and PyGMaskTracerNode.

New in Media Panel

Command Type Description
<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 to dictate the desired behaviour.

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 in Timeline FX

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.