Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dbirman committed Apr 10, 2024
2 parents 9c381e7 + 40676af commit 9c4c11a
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion models/schemas/urchin/LineModel.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"$defs": {"Color": {"properties": {"r": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "R", "type": "number"}, "g": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "G", "type": "number"}, "b": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "B", "type": "number"}, "a": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "A", "type": "number"}}, "title": "Color", "type": "object"}, "Vector3": {"properties": {"x": {"default": 0.0, "title": "X", "type": "number"}, "y": {"default": 0.0, "title": "Y", "type": "number"}, "z": {"default": 0.0, "title": "Z", "type": "number"}}, "title": "Vector3", "type": "object"}}, "properties": {"ID": {"title": "Id", "type": "string"}, "Positions": {"default": [], "items": {"$ref": "#/$defs/Vector3"}, "title": "Positions", "type": "array"}, "Color": {"allOf": [{"$ref": "#/$defs/Color"}], "default": {"r": 1.0, "g": 1.0, "b": 1.0, "a": 1.0}}}, "required": ["ID"], "title": "LineModel", "type": "object"}
{"$defs": {"Color": {"properties": {"r": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "R", "type": "number"}, "g": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "G", "type": "number"}, "b": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "B", "type": "number"}, "a": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "A", "type": "number"}}, "title": "Color", "type": "object"}, "Vector3": {"properties": {"x": {"default": 0.0, "title": "X", "type": "number"}, "y": {"default": 0.0, "title": "Y", "type": "number"}, "z": {"default": 0.0, "title": "Z", "type": "number"}}, "title": "Vector3", "type": "object"}}, "properties": {"ID": {"title": "Id", "type": "string"}, "Positions": {"items": {"$ref": "#/$defs/Vector3"}, "title": "Positions", "type": "array"}, "Color": {"allOf": [{"$ref": "#/$defs/Color"}], "default": {"r": 1.0, "g": 1.0, "b": 1.0, "a": 1.0}}}, "required": ["ID"], "title": "LineModel", "type": "object"}
2 changes: 1 addition & 1 deletion models/schemas/urchin/ParticleSystemModel.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"$defs": {"Color": {"properties": {"r": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "R", "type": "number"}, "g": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "G", "type": "number"}, "b": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "B", "type": "number"}, "a": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "A", "type": "number"}}, "title": "Color", "type": "object"}, "Vector3": {"properties": {"x": {"default": 0.0, "title": "X", "type": "number"}, "y": {"default": 0.0, "title": "Y", "type": "number"}, "z": {"default": 0.0, "title": "Z", "type": "number"}}, "title": "Vector3", "type": "object"}}, "properties": {"ID": {"title": "Id", "type": "string"}, "N": {"title": "N", "type": "integer"}, "Material": {"default": "circle", "title": "Material", "type": "string"}, "Positions": {"default": [], "items": {"$ref": "#/$defs/Vector3"}, "title": "Positions", "type": "array"}, "Sizes": {"default": [], "items": {"type": "number"}, "title": "Sizes", "type": "array"}, "Colors": {"default": [], "items": {"$ref": "#/$defs/Color"}, "title": "Colors", "type": "array"}}, "required": ["ID", "N"], "title": "ParticleSystemModel", "type": "object"}
{"$defs": {"Color": {"properties": {"r": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "R", "type": "number"}, "g": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "G", "type": "number"}, "b": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "B", "type": "number"}, "a": {"default": 1, "maximum": 1.0, "minimum": 0.0, "title": "A", "type": "number"}}, "title": "Color", "type": "object"}, "Vector3": {"properties": {"x": {"default": 0.0, "title": "X", "type": "number"}, "y": {"default": 0.0, "title": "Y", "type": "number"}, "z": {"default": 0.0, "title": "Z", "type": "number"}}, "title": "Vector3", "type": "object"}}, "properties": {"ID": {"title": "Id", "type": "string"}, "N": {"title": "N", "type": "integer"}, "Material": {"default": "circle", "title": "Material", "type": "string"}, "Positions": {"items": {"$ref": "#/$defs/Vector3"}, "title": "Positions", "type": "array"}, "Sizes": {"items": {"type": "number"}, "title": "Sizes", "type": "array"}, "Colors": {"items": {"$ref": "#/$defs/Color"}, "title": "Colors", "type": "array"}}, "required": ["ID", "N"], "title": "ParticleSystemModel", "type": "object"}
2 changes: 1 addition & 1 deletion src/vbl_aquarium/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def remove_ignored_classes(module):

# Move using statement to top
output = "using System;\n" + output

if "using UnityEngine;" in output:
output = "using UnityEngine;\n" + output.replace("using UnityEngine;", "")

Expand Down
7 changes: 6 additions & 1 deletion src/vbl_aquarium/models/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
class IDData(VBLBaseModel):
id: str = Field(..., alias="ID")


class Vector2Data(VBLBaseModel):
id: str = Field(alias= "ID")
id: str = Field(alias="ID")
value: Vector2


class Vector3Data(VBLBaseModel):
id: str = Field(..., alias="ID")
value: Vector3
Expand Down Expand Up @@ -80,14 +82,17 @@ class BoolList(VBLBaseModel):
class IDList(VBLBaseModel):
ids: list[str] = Field(..., alias="IDs")


class IDListVector2Data(VBLBaseModel):
ids: list[str] = Field(..., alias="IDs")
value: Vector2


class IDListVector2List(VBLBaseModel):
ids: list[str] = Field(..., alias="IDs")
values: list[Vector2]


class IDListVector3Data(VBLBaseModel):
ids: list[str] = Field(..., alias="IDs")
value: Vector3
Expand Down
37 changes: 24 additions & 13 deletions src/vbl_aquarium/models/urchin.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,16 @@ class CameraMode(str, Enum):
zoom: float = 16
pan: Vector2 = Vector2()
mode: CameraMode = CameraMode.orthographic
background_color: Color = Color() # white by default
background_color: Color = Color() # white by default
controllable: bool = True
main: bool = False


class CameraRotationModel(VBLBaseModel):
start_rotation: Vector3
end_rotation: Vector3


# Individual mesh neuron


Expand All @@ -96,15 +98,19 @@ class MeshModel(VBLBaseModel):
material: str
interactive: bool


# Lines



class LineModel(VBLBaseModel):
id: str = Field(alias="ID")
positions: list[Vector3] = []
positions: list[Vector3] = Field(default_factory=list)
color: Color = Color()


# Probes



class ProbeModel(VBLBaseModel):
id: str = Field(alias="ID")
position: Vector3
Expand All @@ -113,30 +119,35 @@ class ProbeModel(VBLBaseModel):
style: str
scale: Vector3


# Particle group


class ParticleSystemModel(VBLBaseModel):
id: str = Field(alias="ID")
n: int
material: str = 'circle'
material: str = "circle"

positions: list[Vector3] = Field(default_factory=list)
sizes: list[float] = Field(default_factory=list)
colors: list[Color] = Field(default_factory=list)

positions: list[Vector3] = []
sizes: list[float] = []
colors: list[Color] = []

# Text



class TextModel(VBLBaseModel):
id: str = Field(alias="ID")
text: str
color: Color = Color(r = 0, g = 0, b = 0)
color: Color = Color(r=0, g=0, b=0)
font_size: int = 12
position: Vector2 = Vector2()


# Utilities



class ColormapModel(VBLBaseModel):
name: str = ''
name: str = ""
min: float = 0
max: float = 1
max: float = 1

0 comments on commit 9c4c11a

Please sign in to comment.