From e02b686afe748a4e67b63650d2fcf9a70a994e75 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Mon, 10 Oct 2022 17:07:50 +0200 Subject: [PATCH] still support get current context --- openpype/tools/publisher/control.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openpype/tools/publisher/control.py b/openpype/tools/publisher/control.py index 481fb5981b..b4c89f221f 100644 --- a/openpype/tools/publisher/control.py +++ b/openpype/tools/publisher/control.py @@ -11,6 +11,7 @@ from openpype.lib.events import EventSystem from openpype.pipeline import ( PublishValidationError, registered_host, + legacy_io, ) from openpype.pipeline.create import CreateContext @@ -414,6 +415,9 @@ class PublisherController: str: Project name. """ + if not hasattr(self.host, "get_current_context"): + return legacy_io.active_project() + return self.host.get_current_context()["project_name"] @property @@ -424,6 +428,9 @@ class PublisherController: Union[str, None]: Asset name or None if asset is not set. """ + if not hasattr(self.host, "get_current_context"): + return legacy_io.Session["AVALON_ASSET"] + return self.host.get_current_context()["asset_name"] @property @@ -434,6 +441,9 @@ class PublisherController: Union[str, None]: Task name or None if task is not set. """ + if not hasattr(self.host, "get_current_context"): + return legacy_io.Session["AVALON_TASK"] + return self.host.get_current_context()["task_name"] @property