Skip to content

[Prefabs] Add modifiers#612

Open
bakpaul wants to merge 15 commits into
sofa-framework:25_04_work_on_new_prefabsfrom
bakpaul:26_03_add_modifiers
Open

[Prefabs] Add modifiers#612
bakpaul wants to merge 15 commits into
sofa-framework:25_04_work_on_new_prefabsfrom
bakpaul:26_03_add_modifiers

Conversation

@bakpaul
Copy link
Copy Markdown
Contributor

@bakpaul bakpaul commented May 19, 2026

Added implementation of modifiers as designed.

I've added 4 types of modifiers already :
Attachements (fixation + attachements between two object)
Footers (SimulationSettings (aka animation loop + constraint correction) + SimulationSolvers (ODE + Linear solvers))

They are registered at the right place already (in the graph, and in datas of the prefabs modified by them). To test it launch examples/stlib/node_modifier.py

@bakpaul bakpaul force-pushed the 26_03_add_modifiers branch from 1370256 to f1435ba Compare May 31, 2026 09:14

@ReusableMethod
def setupLagrangianCollision(node, displayFlags = "showVisualModels",backgroundColor=[1,1,1,1], parallelComputing=False, stick=False, alarmDistance=DEFAULT_VALUE, contactDistance=DEFAULT_VALUE, frictionCoef=0.0, tolerance=0.0, maxIterations=100, **kwargs):
def setupLagrangianCollision(node, enableCollision = True, displayFlags = "showVisualModels",backgroundColor=[1,1,1,1], parallelComputing=False, stick=False, alarmDistance=DEFAULT_VALUE, contactDistance=DEFAULT_VALUE, frictionCoef=0.0, tolerance=0.0, maxIterations=100, **kwargs):
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.

Why adding this boolean? Isn't setupLagrangianCollision always for collision?
Or did you forget to rename it to setupLagrangian or setupLagrangianConstraint?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we should change the method name. We should remove "Collision" everywhere, so the boolean will make sense

Comment thread splib/Testing.py
@@ -0,0 +1,41 @@
import dataclasses
import splib.mechanics.attachment as splib_att
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.

Minor but I would prefer import splib.mechanics.attachment as attachment. I would avoid renaming in general, if possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok I'll do it !

Comment thread examples/stlib/node_modifier.py Outdated
Comment on lines +108 to +109
touchedNodes = SimulationSettingsParameters._addConstraintCorrectionToMechanicalNodes(node[0], "LinearSolverConstraintCorrection", linearSolverPath = linearSolverPath)
return [owner] + touchedNodes
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.

We could simplify this code by adding a single GenericConstraintCorrection.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah ok, I'll instead add a parameter that adds this Generic one by default and if set to true will add the local one.

Comment thread stlib/node_modifiers/footers.py
bakpaul and others added 2 commits June 4, 2026 17:38
Co-authored-by: EulalieCoevoet <eulalie.coevoet@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants