[STLIB] Add the unified "add" in Sofa.Core.Node#503
Merged
damienmarchal merged 3 commits into25_04_work_on_new_prefabsfrom Jul 17, 2025
Merged
[STLIB] Add the unified "add" in Sofa.Core.Node#503damienmarchal merged 3 commits into25_04_work_on_new_prefabsfrom
damienmarchal merged 3 commits into25_04_work_on_new_prefabsfrom
Conversation
hugtalbot
reviewed
Jul 17, 2025
| if params["name"] in self.children or params["name"] in self.objects: | ||
| names = {node.name.value for node in self.children} | ||
| names = names.union({object.name.value for object in self.objects}) | ||
| params["name"] = findName(params["name"], names) |
Contributor
There was a problem hiding this comment.
Throw warning if name already exists
Contributor
There was a problem hiding this comment.
Suggested change
| params["name"] = findName(params["name"], names) | |
| # send a warning here : Sofa.Helper.msg_warning(target, message, frameinfo.filename, frameinfo.lineno) | |
| params["name"] = findName(params["name"], names) |
Contributor
Author
There was a problem hiding this comment.
Ok in a future PR :)
hugtalbot
reviewed
Jul 17, 2025
hugtalbot
reviewed
Jul 17, 2025
hugtalbot
reviewed
Jul 17, 2025
Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
a01f75d
into
25_04_work_on_new_prefabs
6 of 8 checks passed
bakpaul
pushed a commit
that referenced
this pull request
Oct 28, 2025
* 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>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@EulalieCoevoet and @bakpaul, feel free to add other tests (including one representing broken usage).
As it is the entry point of Sofa... it must be very robust.