PublishingΒΆ

To publish an asset, you create a new asset version containing components.
First, create a new asset under a shot (or query an existing one):
# Query a shot and a task to create the asset against.
shot = ftrack.getShot(['dev_tutorial', '001', '010'])
task = shot.getTasks()[0]
# Create new asset.
asset = shot.createAsset(name='forest', assetType='geo')
Next create a version on the asset. Note that you can also link the version to a particular task:
# Create a new version for the asset.
version = asset.createVersion(
comment='Added more leaves.',
taskid=task.getId()
)
# Get the calculated version number.
print version.getVersion()
Then add the components that make up the version:
# Add some components.
previewPath = '/path/to/forest_preview.mov'
previewComponent = version.createComponent(path=previewPath)
modelPath = '/path/to/forest_mode.ma'
modelComponent = version.createComponent(name='model', path=modelPath)
And set the publish flag on the asset so that its versions appear in the web interface:
# Publish.
asset.publish()
It is also possible to set a thumbnail on the version:
# Add thumbnail to version.
thumbnail = version.createThumbnail('/path/to/forest_thumbnail.jpg')
And reuse that thumbnail elsewhere as well:
# Set thumbnail on other objects without duplicating it.
task.setThumbnail(thumbnail)