Merge remote-tracking branch 'origin/feature/909-define-basic-trait-type-using-dataclasses' into feature/911-new-traits-based-integrator

This commit is contained in:
Ondřej Samohel 2024-12-04 12:01:11 +01:00
commit 8966c33bdd
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
4 changed files with 30 additions and 7 deletions

View file

@ -12,7 +12,7 @@ from .content import (
)
from .cryptography import DigitallySigned, GPGSigned
from .lifecycle import Persistent, Transient
from .meta import Tagged, TemplatePath
from .meta import Tagged, TemplatePath, Variant
from .representation import Representation
from .three_dimensional import Geometry, IESProfile, Lighting, Shader, Spatial
from .time import (
@ -71,6 +71,7 @@ __all__ = [
# meta
"Tagged",
"TemplatePath",
"Variant",
# two-dimensional
"Compressed",

View file

@ -51,3 +51,25 @@ class TemplatePath(TraitBase):
id: ClassVar[str] = "ayon.meta.TemplatePath.v1"
template: str = Field(..., title="Template Path")
data: dict = Field(..., title="Formatting Data")
class Variant(TraitBase):
"""Variant trait model.
This model represents a variant of the representation.
Example::
Variant(variant="high")
Variant(variant="prores444)
Attributes:
name (str): Trait name.
description (str): Trait description.
id (str): id should be namespaced trait name with version
variant (str): Variant name.
"""
name: ClassVar[str] = "Variant"
description: ClassVar[str] = "Variant Trait Model"
id: ClassVar[str] = "ayon.meta.Variant.v1"
variant: str = Field(..., title="Variant")

View file

@ -33,8 +33,8 @@ class TraitBase(ABC, BaseModel):
)
)
persitent: bool = Field(
default=True, title="Persitent",
persistent: bool = Field(
default=True, title="Persistent",
description="Whether the trait is persistent (integrated) or not.")
@property

View file

@ -21,18 +21,18 @@ REPRESENTATION_DATA = {
"file_path": Path("/path/to/file"),
"file_size": 1024,
"file_hash": None,
"persitent": True,
"persistent": True,
},
Image.id: {"persitent": True},
Image.id: {"persistent": True},
PixelBased.id: {
"display_window_width": 1920,
"display_window_height": 1080,
"pixel_aspect_ratio": 1.0,
"persitent": True,
"persistent": True,
},
Planar.id: {
"planar_configuration": "RGB",
"persitent": True,
"persistent": True,
},
}