ayon-core icon indicating copy to clipboard operation
ayon-core copied to clipboard

Define basic trait type using dataclasses

Open antirotor opened this issue 5 months ago • 0 comments

[!NOTE] This is part Representation Schemas Epic effort

We need to define basic Trait types as Pydantic models or even just plain python dataclasses.

Traits are schemas/types thing to descibe expected properties of given representation. So if something has a path on storage, it defines the LocatableContent trait with its property - path. If it is also an image, it will define a PlanarImage trait that has things like resolutionWidth and resolutionHeight, etc.

Initial idea was to use OpenAssetIO and its Media Creation Traits and Specifications, but since we don't internally need to use OpenAssetIOn for asset resolution, we don't need the whole complexity and dependance on third party framework.

Some compatibility with OpenAssetIO traits can be maintained by having tool that will transform AYON dataclasses back to traits YAML files. This shouldn't be an issue if we either use same names for properties or create some mapping later on, bigger problem is limited type support in OpenAssetIO.

So what are the traits we need? This table isn't really complete, also be aware that media creation defined traits (marked with * in the OpenAssetIO column might change during the time.

scope name properties OpenAssetIO note
twoDimensional Image - * Family (type) trait
PixelBased
  • displayWindowWidth
  • displayWindowHeight
  • pixelAspectRatio
*
Planar - * To distinguish from Deep 👇🏻
Deep - * For deep data
Compressed
  • compressionType
AYON we might need more properties
Overscan
  • width
  • height
AYON for over/underscan - total width PixelBased.displayWindowWidth + ###
threeDimensional Spatial
  • upAxis
  • handedness
  • metersPerUnit
* Family (type) trait
Geometry - *
Shader - *
Lighting - *
IESProfile - *
timeDomain FrameRanged
  • startFrame
  • endFrame
  • inFrame
  • outFrame
  • framesPerSecond
  • step
*
Static -
Handles
  • startHandle
  • endHandle
  • inclusive
AYON
color ColorManaged
  • colorspace
*
content LocatableContent
  • location
  • mimeType
  • isTemplated
* location is URI, isTemplated indicates that variables there needs to be expanded before load
LocatableBundle
  • locations
  • mimeTypes
  • isTemplated []
  • sizes
  • hashes
AYON for multiple files defining one singular representation
audio Audio - * Family (type) trait
SampleBased - *
cryptography DigitallySigned - AYON Family (type) trait
GPG
  • keyId
  • fingerprint
  • timestamp
AYON for GPG signatures

Example:

EXR Sequence can be described with following traits Image, PixelBased, Planar, FrameRanged, LocatableContent.

antirotor avatar Sep 23 '24 15:09 antirotor