use query action in fill workfile attribute

This commit is contained in:
Jakub Trllo 2022-06-14 16:07:58 +02:00
parent af0b97fafe
commit ac48f50fdf

View file

@ -7,6 +7,10 @@ import datetime
import ftrack_api
from openpype.client import (
get_project,
get_assets,
)
from openpype.api import get_project_settings
from openpype.lib import (
get_workfile_template_key,
@ -14,7 +18,6 @@ from openpype.lib import (
Anatomy,
StringTemplate,
)
from openpype.pipeline import AvalonMongoDB
from openpype_modules.ftrack.lib import BaseAction, statics_icon
from openpype_modules.ftrack.lib.avalon_sync import create_chunks
@ -248,10 +251,8 @@ class FillWorkfileAttributeAction(BaseAction):
# Find matchin asset documents and map them by ftrack task entities
# - result stored to 'asset_docs_with_task_entities' is list with
# tuple `(asset document, [task entitis, ...])`
dbcon = AvalonMongoDB()
dbcon.Session["AVALON_PROJECT"] = project_name
# Quety all asset documents
asset_docs = list(dbcon.find({"type": "asset"}))
asset_docs = list(get_assets(project_name))
job_entity["data"] = json.dumps({
"description": "(1/3) Asset documents queried."
})
@ -276,7 +277,7 @@ class FillWorkfileAttributeAction(BaseAction):
# Keep placeholders in the template unfilled
host_name = "{app}"
extension = "{ext}"
project_doc = dbcon.find_one({"type": "project"})
project_doc = get_project(project_name)
project_settings = get_project_settings(project_name)
anatomy = Anatomy(project_name)
templates_by_key = {}