Skip to content

Use enum instead of bool for USD contribution variant - #1996

Merged
tadeas-hejnic merged 21 commits into
developfrom
1666-yn-0448-usd-contribution-set-as-default-variant-allow-to-not-set-at-all
Aug 18, 2026
Merged

Use enum instead of bool for USD contribution variant#1996
tadeas-hejnic merged 21 commits into
developfrom
1666-yn-0448-usd-contribution-set-as-default-variant-allow-to-not-set-at-all

Conversation

@tadeas-hejnic

@tadeas-hejnic tadeas-hejnic commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Changelog Description

This PR is adding an option to Set as default variant selection during 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 default

So 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:

  1. False -> Set as default if no current default
  2. True -> Set as default

The new option is Do not set, which really doesn't set the default even if there is no default yet.

Testing notes:

  1. test publish with all possible choices in Set as default variant selection and check if it matches the settings
  2. test conversion from older settings:
    • False -> Set as default if no current default
    • True -> Set as default

@tadeas-hejnic tadeas-hejnic self-assigned this Aug 12, 2026
@ynbot ynbot added the size/S label Aug 12, 2026
@tadeas-hejnic tadeas-hejnic changed the title [YN-0448] Use enum instead of bool for USD contribution variant Use enum instead of bool for USD contribution variant Aug 12, 2026
@tadeas-hejnic tadeas-hejnic added sponsored This is directly sponsored by a client or community member type: enhancement Improvement of existing functionality or minor addition labels Aug 12, 2026
Comment thread server/settings/publish_plugins.py Outdated
@ynbot ynbot moved this to Review In Progress in PR reviewing Aug 12, 2026
Comment thread server/settings/publish_plugins.py Outdated
Comment thread server/settings/conversion.py
@tadeas-hejnic

tadeas-hejnic commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

My test workflow

Tested all combinations of the new default variant selection policy, both with and without an existing variant selection.

  • never with no existing selection

    • Published a new variant to a clean target.
    • Verified that the variant was added.
    • Verified that no variant selection was authored.
  • if_not_set with no existing selection

    • Published a new variant to a clean target.
    • Verified that the variant was added.
    • Verified that it became the selected/default variant.
  • always with no existing selection

    • Published a new variant to a clean target.
    • Verified that the variant was added.
    • Verified that it became the selected/default variant.
  • never with an existing selection

    • Published an additional variant to a target that already had Base selected.
    • Verified that the new variant was added.
    • Verified that the existing Base selection was preserved.
  • if_not_set with an existing selection

    • Published an additional variant to the same target.
    • Verified that the new variant was added.
    • Verified that the existing Base selection was preserved.
  • always with an existing selection

    • Published an additional variant to the same target.
    • Verified that the new variant was added.
    • Verified that the existing selection was overridden and changed to the newly published variant.

All six policy scenarios behaved as expected.

@tadeas-hejnic
tadeas-hejnic marked this pull request as ready for review August 12, 2026 13:52

@BigRoy BigRoy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, very solid!

Should we rename key if_missing to if_not_set?

@MustafaJafar can you give it a spin?

Comment thread client/ayon_core/plugins/publish/extract_usd_layer_contributions.py Outdated
Comment thread client/ayon_core/plugins/publish/extract_usd_layer_contributions.py
@BigRoy
BigRoy requested review from iLLiCiTiT and a lite review from Copilot August 12, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_policy with three modes: if_missing, always, never (server settings + client publish attributes).
  • Adds a server-side settings conversion to map legacy contribution_variant_is_default booleans 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.

Comment thread server/settings/conversion.py Outdated
tadeas-hejnic and others added 3 commits August 13, 2026 09:34
Co-authored-by: Roy Nieterau <roy_nieterau@hotmail.com>
Comment thread client/ayon_core/plugins/publish/extract_usd_layer_contributions.py Outdated
Comment thread client/ayon_core/plugins/publish/extract_usd_layer_contributions.py Outdated
Comment thread server/settings/conversion.py Outdated
Comment thread server/settings/conversion.py Outdated
Comment thread server/settings/conversion.py Outdated
Comment thread client/ayon_core/plugins/publish/extract_usd_layer_contributions.py
tadeas-hejnic and others added 7 commits August 17, 2026 13:35
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>
@tadeas-hejnic

Copy link
Copy Markdown
Contributor Author

Tested after the changes suggested by @iLLiCiTiT and everything works.

@github-project-automation github-project-automation Bot moved this from Review In Progress to Merge Requested in PR reviewing Aug 18, 2026
Comment thread client/ayon_core/plugins/publish/extract_usd_layer_contributions.py Outdated
@ynbot ynbot moved this from Merge Requested to Review In Progress in PR reviewing Aug 18, 2026

@BigRoy BigRoy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just some cosmetic notes only left.

Comment thread client/ayon_core/plugins/publish/extract_usd_layer_contributions.py
@github-project-automation github-project-automation Bot moved this from Review In Progress to Merge Requested in PR reviewing Aug 18, 2026
@ynbot ynbot moved this from Merge Requested to Review In Progress in PR reviewing Aug 18, 2026
tadeas-hejnic and others added 2 commits August 18, 2026 10:22
Co-authored-by: Roy Nieterau <roy_nieterau@hotmail.com>
@github-project-automation github-project-automation Bot moved this from Review In Progress to Merge Requested in PR reviewing Aug 18, 2026
@tadeas-hejnic
tadeas-hejnic merged commit 08ba6f4 into develop Aug 18, 2026
4 checks passed
@tadeas-hejnic
tadeas-hejnic deleted the 1666-yn-0448-usd-contribution-set-as-default-variant-allow-to-not-set-at-all branch August 18, 2026 08:29
@github-project-automation github-project-automation Bot moved this from Merge Requested to Done in PR reviewing Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S sponsored This is directly sponsored by a client or community member type: enhancement Improvement of existing functionality or minor addition

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

YN-0448: USD contribution: set as default variant allow to not set at all

6 participants