webots
webots copied to clipboard
Web Proto: double loading
Describe the Bug
When loading a proto, the .proto file is loaded twice:
- Once in
loadProtoofProtoManager.js. Which seems logical. - Once in
prepareProtoDependenciesofNode.jswhere it should not be needed as we already have it (however I guess it is more convenient to reload it in order to allow recursion)
I'm not sure to understand what you mean by loaded twice. prepareProtoDependencies goes through the PROTO tree and downloads all EXTERNPROTO references and it also takes care of generating the PROTO models from these files (the information is stored in cProtoModels). When the node building takes place, it's built from the model
I mean that the .proto is download twice.
You can see that in the developper tools, in the network tab.
(on webots.cloud it is even more that twice as we load the proto to get the documentation but it's another problem)
Note: to trigger the cascaded download of the PROTO dependencies prepareProtoDependencies is recursively used. It's fine for all sub-PROTO but this function is also used at the root level, for which the root file has been technically downloaded already (to trigger the recursion), so it should be possible to avoid downloading the root file twice