Code Monkey home page Code Monkey logo

ayon-launch-scripts's Introduction

AYON Addon Launch Script

This defines a module/addon for AYON which exposes a command line interface to run Python scripts within support host applications like Blender, Maya, Houdini and Fusion.

It's like AYON has gone headless!

Installation

Create the AYON addon package using the create_package.py script similar to other AYON addons:

python ./create_package.py

Upload the addon package to your AYON server and add it to your bundle.

Examples

Running a headless script

When currently inside an environment that has the OpenPype context environment variables for AYON_FOLDER_PATH, AYON_TASK_NAME, etc. you can just run:

ayon_console addon launch_scripts run-script -app maya/2023 -path /path/to/script.py

But in most case you'll need to explicitly provide the context you want to run the script in:

ayon_console addon launch_scripts run-script 
-project my_project
-folder /asset/char_hero
-task modeling
-app maya/2023 
-path /path/to/script.py

The arguments are on new-lines here solely for readability. They are arguments to the same command and should usually be on a single line.

Running a headless publish

The module also exposes a publish command. Usable like so:

ayon_console addon launch_scripts publish
-project my_project
-folder /asset/char_hero
-task modeling
-app maya/2023 
-path /path/to/workfile.ma

This will launch the host headless, then open the workfile and publish as usual.

Default context

It will pass along these defaults from environment variables if you do not explicitly pass the relevant command line arguments:

  • -project: AYON_PROJECT_NAME
  • -folder_path: AYON_FOLDER_PATH
  • -task: AYON_TASK_NAME
  • -host: AYON_APP_NAME

Remarks

  • Script input arguments: To supply specific input arguments to your scripts it's recommended to supply environment variables to the launched application and retrieve them in your script from os.environ since not all hosts supported passing along custom additional arguments unrelated to its launch.

Supported applications

For each supported host an entry point needs to be created so headless scripts can run against it. Currently only the following hosts are supported:

  • Blender: ok
  • Fusion: only in gui mode, does not suppress prompts nor exits at the end
  • Houdini: ok
  • Maya: ok - note that playblasting and thus publishing reviews is not supported in Maya headless mode
  • Nuke: implemented but untested (includes Nuke X and Nuke Studio)

Running against source code

Instead of running ayon_console addon you can also run AYON launcher in dev mode: ayon-launcher/tools/ayon_console.bat --use-dev addon launch_scripts.

As such an example usage against run code could look like:

ayon-launcher/tools/ayon_console.bat --use-dev addon launch_scripts publish
-project my_project
-folder /asset/char_hero
-task modeling
-app maya/2023 
-path /path/to/workfile.ma

ayon-launch-scripts's People

Contributors

bigroy avatar

Stargazers

 avatar Ryan J. Quinlan avatar Brian Willard avatar Fabià Serra Arrizabalaga avatar

Watchers

Paul Boots avatar  avatar  avatar

Forkers

firegreen

ayon-launch-scripts's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.