Chore: Add families handling to create instances - #1994
Open
iLLiCiTiT wants to merge 15 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
InstanceFamilieshelper onCreatedInstanceto manage families and emit change events. - Updated publish-family matching logic to use the new
CreatedInstance.familiesAPI. - Added a
refresh_instance_attributesdecorator 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog Description
Create instances have families that can be tracked and it is possible to listen to changes.
Additional info
CreatedInstance object now have
familiesattribute 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_attributesto 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!