Skip to content

Add basic serialization to the ECS#24

Merged
thomas-gale merged 5 commits intomainfrom
serialize_ecs
Feb 3, 2025
Merged

Add basic serialization to the ECS#24
thomas-gale merged 5 commits intomainfrom
serialize_ecs

Conversation

@robertgoss
Copy link
Collaborator

It would be usefulto beable to dump and load the scene.

We add the ability to dump and load the scene from json. We use python's json library to do this (for now) and add methods to dump / load objects to a python object which can then be dumped / loaded.

@robertgoss robertgoss marked this pull request as ready for review January 11, 2025 14:34
Copy link
Owner

@thomas-gale thomas-gale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good idea @robertgoss!

I'll create a task for me to write some tests in the future #26

@thomas-gale
Copy link
Owner

Ah looks like a few issues have crept in merging main, let me take a look

@thomas-gale
Copy link
Owner

% magic run test 
Task 'setup' can be skipped (cache hit) 🚀
Included from /Users/galet/dev/mo3d/src/mo3d/ecs/__init__.mojo:1:
/Users/galet/dev/mo3d/src/mo3d/ecs/component_store.mojo:362:64: error: invalid call to 'aabb': could not deduce parameter 'T' of callee 'aabb'
                        store.geometry_components[geom_id].aabb())
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
Included from /Users/galet/dev/mo3d/src/mo3d/ecs/__init__.mojo:1:
/Users/galet/dev/mo3d/src/mo3d/ecs/component_store.mojo:362:64: note: failed to infer parameter 'T', parameter isn't used in any argument
                        store.geometry_components[geom_id].aabb())
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
Included from /Users/galet/dev/mo3d/src/mo3d/geometry/__init__.mojo:1:
/Users/galet/dev/mo3d/src/mo3d/geometry/geometry.mojo:80:8: note: function declared here
    fn aabb[T: DType, dim: Int](self) -> AABB[T, dim]:
       ^
/Users/galet/dev/mo3d/.magic/envs/default/bin/mojo: error: failed to parse the provided Mojo source module

@thomas-gale
Copy link
Owner

The error is resolved.

@thomas-gale thomas-gale merged commit 9881f02 into main Feb 3, 2025
3 of 4 checks passed
@thomas-gale thomas-gale deleted the serialize_ecs branch February 3, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants