mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
removed unused function 'get_hierarchy'
This commit is contained in:
parent
096dc668b1
commit
4e7358f73b
4 changed files with 0 additions and 56 deletions
|
|
@ -15,7 +15,6 @@ from .lib import (
|
|||
run_subprocess,
|
||||
version_up,
|
||||
get_asset,
|
||||
get_hierarchy,
|
||||
get_workdir_data,
|
||||
get_version_from_path,
|
||||
get_last_version_from_path,
|
||||
|
|
@ -101,7 +100,6 @@ __all__ = [
|
|||
# get contextual data
|
||||
"version_up",
|
||||
"get_asset",
|
||||
"get_hierarchy",
|
||||
"get_workdir_data",
|
||||
"get_version_from_path",
|
||||
"get_last_version_from_path",
|
||||
|
|
|
|||
|
|
@ -120,7 +120,6 @@ from .avalon_context import (
|
|||
is_latest,
|
||||
any_outdated,
|
||||
get_asset,
|
||||
get_hierarchy,
|
||||
get_linked_assets,
|
||||
get_latest_version,
|
||||
get_system_general_anatomy_data,
|
||||
|
|
@ -292,7 +291,6 @@ __all__ = [
|
|||
"is_latest",
|
||||
"any_outdated",
|
||||
"get_asset",
|
||||
"get_hierarchy",
|
||||
"get_linked_assets",
|
||||
"get_latest_version",
|
||||
"get_system_general_anatomy_data",
|
||||
|
|
|
|||
|
|
@ -213,57 +213,6 @@ def get_asset(asset_name=None):
|
|||
return asset_document
|
||||
|
||||
|
||||
@with_pipeline_io
|
||||
def get_hierarchy(asset_name=None):
|
||||
"""
|
||||
Obtain asset hierarchy path string from mongo db
|
||||
|
||||
Args:
|
||||
asset_name (str)
|
||||
|
||||
Returns:
|
||||
(string): asset hierarchy path
|
||||
|
||||
"""
|
||||
if not asset_name:
|
||||
asset_name = legacy_io.Session.get(
|
||||
"AVALON_ASSET",
|
||||
os.environ["AVALON_ASSET"]
|
||||
)
|
||||
|
||||
asset_entity = legacy_io.find_one({
|
||||
"type": 'asset',
|
||||
"name": asset_name
|
||||
})
|
||||
|
||||
not_set = "PARENTS_NOT_SET"
|
||||
entity_parents = asset_entity.get("data", {}).get("parents", not_set)
|
||||
|
||||
# If entity already have parents then just return joined
|
||||
if entity_parents != not_set:
|
||||
return "/".join(entity_parents)
|
||||
|
||||
# Else query parents through visualParents and store result to entity
|
||||
hierarchy_items = []
|
||||
entity = asset_entity
|
||||
while True:
|
||||
parent_id = entity.get("data", {}).get("visualParent")
|
||||
if not parent_id:
|
||||
break
|
||||
entity = legacy_io.find_one({"_id": parent_id})
|
||||
hierarchy_items.append(entity["name"])
|
||||
|
||||
# Add parents to entity data for next query
|
||||
entity_data = asset_entity.get("data", {})
|
||||
entity_data["parents"] = hierarchy_items
|
||||
legacy_io.update_many(
|
||||
{"_id": asset_entity["_id"]},
|
||||
{"$set": {"data": entity_data}}
|
||||
)
|
||||
|
||||
return "/".join(hierarchy_items)
|
||||
|
||||
|
||||
def get_system_general_anatomy_data():
|
||||
system_settings = get_system_settings()
|
||||
studio_name = system_settings["general"]["studio_name"]
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ def test_backward_compatibility(printer):
|
|||
from openpype.lib import is_latest
|
||||
from openpype.lib import any_outdated
|
||||
from openpype.lib import get_asset
|
||||
from openpype.lib import get_hierarchy
|
||||
from openpype.lib import get_linked_assets
|
||||
from openpype.lib import get_latest_version
|
||||
from openpype.lib import get_ffprobe_streams
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue