-
Notifications
You must be signed in to change notification settings - Fork 128
Context Validation Repair Action enhancements #6207
Context Validation Repair Action enhancements #6207
Conversation
# Get to the task doc of the project, folder path and task | ||
project_name = instance.context.data["projectEntity"]["name"] | ||
folder_path = instance.context.data["asset"] | ||
task_name = instance.context.data["task"] | ||
from ayon_api import get_task_by_name, get_folder_by_path | ||
folder = get_folder_by_path(project_name, folder_path) | ||
asset_id = folder["id"] | ||
task = get_task_by_name(project_name, asset_id, task_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validator should not be querying this data - right? This should've been readily collected in the Collectors.
Doing this per instance like this I'm pretty sure will be very slow. This is much better batch collected in a Collector.
Side note: wasn't aware Ayon had frame data per task instead of per folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BigRoy so would you recommended adding a "CollectTaskEntity" to the Maya host collectors.
I want to store the task doc attributes for later query in validators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, task entity collecting would make sense. It's happening already for projectEntity
and assetEntity
or alike on both context
and instance
(note that Instance MAY target a different asset than current context and thus might need a validation against that instead of the context).
I'd look up which collector is currently storing projectEntity
and assetEntity
which I think it does in a bulk query from a ContextPlugin
and add the data collection for taskEntity
there as well (if task
is set on the instance/context, etc.)
@iLLiCiTiT thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found where project and asset entity are added to context, this is in
collect_context_entities.py
I now prepare and cache the "taskEntity"here.
https://github.com/ynput/OpenPype/pull/6207/files#diff-65495e9f1aba1baa5c1f7517ad5f56e80c42990db087260f8ee4a5eee6edb1c1R17
task_entity = ayon_api.get_task_by_name(
project_name, asset_entity["_id"], task_name)
context.data["taskEntity"] = task_entity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BigRoy it seems get_task_by_name is only in ayon_api.
I guess I need to make OpenPype legacy work without ayon in the mix?
In which case I should test if AYON_SERVER_ENABLED, and then only do the query in ayon.
I assume there was no API for this in legacy OpenPype
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be easier if I don't have to back support OpenPype without AYON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, there's no equivalent "task" data in OpenPype as far as I know.
Since this is in the OpenPype repo I'm pretty sure you'll still need to maintain backwards compatibility. But might be a better question forwarded to @mkolar or @iLLiCiTiT
Actually @bradenjennings this only needs to work in AYON. It makes no sense in OP, so you can get rid of the compatibility and port it directly to ayon-core. this can be closed in favour of ayon-core PR |
Just note why it was re-opened: this was requested by the client still running OP so it has to work there too |
Pure AYON version needs to be done in ayon-core repo |
…pair_Action_enhancements
Tasks dont store overrides in OpenPype as far as I know. |
Changelog Description
Currently, Repair Action in Validate Instance in Context sets only the asset path, but is should be able to also set Task and run Set resolution and Set frame range actions. This should work both in AYON and OpenPype
Testing notes:
[cuID:AY-1052]