Stax Host Addon - Architecture

Hi there,

I have a good use case for addon architecture with as much inheritance as possible but with wide override possibility.
We are currently working on implementing Stax for Ayon. It is a an Application Template of Blender, it uses Blender as an engine but reshapes all the native UI to propose a different UX.
Hence, I’d like to create an addon which would rely as much as possible on the Ayon’s Blender addon with some overrides to avoid rewriting it all, such as the launch context.

The first step is to be able to start Stax from any folder selected and not only from a task, is there a way to override something like is_compatible from a host implementation? It’d look like:

def is_compatible(self, selection):
    if selection.is_folder_selected:
        # If folder is of a type related to an episode            
        return selection.get_folder_entity()['folderType'] in ["Episode", "Sequence", "Shot"]
    else:
        return False

Our current approach is to use a LauncherAction but it requires to start a blender process on our own, which doesn’t benefit from any Ayon code (like launch hooks).
Could ApplicationManager be relevant for such use?

Once Blender has been launched, we’ll need to hook (PostLaunchHook) to load reviewable products into Stax’s timeline (Blender’s Video Sequencer) from the context. For example an episode would load all the reviewable products from shots of the episode. To maximize code mutualization it’d be best we rely on Ayon’s Blender loader plugins.

To sum steps up:

  • Launch Blender from specific folder (not task only) with Ayon’s implementation but with the possibility to override the launch context to start with Stax App Template
  • Add a post launch hook to use an Ayon Blender addon plugin loader for loading a bunch of reviewable products.

Any idea of what the addon’s architecture should look like? Thanks!

1 Like

I think AYON context by defintion requires a task.

So, what about adding a folder action that opens Stax and load everyhing in it?

Also, a food for thought, since Stax is a video player/review tool, what about adopting it in compliance to DJV GitHub - ynput/ayon-djv

That’s what I was afraid of, thanks.

That is my current lead. But to do so I have to deal with the second part of my technical issue: how to start Blender bypassing context but still using as much AYON’s blender addon code (events and loaders in my case) as possible?

Thanks for DJV, I’ve looked at it and it is interesting but the implementation is very small and works only with one representation at a time, when Stax is meant to deal with big timelines.

I don’t think DJV in this essence is context aware.

Just to validate I got you correctly.

You want to open an integrated application in this case Stax on the folder level and publish to multiple shots without having a master shot task?

Yes that is it. I want to publish reviews only (images + comments).

As far as I know, the best thing that suits your description is:

  1. Have stax addon
  2. Add stax to supported applications
  3. Either:
    a. (work regularly as we do in UE) create a dedicated task for it + implement a button to populate your workfile with the latest reviews.
    b. OR Add a folder action that opens a session with the latest reviews within that folder.

But hopefully others can have further insights.

One solution I’m thinking about, is creating a task “review” for every episode, sequence or shot folders. I cannot find a way to create a task for folders in the ayon server UI, how am I supposed to proceed?

EDIT:
I can do it with from ayon_api import create_task

Alternatively, you can use ayon_hub.add_new_task as in this example create_project_hierarchy_with_folders_tasks.py

By making one simple change, launching Blender in a Stax environment becomes possible:

EDIT : I proposed to Allow to launch an app with custom arguments but the appropriate way is to do it with a PreLaunchHook using self.launch_context.launch_args.extend(["my", "args"])

1 Like