SG-44786 Reference previous pipeline step publish when building a new scene (Rig, Texture) - #163
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## ticket/SG-44787-validate-previous-step-published #163 +/- ##
====================================================================================
- Coverage 17.83% 17.80% -0.03%
====================================================================================
Files 32 32
Lines 3180 3184 +4
====================================================================================
Hits 567 567
- Misses 2613 2617 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ding When building a new Maya scene for a downstream step, automatically reference the upstream step's published Maya workfile into the scene so it opens ready to work from. Referencing runs in the build prep callback (after the scene is created/loaded, before it is saved into the draft) and is a no-op unless the host is Maya and the upstream step actually has a published workfile. - step_validation: share the hierarchy walk via _find_workfile_asset() and add find_upstream_workfile() to resolve the upstream step's published workfile asset, returning None for every unresolved case so referencing is skipped. - reference: add reference_published_workfile(), mirroring reference_revision() without its flow_draft_id guard, since a freshly built scene has no draft context yet. - flowam_actions: wire referencing into the build prep callback, Maya-gated like the SG-44787 publish check; a reference failure warns but never aborts. Co-authored-by: Cursor <cursoragent@cursor.com>
Cover find_upstream_workfile(): returns the upstream step's published workfile asset, and returns None with no configured upstream, an unsupported entity type, an unresolved workfile schema id, nothing published, or a Flow AM error. Co-authored-by: Cursor <cursoragent@cursor.com>
Custom loader actions defined their description but only the caption reached the UI. Surface the description as a tooltip, mirroring the built-in Refresh action (setToolTip plus driving the hovered signal, since QMenu shows no action tooltips on its own). Expand the Maya Build New Scene description to explain the new referencing/validation behavior driven by pipeline_step_dependencies. Co-authored-by: Cursor <cursoragent@cursor.com>
e77697e to
2ee69ab
Compare
Address review: drop the reference_published_workfile() mirror and instead add a require_asset_context flag to reference_revision(). Build New Scene calls it with require_asset_context=False, since the freshly created scene has no draft context yet - the only reason a separate function existed. The interactive reference action keeps the default (True), preserving its "open an asset first" guard. Co-authored-by: Cursor <cursoragent@cursor.com>
Address review: replace the find_upstream_workfile()/has_published_workfile() wrappers with one find_workfile_asset(sg_entity_type, ..., workfile_type) that resolves the root folder and workfile type internally and walks the hierarchy. It returns the workfile asset or None, and raises FlowError when the lookup cannot be performed (unknown entity type, unresolved schema id, or a query error) so callers can tell "not published" from "not checked". get_upstream_step() and the skip logging now live in the callers (find_unpublished_upstream_step and the referencing path), giving a simpler, shared traversal. Behavior of the pre-build publish warning is unchanged. Also note the deliberate "first workfile wins" simplification, per the review discussion about multiple workfiles under one step. Co-authored-by: Cursor <cursoragent@cursor.com>
Address review: drop the _prepare_build_scene()/_reference_upstream_step() wrappers and move the referencing into the default _prep_scene() callback, since this is a default pipeline opinion TDs can override rather than an extra layer of customization. The callback is bound at construction time again and works from sg_publish_data alone (deriving the pipeline step with a Task query), so there is no longer a need to set it after construction or pass create_inputs. Co-authored-by: Cursor <cursoragent@cursor.com>
| f'"{upstream_step}". Building without a reference. ({exc})' | ||
| ) | ||
| return | ||
| if workfile is None: |
There was a problem hiding this comment.
Do we need the same warning here as above if the workfile is not found (but no error is raised)? I assume we still want to warn the users in this case that the previous pipeline step is missing a workfile and therefore we have nothing to reference.
There was a problem hiding this comment.
Adding a debug log for internal purposes only. Pretty much the user was warned in the dialog while building the new scene.
| if workfile is None: | ||
| return | ||
|
|
||
| try: |
There was a problem hiding this comment.
Maybe add a comment here to explain the need for "require_asset_context=False". Example:
# Normally, referencing another asset is not allowed unless an asset is already opened within the DCC.
# Since we are in the process of creating an asset, we are not yet in a "complete" asset context, so
# we need to bypass this rule in this case.
| description = entity_action.get("description") | ||
| if description: | ||
| # QMenu does not show action tooltips on its own, so drive it | ||
| # from the hovered signal like the built-in actions above. | ||
| action.setToolTip(description) | ||
| action.hovered.connect(partial(action_hovered, action)) |
There was a problem hiding this comment.
Is this specifically related to this PR or just a bonus change?
There was a problem hiding this comment.
A bit of a bonus change but also related. I've improved the tooltip on hooks/tk-maya_actions.py to describe the asset management pipeline behavior. But that description wasn't being displayed anywhere. I fixed it so it can be visible on the tooltip when hovering the Build New Scene option in the context menu.
chenm1adsk
left a comment
There was a problem hiding this comment.
LGTM! Please address Yung's comment before merging
This pull request introduces a robust system for automatically referencing upstream pipeline step workfiles when building a new Maya scene, along with improvements to code structure, error handling, and test coverage. The main feature ensures that when a new scene is built for a dependent step (e.g., Rig or Texture), the published scene from its upstream step (e.g., Model) is referenced in, streamlining artist workflows and reducing manual steps.