Public Helper Methods

class python.tk_aftereffects.AdobeItemTypes[source]

This class stores some constants in order to expose certain important adobe aftereffects internal class names within python

COMP_ITEM = 'CompItem'

str The adobe.CompItem’s internal typename

FOLDER_ITEM = 'FolderItem'

str The adobe.FolderItem’s internal typename

FOOTAGE_ITEM = 'FootageItem'

str The adobe.FootageItem’s internal typename

class engine.AfterEffectsEngine(tk, context, engine_instance_name, env)[source]

An After Effects CC engine for Shotgun Toolkit.

Engine instances are constructed by the toolkit launch process and various factory methods such as start_engine().

Parameters:
  • tkSgtk instance

  • context (Context) – A context object to define the context on disk where the engine is operating

  • engine_instance_name – The name of the engine as it has been defined in the environment.

  • env – An Environment object to associate with this engine.

property project_path

Get the active project filepath.

Returns:

The current project path or an empty string

Return type:

str

save(path=None)[source]

Save the project in place or to the given file-path

Parameters:

path (str) – The target file path. optional.

save_as()[source]

Launch a Qt file browser to select a file, then save the supplied project to that path.

property AdobeItemTypes

This returns a constant class that maps constants against adobe aftereffects internal class names.

Returns:

AdobeItemTypes constants object. see AdobeItemTypes

Return type:

AdobeItemTypes

is_item_of_type(item, adobe_type)[source]

Indicates whether the given item is of the given AdobeItemType.

Parameters:
Returns:

Indicating if the given item is of the given type

Return type:

bool

property selected_item

Helper getting the currently selected item in the after effects project

Returns:

The active item

Return type:

adobe.ItemObject

is_adobe_sequence(path)[source]

Helper to query if an adobe-style render path is describing a sequence.

The sequencepath must contain one of the following patterns in order to be recognized:

###
@@@
[###]
%0xd
Parameters:

path (str) – filepath to check

Returns:

True if the path describes a sequence

Return type:

bool

check_sequence(path, queue_item)[source]

Helper to query if all render files of a given queue item are actually existing.

Parameters:
Returns:

True if the path describes a sequence

Return type:

bool

iter_collection(collection_item)[source]

Helper to iter safely through an adobe-collection item as its index starts at 1, not 0.

One may use this method like this:

item_collection = engine.adobe.project.items
for item in engine.iter_collection(item_collection):
    print item.name
Parameters:

collection_item (adobe.ItemCollectionObject) – the after-effects collection item to iter

Yields:

the next child item of the collection

Return type:

adobe.ItemObject

get_render_files(path, queue_item)[source]

Yields all render-files and its frame number of a given after effects render queue item.

The path is needed to uniquely identify the correct output_module

Parameters:
Yields:

2-item-tuple where the firstitem is the resolved path (str) of the render file and the second item the frame-number or None if the path is not an image-sequence.

Return type:

tuple

import_filepath(path)[source]

Helper method to import footage into the current comp. This method contains logic to determine as what the given file-path may be imported (PROJECT, FOOTAGE, COMP etc.) To influence this logic you can implement the “import_footage_hook” for this engine. It will also collect all new items and return those in case the import leads to more than one (1) Item-objects to be imported.

Parameters:

path (str) – filepath to be imported. Sequences should give either the first frame or the frames replaced by hashes (#), at (@) or the percent formatting (%04d) syntax.

Returns:

All new items that were imported

Return type:

list-of-adobe.CompItemObject

add_items_to_comp(item_collection, comp_item)[source]

Helper method that adds the “best-matching” items from a given adobe.CollectionItem into a given CompItem. Where “best-matching” means, that the first CompItem found is added alternatively the first Footage item is added. In case the collection contains only FolderItems, this method will recurse into the folders until one ItemObject was found.

Parameters:
Returns:

Indicating if an item was added or not.

Return type:

bool

render_queue_item(queue_item)[source]

renders a given queue_item, by disabling all other queued items and only enabling the given item. After rendering the state of the render-queue is reverted.

Parameters:

queue_item (adobe.RenderQueueItemObject) – The render queue item to be rendered

Returns:

Indicating successful rendering or not

Return type:

bool

find_sequence_range(path)[source]

Parses the file name in an attempt to determine the first and last frame number of a sequence. This assumes some sort of common convention for the file names, where the frame number is an integer at the end of the basename, just ahead of the file extension, such as file.0001.jpg, or file_001.jpg. We also check for input file names with abstracted frame number tokens, such as file.####.jpg or file.%04d.jpg.

Parameters:

path (str) – The file path to parse.

Returns:

None if no range could be determined, otherwise (min, max)

Return type:

tuple or None