Skip to content

[Prefabs] dataclasses to pydantic BaseModel - #607

Open
EulalieCoevoet wants to merge 53 commits into
sofa-framework:25_04_work_on_new_prefabsfrom
EulalieCoevoet:pr_basemodelpydantic
Open

[Prefabs] dataclasses to pydantic BaseModel#607
EulalieCoevoet wants to merge 53 commits into
sofa-framework:25_04_work_on_new_prefabsfrom
EulalieCoevoet:pr_basemodelpydantic

Conversation

@EulalieCoevoet

@EulalieCoevoetEulalieCoevoet commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Example of usage:

myParameters=""" name: Sphere material: type: RigidMaterialParameters position: [[-1.5, 0, 0, 0, 0, 0, 1]] visual: color: [0., 1., 0., 0.2] geometry:  type: FileParameters  filename: mesh/sphere.obj """simulation.add(Entity, parameters=EntityParameters.fromYaml(myParameters))

hugtalbotand others added 18 commits April 8, 2026 17:33
* working deformable entity
* [splib] fixes match case
* [stlib] WIP on extract.py
* Add Sofa.Core.Node.add with preliminary test
* rename the "add" function and make it private
* Apply suggestions from code review
Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
---------
Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
* Reorder files to match concepts
* Put every prefab in root to avoid having a useless prefix
* Fix bad import in bunny example
* Update examples/stlib/PrefabScene_beginner.py
Co-authored-by: EulalieCoevoet <eulalie.coevoet@gmail.com>
---------
Co-authored-by: EulalieCoevoet <eulalie.coevoet@gmail.com>
* cleaning to fix deformable example
* Restore checks on name and add check on the presence of parameters
* Allow to use default parameters (passing nothing to the add method except the class name
---------
Co-authored-by: Paul Baksic <paul.baksic@outlook.fr>
Because currently only Rigid3::VecCoord was supported.
commit b0cffe7
Author: bakpaul <paul.baksic@outlook.fr>
Date: Tue Mar 3 10:17:06 2026 +0100
Dump ideas
commit 4baade5
Author: Damien Marchal <damien.marchal@univ-lille1.fr>
Date: Thu Oct 30 16:06:25 2025 +0100
Register in the PythonFactory Rigid3::Coord (sofa-framework#544)
Because currently only Rigid3::VecCoord was supported.
commit dd6865e
Author: bakpaul <paul.baksic@outlook.fr>
Date: Mon Mar 2 14:26:25 2026 +0100
Make exctracted topo working'
commit de007a3
Author: Paul Baksic <paul.baksic@outlook.fr>
Date: Wed Oct 29 17:31:41 2025 +0100
Added S, but still need to make the free motion not crash
commit d3148a5
Author: Paul Baksic <paul.baksic@outlook.fr>
Date: Wed Oct 29 12:21:41 2025 +0100
Fix plane and some splib deprecated components
commit d2c120e
Author: Paul Baksic <paul.baksic@outlook.fr>
Date: Tue Oct 28 18:22:41 2025 +0100
Add plane, still need to really implement function + started creating the scene
- uses dynapydantic
- adds fromYaml and fromDict methods for parameters
- adds prefabs: cube, sphere and bunny
- and some cleaning
@bakpaul
bakpaulforce-pushed the 25_04_work_on_new_prefabs branch 2 times, most recently from 55ff092 to 09c1c67CompareMay 19, 2026 15:19
Comment threadsplib/core/utils.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I forgot that we wanted to have this. At one point we'll need to merge this with the node modifier part.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unrelated but fine by me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is something I've implemented as a node modifier. Maybe this needs a discussion. Could you put it in another pr ?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Indeed, sorry I forgot. Will do.

Sign up for freeto 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.

4 participants

@EulalieCoevoet@bakpaul@hugtalbot@damienmarchal