Skip to content

Instantly share code, notes, and snippets.

@BigRoy
Created October 30, 2024 19:16
Show Gist options
  • Save BigRoy/c665d2f6262348ec3b81244546e44be7 to your computer and use it in GitHub Desktop.
Save BigRoy/c665d2f6262348ec3b81244546e44be7 to your computer and use it in GitHub Desktop.
AYON simple create folders and task via Python API example
from ayon_core.pipeline import get_current_project_name
import ayon_api
from ayon_api.entity_hub import EntityHub
project_name = get_current_project_name()
hub = EntityHub(project_name)
for folder_name in ["asset1", "asset2"]:
folder_entity = hub.add_new_folder(
folder_type="Shot", # folder type must exist in project
name=folder_name,
# parent_id=parent_folder_id, # use folder id if you want a parent folder
)
for task_name, task_type in [
("modeling", "Modeling"),
("lookdev", "Lookdev")
]:
hub.add_new_task(
task_type=task_type, # task type must exist in project
parent_id=folder_entity["id"],
name=task_name,
)
hub.commit_changes()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment