mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
rename 'get_current_asset_name' to 'get_current_folder_path'
This commit is contained in:
parent
505691b9ad
commit
0664da2a5e
41 changed files with 85 additions and 88 deletions
|
|
@ -94,7 +94,7 @@ from .context_tools import (
|
|||
get_current_context,
|
||||
get_current_host_name,
|
||||
get_current_project_name,
|
||||
get_current_asset_name,
|
||||
get_current_folder_path,
|
||||
get_current_task_name
|
||||
)
|
||||
install = install_host
|
||||
|
|
@ -195,7 +195,7 @@ __all__ = (
|
|||
"get_current_context",
|
||||
"get_current_host_name",
|
||||
"get_current_project_name",
|
||||
"get_current_asset_name",
|
||||
"get_current_folder_path",
|
||||
"get_current_task_name",
|
||||
|
||||
# Backwards compatible function names
|
||||
|
|
|
|||
|
|
@ -385,10 +385,10 @@ def get_current_project_name():
|
|||
return get_global_context()["project_name"]
|
||||
|
||||
|
||||
def get_current_asset_name():
|
||||
def get_current_folder_path():
|
||||
host = registered_host()
|
||||
if isinstance(host, HostBase):
|
||||
return host.get_current_asset_name()
|
||||
return host.get_current_folder_path()
|
||||
return get_global_context()["folder_path"]
|
||||
|
||||
|
||||
|
|
@ -439,7 +439,7 @@ def get_current_project_asset(asset_name=None, asset_id=None, fields=None):
|
|||
return get_asset_by_id(project_name, asset_id, fields=fields)
|
||||
|
||||
if not asset_name:
|
||||
asset_name = get_current_asset_name()
|
||||
asset_name = get_current_folder_path()
|
||||
# Skip if is not set even on context
|
||||
if not asset_name:
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -1402,7 +1402,7 @@ class CreateContext:
|
|||
).format(joined_methods))
|
||||
|
||||
self._current_project_name = None
|
||||
self._current_asset_name = None
|
||||
self._current_folder_path = None
|
||||
self._current_task_name = None
|
||||
self._current_workfile_path = None
|
||||
|
||||
|
|
@ -1557,14 +1557,14 @@ class CreateContext:
|
|||
|
||||
return self._current_project_name
|
||||
|
||||
def get_current_asset_name(self):
|
||||
def get_current_folder_path(self):
|
||||
"""Asset name which was used as current context on context reset.
|
||||
|
||||
Returns:
|
||||
Union[str, None]: Asset name.
|
||||
"""
|
||||
|
||||
return self._current_asset_name
|
||||
return self._current_folder_path
|
||||
|
||||
def get_current_task_name(self):
|
||||
"""Task name which was used as current context on context reset.
|
||||
|
|
@ -1612,7 +1612,7 @@ class CreateContext:
|
|||
)
|
||||
return (
|
||||
self._current_project_name != project_name
|
||||
or self._current_asset_name != asset_name
|
||||
or self._current_folder_path != asset_name
|
||||
or self._current_task_name != task_name
|
||||
or self._current_workfile_path != workfile_path
|
||||
)
|
||||
|
|
@ -1718,7 +1718,7 @@ class CreateContext:
|
|||
)
|
||||
|
||||
self._current_project_name = project_name
|
||||
self._current_asset_name = asset_name
|
||||
self._current_folder_path = asset_name
|
||||
self._current_task_name = task_name
|
||||
self._current_workfile_path = workfile_path
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class BuildWorkfile:
|
|||
|
||||
from ayon_core.pipeline.context_tools import (
|
||||
get_current_project_name,
|
||||
get_current_asset_name,
|
||||
get_current_folder_path,
|
||||
get_current_task_name,
|
||||
)
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ class BuildWorkfile:
|
|||
|
||||
# Get current asset name and entity
|
||||
project_name = get_current_project_name()
|
||||
current_folder_path = get_current_asset_name()
|
||||
current_folder_path = get_current_folder_path()
|
||||
current_asset_doc = get_asset_by_name(
|
||||
project_name, current_folder_path
|
||||
)
|
||||
|
|
|
|||
|
|
@ -128,9 +128,9 @@ class AbstractTemplateBuilder(object):
|
|||
return os.getenv("AYON_PROJECT_NAME")
|
||||
|
||||
@property
|
||||
def current_asset_name(self):
|
||||
def current_folder_path(self):
|
||||
if isinstance(self._host, HostBase):
|
||||
return self._host.get_current_asset_name()
|
||||
return self._host.get_current_folder_path()
|
||||
return os.getenv("AYON_FOLDER_PATH")
|
||||
|
||||
@property
|
||||
|
|
@ -144,7 +144,7 @@ class AbstractTemplateBuilder(object):
|
|||
return self._host.get_current_context()
|
||||
return {
|
||||
"project_name": self.project_name,
|
||||
"folder_path": self.current_asset_name,
|
||||
"folder_path": self.current_folder_path,
|
||||
"task_name": self.current_task_name
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ class AbstractTemplateBuilder(object):
|
|||
def current_asset_doc(self):
|
||||
if self._current_asset_doc is None:
|
||||
self._current_asset_doc = get_asset_by_name(
|
||||
self.project_name, self.current_asset_name
|
||||
self.project_name, self.current_folder_path
|
||||
)
|
||||
return self._current_asset_doc
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue