Wapi examples#
Create assets#
Here is a code example to create a sequence, multiple shots and multiple stages.
import wapi
sequence = "seq_0003"
shots_list = ["sh_0001", "sh_0002", "sh_0003"]
stages_list = ["layout", "animation", "cfx", "fx", "camera", "lighting", "compositing"]
# First, create the sequence
sequence_path = wapi.assets.create_sequence(sequence)
if sequence_path:
# If the sequence is successfully created, create the list of shots
for shot in shots_list:
asset_path = wapi.assets.create_asset(sequence_path, shot)
# If the shot is successfully created, create the stages
if asset_path:
for stage in stages_list:
wapi.assets.create_stage(asset_path, stage)
# Don't forget to refresh the user's interfaces of the team
wapi.team.refresh_ui()
Create references#
Here is a code example to reference a rig in multiple animation scenes.
import wapi
# Define the target variant to reference
variant_to_reference = "assets/characters/Joe/rigging/main"
# Define the work environment that needs the reference
destination_work_envs = ["sequences/seq_0001/sh_0001/animation/main/maya",
"sequences/seq_0001/sh_0002/animation/main/maya",
"sequences/seq_0001/sh_0003/animation/main/maya"]
# Then, for each work environment, create the reference using wapi
for destination_work_env in destination_work_envs:
new_references = wapi.assets.create_reference(destination_work_env, variant_to_reference)
# Finally, for each reference, apply the auto update parameter
for reference in new_references:
wapi.assets.modify_reference_auto_update(destination_work_env, reference, auto_update=True)
# Don't forget to refresh the team user's interfaces
wapi.team.refresh_ui()