Skip to content

Tools: Objects data conversions - #1988

Merged
iLLiCiTiT merged 6 commits into
developfrom
enhancement/objects-data-conversions
Aug 10, 2026
Merged

iLLiCiTiT merged 6 commits into
developfrom
enhancement/objects-data-conversions

Conversation

@iLLiCiTiT

@iLLiCiTiT iLLiCiTiT commented Aug 6, 2026

Copy link
Copy Markdown
Member

Changelog Description

Add to_data and from_data conversions for objects used in UIs.

Additional info

Some of the methods were already there but had bugs in it. Some of the existing classes were converted to dataclasses. There will be more similar PRs that might change them more.

Removed forgotten FolderItem and TaskItem in workfiles abstract definition that were not used.

This is a preparation for future implementation of IPC communication #1987 .

Testing notes:

  1. Validate code changes.

The PR might be clashing with changes in #1949 . This PR should be merged after that PR.

@iLLiCiTiT
iLLiCiTiT requested a review from BigRoy August 6, 2026 15:55
@iLLiCiTiT iLLiCiTiT self-assigned this Aug 6, 2026
@iLLiCiTiT iLLiCiTiT added the type: enhancement Improvement of existing functionality or minor addition label Aug 6, 2026
@ynbot ynbot added the size/M label Aug 6, 2026
# Conflicts:
#	client/ayon_core/tools/publisher/abstract.py
#	client/ayon_core/tools/publisher/models/create.py
#	client/ayon_core/tools/publisher/models/publish.py
# Conflicts:
#	client/ayon_core/tools/loader/abstract.py
#	client/ayon_core/tools/workfiles/abstract.py

@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.

Works for me in Fusion, Blender and Maya. And changes LGTM.

@iLLiCiTiT
iLLiCiTiT merged commit d056624 into develop Aug 10, 2026
4 checks passed
@iLLiCiTiT
iLLiCiTiT deleted the enhancement/objects-data-conversions branch August 10, 2026 14:24

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 standardizes UI-facing model objects around explicit to_data / from_data conversions to support future IPC-based tool execution, and removes unused legacy items from the workfiles abstraction.

Changes:

  • Added/expanded to_data and from_data serialization for multiple tool model objects (workfiles, publisher, loader, common models).
  • Converted several lightweight “item” classes to @dataclass for clearer structure and easier (de)serialization.
  • Cleaned up workfiles abstractions by removing unused FolderItem/TaskItem definitions.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
client/ayon_core/tools/workfiles/abstract.py Removes unused legacy items and adds to_data/from_data for workarea/published workfile wrappers.
client/ayon_core/tools/publisher/models/create.py Adds to_data/from_data for instance-related UI model items and updates typing.
client/ayon_core/tools/publisher/abstract.py Adds attribute-def serialization helpers and to_data/from_data for publish attribute structures.
client/ayon_core/tools/loader/abstract.py Converts loader UI structures to dataclasses and adds/updates serialization helpers.
client/ayon_core/tools/common_models/users.py Introduces UserItem dataclass and adds to_data/from_data.
client/ayon_core/tools/common_models/projects.py Adds/updates serialization for project/common items and icon mapping structures.
client/ayon_core/tools/common_models/init.py Exposes UserItem from the common_models package.
client/ayon_core/pipeline/create/structures.py Adds to_data/from_data for InstanceContextInfo to support transport/IPC.
Suppressed comments (2)

client/ayon_core/tools/loader/abstract.py:335

  • ActionItem.to_data currently returns the icon object directly. Call sites pass AwesomeFontIcon/MaterialSymbolsIcon instances, which are not JSON-serializable for IPC; similarly from_data does not rebuild IconBase from the serialized dict.
            identifier=self.identifier,
            label=self.label,
            group_label=self.group_label,
            icon=self.icon,
            tooltip=self.tooltip,

client/ayon_core/tools/loader/abstract.py:120

  • ProductItem.to_data returns product_icon as-is. icons_mapping.get_icon now yields IconBase instances, so this will embed a non-serializable object into the data payload; from_data also doesn't rebuild the icon definition.
            product_type=self.product_type,
            product_base_type=self.product_base_type,
            product_name=self.product_name,
            product_icon=self.product_icon,
            product_in_scene=self.product_in_scene,

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

Comment on lines +37 to +41
name: str
icon: dict[str, Any]

def to_data(self):
return {
"name": self.name,
"icon": self.icon,
}
return dict(name=self.name, icon=self.icon)

@dataclass
class ProductItem:
"""Product item with it versions.
Comment on lines 244 to +248
if isinstance(icon, dict):
return icon.copy()
return icon

def _get_default_def(self) -> dict[str, str]:
def _get_default_def(self) -> MaterialSymbolsIcon:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants