Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
use current project for query asset
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT committed Apr 8, 2022
1 parent 5de8185 commit 9a8c413
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions openpype/tools/utils/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ def _refresh(self):
project_name = os.environ.get("AVALON_PROJECT")
asset_name = os.environ.get("AVALON_ASSET")
task_name = os.environ.get("AVALON_TASK")
host_name = os.environ.get("AVALON_APP")
if not all((project_name, asset_name, task_name)):
return

Expand All @@ -422,15 +423,18 @@ def _refresh(self):
["family_filter_profiles"]
)
if profiles:
asset_doc = self.dbcon.find_one(
# Make sure connection is installed
# - accessing attribute which does not have auto-install
self.dbcon.install()
asset_doc = self.dbcon.database[project_name].find_one(
{"type": "asset", "name": asset_name},
{"data.tasks": True}
)
) or {}
tasks_info = asset_doc.get("data", {}).get("tasks") or {}
task_type = tasks_info.get(task_name, {}).get("type")
profiles_filter = {
"task_types": task_type,
"hosts": os.environ["AVALON_APP"]
"hosts": host_name
}
matching_item = filter_profiles(profiles, profiles_filter)

Expand Down

0 comments on commit 9a8c413

Please sign in to comment.