From 539e54902a2d6c4d6a317043129df6927d11a269 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 14 Sep 2025 13:11:53 +0200 Subject: [PATCH] Added keyframes and tracks --- src/models.py | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/src/models.py b/src/models.py index 405393e..eb607e1 100644 --- a/src/models.py +++ b/src/models.py @@ -1,25 +1,29 @@ from dataclasses import dataclass from enum import Enum +from decimal import Decimal + @dataclass class SpaceVector: """A 3-dimensional coordinate structure with clear orientation.""" - + lr: float """Left-to-Right.""" - + tb: float """Top-to-Bottom.""" - + fb: float """Front-to-Behind.""" + class Capabilities(Enum): SWITCH = "switch" BRIGHTNESS = "brightness" TEMPERATURE = "temperature" COLOR = "color" + @dataclass class Fixture: """Definition of a fixture that generates light, its capabilities and positioning.""" @@ -45,6 +49,7 @@ class Fixture: exposure: float """In range [0,1], how exposed is the light source of the fixture. 0: no exposure. 1: full exposure.""" + @dataclass class Space: """A space containing fixtures.""" @@ -62,6 +67,37 @@ class Space: """A reference point in the space from which the audience perspective might be assumed.""" +@dataclass +class Keyframe: + """State description for a specified point in time.""" + + time: Decimal + """Point of time of the keyframe. Stored as decimal for high precision.""" + + parameter: str + """Parameter targeted by frame value.""" + + value: None | bool | float | int | str = None + """Targeted state value reached by reaching the keyframe.""" + + +@dataclass +class Track: + """Contains a sequence of keyframes for specified fixtures.""" + + id: str + """Unique identifier for track.""" + + name: str + """Human readable name.""" + + fixture_ids: list[str] + """Fixtures by ids targeted by track.""" + + keyframes: list[Keyframe] + """Sequence of keyframes describing actions""" + + @dataclass class Sequence: """A sequence of light events described over fixtures.""" @@ -72,8 +108,6 @@ class Sequence: name: str """Human readable name.""" - - @dataclass class Event: