-
Notifications
You must be signed in to change notification settings - Fork 52
[STLIB] Add the unified "add" in Sofa.Core.Node #503
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
Conversation
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throw warning if name already exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok in a future PR :)
Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
a01f75d
into
25_04_work_on_new_prefabs
* 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>
@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.