Hullo,
The loader is a good tool for quickly browsing through the published product. It would be very convenience if we have a way to open the Loader with the context based on what we selected in the Launcher. I’ve created a Launcher action that do this. However, I’m facing two issues with this implementation.
- The Loader will crash after a few seconds
- The Loader won’t get to the selected context immediately. It would requires a second click to the same action to make the loader go to the right context.
Here is my code. What can I do to fix the two issues described above.
ayon-core/client/ayon_core/plugins/actions/open_loader.py
from ayon_core.pipeline import LauncherAction
from ayon_core.resources import get_resource
class ShowInLoader(LauncherAction):
"""Open AYON browser page to the current context."""
name = "showInLoader"
label = "Show in Loader"
icon = get_resource("icons", "loader.png")
order = 999
_loader_window = None
_project_entity = None
_folder_entity = None
def process(self, selection, **kwargs):
"""Launch Loader using context from the selection
Args:
selection (_type_): _description_
"""
self._project_entity = selection.project_entity
self._folder_entity = selection.folder_entity
self.show_loader()
def show_loader(self):
if self._loader_window is None:
from ayon_core.pipeline import install_ayon_plugins
from ayon_core.tools.loader.ui import LoaderWindow
libraryloader = LoaderWindow()
self._loader_window = libraryloader
install_ayon_plugins()
self._loader_window.show()
self._loader_window._controller.set_expected_selection(
self._project_entity['name'],
self._folder_entity['id'],
)
# Raise and activate the window
# for MacOS
self._loader_window.raise_()
# for Windows
self._loader_window.activateWindow()