From 86b438318173a1cc30de0b2e272a98aaba123574 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Thu, 4 Apr 2024 15:04:21 -0700 Subject: [PATCH] feat: defaults for save/load --- models/csharp/DockModels.cs | 8 ++++++-- models/csharp/UrchinModels.cs | 6 +++--- models/schemas/dock/LoadModel.json | 2 +- models/schemas/dock/SaveModel.json | 2 +- models/schemas/urchin/ParticleSystemModel.json | 2 +- src/vbl_aquarium/models/dock.py | 4 ++-- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/models/csharp/DockModels.cs b/models/csharp/DockModels.cs index 23cde17..0c25b0f 100644 --- a/models/csharp/DockModels.cs +++ b/models/csharp/DockModels.cs @@ -26,11 +26,13 @@ public DownloadModel(string password) [Serializable] public struct LoadModel { + public string Filename; public string Bucket; public string Password; - public LoadModel(string bucket, string password) + public LoadModel(string filename, string bucket, string password) { + Filename = filename; Bucket = bucket; Password = password; } @@ -39,11 +41,13 @@ public LoadModel(string bucket, string password) [Serializable] public struct SaveModel { + public string Filename; public string Bucket; public string Password; - public SaveModel(string bucket, string password) + public SaveModel(string filename, string bucket, string password) { + Filename = filename; Bucket = bucket; Password = password; } diff --git a/models/csharp/UrchinModels.cs b/models/csharp/UrchinModels.cs index eaadd86..3c91256 100644 --- a/models/csharp/UrchinModels.cs +++ b/models/csharp/UrchinModels.cs @@ -185,16 +185,16 @@ public MeshModel(string id, string shape, Vector3 position, Color color, Vector3 public struct ParticleSystemModel { public string ID; - public string Shape; + public int N; public string Material; public Vector3[] Positions; public float[] Sizes; public Color[] Colors; - public ParticleSystemModel(string id, string shape, string material, Vector3[] positions, float[] sizes, Color[] colors) + public ParticleSystemModel(string id, int n, string material, Vector3[] positions, float[] sizes, Color[] colors) { ID = id; - Shape = shape; + N = n; Material = material; Positions = positions; Sizes = sizes; diff --git a/models/schemas/dock/LoadModel.json b/models/schemas/dock/LoadModel.json index bc86bb5..6e7fbe6 100644 --- a/models/schemas/dock/LoadModel.json +++ b/models/schemas/dock/LoadModel.json @@ -1 +1 @@ -{"properties": {"Bucket": {"title": "Bucket", "type": "string"}, "Password": {"title": "Password", "type": "string"}}, "required": ["Bucket", "Password"], "title": "LoadModel", "type": "object"} \ No newline at end of file +{"properties": {"Filename": {"default": "", "title": "Filename", "type": "string"}, "Bucket": {"default": "", "title": "Bucket", "type": "string"}, "Password": {"default": "", "title": "Password", "type": "string"}}, "title": "LoadModel", "type": "object"} \ No newline at end of file diff --git a/models/schemas/dock/SaveModel.json b/models/schemas/dock/SaveModel.json index 5ab1e3d..0952685 100644 --- a/models/schemas/dock/SaveModel.json +++ b/models/schemas/dock/SaveModel.json @@ -1 +1 @@ -{"properties": {"Bucket": {"title": "Bucket", "type": "string"}, "Password": {"title": "Password", "type": "string"}}, "required": ["Bucket", "Password"], "title": "SaveModel", "type": "object"} \ No newline at end of file +{"properties": {"Filename": {"default": "", "title": "Filename", "type": "string"}, "Bucket": {"default": "", "title": "Bucket", "type": "string"}, "Password": {"default": "", "title": "Password", "type": "string"}}, "title": "SaveModel", "type": "object"} \ No newline at end of file diff --git a/models/schemas/urchin/ParticleSystemModel.json b/models/schemas/urchin/ParticleSystemModel.json index 013809f..7e7512b 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"}, "Shape": {"title": "Shape", "type": "string"}, "Material": {"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", "Shape", "Material", "Positions", "Sizes", "Colors"], "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": {"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 diff --git a/src/vbl_aquarium/models/dock.py b/src/vbl_aquarium/models/dock.py index c2f2da3..76b0bf4 100644 --- a/src/vbl_aquarium/models/dock.py +++ b/src/vbl_aquarium/models/dock.py @@ -18,12 +18,12 @@ class DownloadModel(VBLBaseModel): # Models for sending save/load messages class SaveModel(VBLBaseModel): - filename: str + filename: str = '' bucket: str = '' password: str = '' class LoadModel(VBLBaseModel): - filename: str + filename: str = '' bucket: str = '' password: str = ''