About the Scripting Module

 
 
 

Autodesk® MatchMover TM embeds a script interpreter compatible with Python and also gives access to some of its internal data and user interface commands. This allows the user to write any kind of pre- or post processing on the input/output data that flows through the computation engine. But scripts can also be used to launch any command, just as one would do with its mouse or keyboard.

The power of scripting is only limited by the user’s imagination, and one can improve the interface with fully customized tools. For quick access to the most frequently used scripts, a Script Toolbar can be configured dynamically by the user. Some scripts are given as examples that display current cameras/tracks, or select all the tracks that have not been reconstructed. These are few samples of the power of scripts built-in MatchMover.

Script Editor

The Script Editor can be opened through the Scripts menu or by using the icon at the bottom right of the Status Bar.

This editor should be use to edit/run scripts. It is divided into two panes: the upper pane shows the script output while the lower pane is the editor.

You can directly type some scripts here and execute them (Ctrl+Enter). When the Script Editor is floating, the current script name and its modification status are displayed in the title bar, but the Script Editor can also be docked as any other window.

Scripts menu

The Scripts menu order is a bit different in the Script Editor and in the main menu, for more efficiency, but all the commands are the same.

File

Open Script

Select a filename and its content will be appended in the Script Editor pane. If a script was already edited, it is not closed and it stays the current script, but it is flagged as modified.

Run Script

Selects and automatically executes a script file.

Save Script

Saves the current script source, and asks for a filename if none was provided.

Save Script As

Saves current script under a new filename.

Edit

Clear Output

Erases the content of the output pane.

Clear Input

Erases the content of the editor pane. May ask to save the current script if it has been modified.

Clear All

Erases both output and input panes.

Auto Clear

Tells the Script Editor to clear the output before launching any new script.

Echo Command

Tells the Script Editor to display the executed command in the output.

Echo Script

Tells the Script Editor to display the executed script in the output.

Store Script

Stores the current script in the script database. The database can later be edited using the Script Manager. Stored scripts can be directly launched using the Script submenu in the Script Editor.

Or even better, they can be displayed in the Script Toolbar and launched by a simple click.

Add to Toolbar

Stores the current script and automatically displays it in the Script Toolbar. This toolbar is like any other ones (it can be moved/docked...). Each tool button is configurable through the Script Manager: text, tool tip, status tip, etc.

Languages

Use this menu to select the language of the script you want to manually type in. Autodesk MatchMover supports Python only.

Script

Execute Script

Executes the script currently edited in the Script Editor pane.

Script Manager

Opens the Script Manager.

Reset Interpreter

Resets the script interpreter to its original state (clear all user variables, environment variables, etc.)

Script Manager

The Script Manager is used to handle the script database. MatchMover can keep track of some useful scripts and provide ways to launch them more easily through the menu or the Script Toolbar.

The Script Manager shows the list of currently stored scripts. Note that what is stored is just the source filename of the script, not the script itself. This allows you to edit your scripts in any other editors.

Take care if you move the source file to another location, the link in the database will not be updated automatically. You can add some new scripts here or remove the selected ones. When a script is selected, you can click on Open Script to see it in the Script Editor, or simply double-click on its label in the script list.

Script attributes are editable as follows:

Label

This is the text that will be displayed in the script submenu in the Script Editor and on the button in the Script Toolbar.

Tip

This is the popup that will be displayed for the script tool button.

Hint

This is the text that will be displayed in the Status Bar when the mouse passes over this script item.

Lang

Shows the execution language of the selected script.

Display in toolbar

Toggle if this script is also shown as a tool button in the Script Toolbar for faster launching.

Show Icon

Use this to select an image file that will be shown in the toolbar instead of the script label.

Show output when executed

If checked, this option automatically opens the Script Editor to see the script output when this script is launched.

Launch in a separate thread

For a huge script, or debugging process, you may want to launch a script in a separate thread. When such a script is launched, the user interface is not stopped and the script can be stopped by pressing the Stop Script button that pops up.

Reset interpreter before launching

Tells if the interpreter needs to be reset before launching this script.

Source file

The current script source file is displayed here and can be changed to any other file.

Subroutine

This list displays all the subroutines automatically found in the current source file. Select one of them or type in your own subroutine name. If a subroutine name is selected, it will be executed instead of the whole script.

Argument

When a subroutine is selected, you can type in a text here that will be provided as arguments for the subroutine.

MatchMover Package

The MatchMover Package makes the link with the script interpreter. It is a module that allows scripts to interact with the MatchMover interface and data. This package is materialized by an Python object called "mm". This means that you can send a command to MatchMover using a syntax like:

[Python] > mm.selectTracks( [ mm.getTrackId( "Track 01" ) ] );

Usually, all commands that refer to an object take its id as a parameter. The link between an item and its id is made through calls like getTrackId, getGroupId etc., that take the item label as argument

List of MatchMover Package methods

To see the list of all additional MatchMover Package commands, use the Help command in the Languages menu of either the Script Editor or the main Script menu item. This will display all the commands with their syntax and usage. When some arguments are optional, their default values is shown in the argument list.

For example:

> createTrack( label = "", group = -1 )

This means you can launch createTrack without argument at all, or specify a label, and even a group id if needed.

Batch Mode

Scripts can also be used to run MatchMover in batch Mode from the command line. Here is the corresponding syntax for setting language:

> MatchMover -script filename language
'filename' should point to the source file containing the script
'language' is the script language (1 = Python)

Sample Scripts

With MatchMover comes a collection of sample scripts in several languages. Check in the Scripts subdirectory of your installation for details. Each file is self commented and provides all kind of examples, such as a NUKE exporter.

Each script file can contain several subroutines, and you can select any of them, even with optional arguments in the Script Manager.