From 2246ff2d3724db329abab266f4bf8b4296a33353 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Fri, 5 Apr 2024 09:42:16 -0700 Subject: [PATCH 1/2] fix: linting errors --- src/vbl_aquarium/build.py | 2 +- src/vbl_aquarium/models/dock.py | 14 ++++++----- src/vbl_aquarium/models/generic.py | 7 +++++- src/vbl_aquarium/models/urchin.py | 37 +++++++++++++++++++----------- 4 files changed, 39 insertions(+), 21 deletions(-) diff --git a/src/vbl_aquarium/build.py b/src/vbl_aquarium/build.py index 1c9f11a..ac4b463 100644 --- a/src/vbl_aquarium/build.py +++ b/src/vbl_aquarium/build.py @@ -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;", "") diff --git a/src/vbl_aquarium/models/dock.py b/src/vbl_aquarium/models/dock.py index 76b0bf4..964d5ed 100644 --- a/src/vbl_aquarium/models/dock.py +++ b/src/vbl_aquarium/models/dock.py @@ -13,17 +13,19 @@ class UploadModel(VBLBaseModel): data: str password: str + class DownloadModel(VBLBaseModel): password: str + # Models for sending save/load messages class SaveModel(VBLBaseModel): - filename: str = '' - bucket: str = '' - password: str = '' + filename: str = "" + bucket: str = "" + password: str = "" class LoadModel(VBLBaseModel): - filename: str = '' - bucket: str = '' - password: str = '' + filename: str = "" + bucket: str = "" + password: str = "" diff --git a/src/vbl_aquarium/models/generic.py b/src/vbl_aquarium/models/generic.py index e1266e3..d44c8ab 100644 --- a/src/vbl_aquarium/models/generic.py +++ b/src/vbl_aquarium/models/generic.py @@ -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 @@ -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 diff --git a/src/vbl_aquarium/models/urchin.py b/src/vbl_aquarium/models/urchin.py index 765862c..53342dd 100644 --- a/src/vbl_aquarium/models/urchin.py +++ b/src/vbl_aquarium/models/urchin.py @@ -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 @@ -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 @@ -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 \ No newline at end of file + max: float = 1 From 40676afb1aceed4069dc96946df1a63a4bd5fe4f Mon Sep 17 00:00:00 2001 From: Kenneth Yang <82800265+kjy5@users.noreply.github.com> Date: Fri, 5 Apr 2024 10:03:19 -0700 Subject: [PATCH 2/2] chore: Build Models (#25) --- models/schemas/urchin/LineModel.json | 2 +- models/schemas/urchin/ParticleSystemModel.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/schemas/urchin/LineModel.json b/models/schemas/urchin/LineModel.json index 09b5383..4ab354c 100644 --- a/models/schemas/urchin/LineModel.json +++ b/models/schemas/urchin/LineModel.json @@ -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"} \ No newline at end of file +{"$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"} \ No newline at end of file diff --git a/models/schemas/urchin/ParticleSystemModel.json b/models/schemas/urchin/ParticleSystemModel.json index 7e7512b..54a42fd 100644 --- a/models/schemas/urchin/ParticleSystemModel.json +++ b/models/schemas/urchin/ParticleSystemModel.json @@ -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"} \ No newline at end of file +{"$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"} \ No newline at end of file