-
Notifications
You must be signed in to change notification settings - Fork 48
[SofaPython3] Changes how addObject process its arguments when they are of type: numpy & data #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
damienmarchal
merged 10 commits into
sofa-framework:master
from
CRIStAL-PADR:pr-add-createobject-behavior
Nov 3, 2021
Merged
[SofaPython3] Changes how addObject process its arguments when they are of type: numpy & data #198
damienmarchal
merged 10 commits into
sofa-framework:master
from
CRIStAL-PADR:pr-add-createobject-behavior
Nov 3, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ing (in object creation) So we can write: ```python def createScene(root): root.addObject("MechanicalObject", name="loader", filename="mesh/cube.obj") root.addObject("MechanicalObject", name="dofs", position=root.loader.position) # to make a link root.addObject("MechanicalObject", name="dofs", position=root.loader.position.value) # to make a copy by value ```
…ring Because it breaks bckward compatibility and was not really better.
So we can write: object.position.link instead of object.position.getLinkPath() Which will make the syntax a bit more compact. Signed-off-by: Damien Marchal <[email protected]>
Signed-off-by: Damien Marchal <[email protected]>
tests are passing now (not the one with 21.06...but this is expected) |
it works for me ! 👍 |
hugtalbot
added a commit
to hugtalbot/SofaPython3
that referenced
this pull request
Oct 11, 2021
I remember a long time ago there was a rule saying that a PR without a "no go message" for more than seven days were considered as ready to merge. This one is on-hold for 19 days now. |
@hugtalbot, @fredroy the changes requested are done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
pr: breaking
pr: highlighted in next release
Highlight this contribution in the notes of the upcoming release
pr: new feature
pr: status ready
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR changes how addObject is handling some parameter according to their type.
numpy array
When passing a numpy array to the addObject simply does not work reporting an unparsable string.
Eg:
This does not work because position.value is of type numpy and that the object creation is trying to do a string conversion (which does not returns string parsable by Sofa). The PR detect numpy arrays and implement the proper conversion.
Data fields
When passing a BaseData object to the addObject the current implementation is copying the data.
Eg:
It was discussed in #197 what should be the most appropriate scenario.
This PR implement the following scenario:
It is yet undecided if we prevent the implicit version, and if we keep it if it should makes a link or a copy.
NB: the tests for linkpath will fails until the following sofa PR: sofa-framework/sofa#2354
is not merged.