Bring back modification of node inside PROTO from API supervisor #6260
Replies: 2 comments 7 replies
-
To avoid the regeneration of a procedural PROTO, you should use the |
Beta Was this translation helpful? Give feedback.
-
Using an example : This PROTO allows to get a serie of boxes standing on the ground. (the trick is to raise the box to half the height, because the origin of the box is in the middle of the box)
|
Beta Was this translation helpful? Give feedback.
-
Hello,
I have a useful use-case in favor of reintroducing PROTO modification from API, as discussed in #1923
I need to change on the fly a shape of a PROTO during simulation, but it seems to have a huge performance impact, and moreover it cause me some trouble to get exactly what I want.
What I'm experimenting is to change value (translation, in my case) of nodes inside the PROTO directly, without changing the driving parameter of the PROTO, hence avoiding a regeneration (basically 99% of the PROTO stay the same at each update).
I've tried by changing from the API only the values that should change (a translation), and it works great, and performance are great ! Moreover reset revert all changes made on the PROTO during the simulation, at that's good :)
The only thing is that I had to change in the webots code all boolean "is_read_only" and "is_proto_internal" to false to get it working. Maybe it's not the best way to do it, but it work to demonstrate my point.
Is there anything that could break in the code by doing so ? If no, I feel it's a rather arbitrary choice to avoid this kind of manipulation, which is in my case very useful.
I do understand that a PROTO should be only defined by it's input, and taht what I'm doing contradict this "clean" way, but it's should remains an option to the user, imo.
And in this case clearly document it, and warn the user that it's not the "intended"/"clean" way of doing it.
What do you think ?
I can craft an example to demonstrate my point, but it would take some time, so ping me if you really need one to get my point.
Beta Was this translation helpful? Give feedback.
All reactions