Skip to content

Chore: Add families handling to create instances - #1994

Open
iLLiCiTiT wants to merge 15 commits into
developfrom
enhancement/add-families-handling-to-create-instances
Open

Chore: Add families handling to create instances#1994
iLLiCiTiT wants to merge 15 commits into
developfrom
enhancement/add-families-handling-to-create-instances

Conversation

@iLLiCiTiT

Copy link
Copy Markdown
Member

Changelog Description

Create instances have families that can be tracked and it is possible to listen to changes.

Additional info

CreatedInstance object now have families attribute stored under "families" key on the instance. It does allow to trigger value changes so a plugin can listen to the changes and show/hide attributes based on families.

This PR is preparation for other features, like #1818 .

Added helper decorator refresh_instance_attributes to easily trigger refresh of attribute definitions in most of the simple cases.

Testing notes:

Validate code changes.

Changing families in any way shape or form does trigger and value changed event for "families" key on an instance.

This PR should not break integrations where families were already filled during create phase!

@iLLiCiTiT
iLLiCiTiT requested a review from BigRoy August 11, 2026 12:09
@iLLiCiTiT iLLiCiTiT self-assigned this Aug 11, 2026
@iLLiCiTiT iLLiCiTiT added the type: enhancement Improvement of existing functionality or minor addition label Aug 11, 2026
@ynbot ynbot added the size/S label Aug 11, 2026

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 introduces first-class “families” handling on CreatedInstance objects so family changes can be tracked and reacted to (e.g. refreshing publish attribute definitions when families change).

Changes:

  • Added an InstanceFamilies helper on CreatedInstance to manage families and emit change events.
  • Updated publish-family matching logic to use the new CreatedInstance.families API.
  • Added a refresh_instance_attributes decorator to auto-refresh per-instance publish attribute definitions when selected instance keys change.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
client/ayon_core/pipeline/publish/publish_plugins.py Uses new families API in plugin-family matching; adds refresh_instance_attributes decorator to refresh attr defs on instance key changes.
client/ayon_core/pipeline/create/structures.py Introduces InstanceFamilies and wires it into CreatedInstance storage/origin tracking and change notifications.
Suppressed comments (2)

client/ayon_core/pipeline/publish/publish_plugins.py:547

  • The decorator name in this error message does not match the actual decorator (refresh_instance_attributes), which makes debugging harder.
        if not issubclass(plugin, AYONPyblishPluginMixin):
            raise TypeError(
                "Decorator 'refresh_attributes' can be used only on"
                " subclasses of AYONPyblishPluginMixin."
            )

client/ayon_core/pipeline/create/structures.py:899

  • CreatedInstance.origin_data exposes families as a set, while data_to_store() stores families as a list. That type mismatch will make TrackChangesItem think families changed even when they didn’t. Expose a JSON-serializable list here (preferably deterministic ordering).
        output["families"] = self.families.origin_data

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread client/ayon_core/pipeline/publish/publish_plugins.py Outdated
Comment thread client/ayon_core/pipeline/create/structures.py Outdated
Comment thread client/ayon_core/pipeline/create/structures.py
Comment thread client/ayon_core/pipeline/publish/publish_plugins.py
Comment thread client/ayon_core/pipeline/publish/publish_plugins.py Outdated
@ynbot ynbot moved this to Review In Progress in PR reviewing Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S type: enhancement Improvement of existing functionality or minor addition

Projects

Status: Review In Progress

Development

Successfully merging this pull request may close these issues.

5 participants