mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
check for source class instead of for function by name availability
This commit is contained in:
parent
48937de52c
commit
fb56e169dc
1 changed files with 6 additions and 5 deletions
|
|
@ -11,6 +11,7 @@ import pyblish.api
|
|||
from pyblish.lib import MessageHandler
|
||||
|
||||
import openpype
|
||||
from openpype.host import HostBase
|
||||
from openpype.client import (
|
||||
get_project,
|
||||
get_asset_by_id,
|
||||
|
|
@ -317,7 +318,7 @@ def get_current_host_name():
|
|||
"""
|
||||
|
||||
host = registered_host()
|
||||
if host is not None and hasattr(host, "name"):
|
||||
if isinstance(host, HostBase):
|
||||
return host.name
|
||||
return os.environ.get("AVALON_APP")
|
||||
|
||||
|
|
@ -332,28 +333,28 @@ def get_global_context():
|
|||
|
||||
def get_current_context():
|
||||
host = registered_host()
|
||||
if host is not None and hasattr(host, "get_current_context"):
|
||||
if isinstance(host, HostBase):
|
||||
return host.get_current_context()
|
||||
return get_global_context()
|
||||
|
||||
|
||||
def get_current_project_name():
|
||||
host = registered_host()
|
||||
if host is not None and hasattr(host, "get_current_project_name"):
|
||||
if isinstance(host, HostBase):
|
||||
return host.get_current_project_name()
|
||||
return get_global_context()["project_name"]
|
||||
|
||||
|
||||
def get_current_asset_name():
|
||||
host = registered_host()
|
||||
if host is not None and hasattr(host, "get_current_asset_name"):
|
||||
if isinstance(host, HostBase):
|
||||
return host.get_current_asset_name()
|
||||
return get_global_context()["asset_name"]
|
||||
|
||||
|
||||
def get_current_task_name():
|
||||
host = registered_host()
|
||||
if host is not None and hasattr(host, "get_current_task_name"):
|
||||
if isinstance(host, HostBase):
|
||||
return host.get_current_task_name()
|
||||
return get_global_context()["task_name"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue