Use enum instead of bool for USD contribution variant - #1996
Conversation
…ult-variant-allow-to-not-set-at-all
My test workflowTested all combinations of the new default variant selection policy, both with and without an existing variant selection.
All six policy scenarios behaved as expected. |
There was a problem hiding this comment.
Cool, very solid!
Should we rename key if_missing to if_not_set?
@MustafaJafar can you give it a spin?
There was a problem hiding this comment.
Pull request overview
This PR replaces the USD contribution “set variant as default” boolean with an enum-style policy to support a third option (“do not set”), while preserving legacy behavior through settings conversion and backward-compatible fallbacks in the publisher.
Changes:
- Introduces
contribution_variant_default_policywith three modes:if_missing,always,never(server settings + client publish attributes). - Adds a server-side settings conversion to map legacy
contribution_variant_is_defaultbooleans to the new enum values. - Updates USD layer contribution extraction to author default variant selection based on the selected policy.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| server/settings/publish_plugins.py | Adds the enum-based setting and updates default publish profiles to use it. |
| server/settings/conversion.py | Adds a conversion step to migrate legacy boolean settings to the new enum field. |
| client/ayon_core/plugins/publish/extract_usd_layer_contributions.py | Updates publish attribute UI + extraction logic to use the new policy and keep backward compatibility. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Roy Nieterau <roy_nieterau@hotmail.com>
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
|
Tested after the changes suggested by @iLLiCiTiT and everything works. |
BigRoy
left a comment
There was a problem hiding this comment.
LGTM - just some cosmetic notes only left.
Co-authored-by: Roy Nieterau <roy_nieterau@hotmail.com>
Changelog Description
This PR is adding an option to
Set as default variant selectionduring the publishing. Before there was only toggle that has this behaviour:-
True: Always set the variant as default-
False: Set as the default only if there is no defaultSo it wasn't possible to
Don't set the variant as default if the default is not set yet. The current implementation is adding this option and maps also the previous values to the new enum.Additional info
The conversion is done this way to keep the behaviour of the previous implementation the same:
False->Set as default if no current defaultTrue->Set as defaultThe new option is
Do not set, which really doesn't set the default even if there is no default yet.Testing notes:
Set as default variant selectionand check if it matches the settingsFalse->Set as default if no current defaultTrue->Set as default