Skip to content

Conversation

@damienmarchal
Copy link
Contributor

Currently accessing:

forcefield.mstate.position

does not work because forcefield.mstate is a link and thus a link does not have a "position" field.
The working version consist to write object.mstate.getLinkedBase().position which is very cumbersome to write.

This PR adds support for attribute forwarding through link allowing the firt approach.
The added feature is tested.

Currently accessing:
```python
forcefield.mstate.position
```
does not work because forcefield.mstate is a link and thus a link does not have a "position" field.
The working version consist to write ```object.mstate.getLinkedBase().position``` which is very cumbersome to write.

This PR adds support for attribute forwarding through link allowing the firt approach.
The code in binding/Sofa/tests/Core/PythonRestShapeForceField.py seems outdated and not used anymore for testings.
A fully working example is in examples/PythonRestShapeForceField.py

So let's remove the one that is broken and not used.
Fixe

Co-authored-by: Jean-Nicolas Brunet <jnbrunet2000@gmail.com>
@damienmarchal
Copy link
Contributor Author

Many thank @jnbrunet for the review and suggestion.

@fredroy
Copy link
Contributor

fredroy commented Oct 26, 2021

One test is failing, the solution is just add
root.addObject("RequiredPlugin", name="SofaDeformable") line 9 in BaseLink.py

@guparan guparan modified the milestones: v21.06, v21.12 Oct 26, 2021
@hugtalbot
Copy link
Contributor

Test failing because test needs SofaDeformable to use RestShapeSpringForceField

@damienmarchal
Copy link
Contributor Author

@hugtalbot, @fredroy tests are not failing anymore.

@damienmarchal damienmarchal merged commit f1140e9 into sofa-framework:master Oct 29, 2021
@damienmarchal
Copy link
Contributor Author

Ready....so merge.

@damienmarchal damienmarchal deleted the pr-add-baselink-attribute-forwarding branch June 8, 2022 13:15
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.

5 participants