Skip to content

Commit

Permalink
Merge pull request #169 from segments-ai/add-new-attribute-types
Browse files Browse the repository at this point in the history
Add quaternion and vector3 attribute types
  • Loading branch information
dbbert committed Mar 15, 2024
2 parents 0f04680 + e1bbcc5 commit 1d7d634
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/segments/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ class InputType(str, Enum):
TEXT = "text"
NUMBER = "number"
CHECKBOX = "checkbox"
VECTOR3 = "vector3"
QUATERNION = "quaternion"


class CameraDistortionModel(str, Enum):
Expand Down Expand Up @@ -189,7 +191,7 @@ class Subscription(str, Enum):
FormatVersion = Union[float, str]
ObjectAttributes = Dict[str, Optional[Union[str, bool, int]]]
ImageAttributes = Dict[str, Optional[Union[str, bool, int]]]
Timestamp = Union[str, int]
Timestamp = Union[str, int, float]


###########
Expand Down Expand Up @@ -689,6 +691,7 @@ class SelectTaskAttribute(BaseModel):
values: List[str]
default_value: Optional[str] = None
is_mandatory: Optional[bool] = None
is_track_level: Optional[bool] = None


class TextTaskAttribute(BaseModel):
Expand Down Expand Up @@ -720,13 +723,30 @@ class CheckboxTaskAttribute(BaseModel):
name: str
input_type: Literal[InputType.CHECKBOX]
default_value: Optional[bool] = None
is_track_level: Optional[bool] = None


class Vector3TaskAttribute(BaseModel):
name: str
input_type: Literal[InputType.VECTOR3]
is_mandatory: Optional[bool] = None
is_track_level: Optional[bool] = None


class QuaternionTaskAttribute(BaseModel):
name: str
input_type: Literal[InputType.QUATERNION]
is_mandatory: Optional[bool] = None
is_track_level: Optional[bool] = None


TaskAttribute = Union[
SelectTaskAttribute,
TextTaskAttribute,
NumberTaskAttribute,
CheckboxTaskAttribute,
Vector3TaskAttribute,
QuaternionTaskAttribute,
]


Expand Down

0 comments on commit 1d7d634

Please sign in to comment.