@zm1072223921
I usually do my best to answer forum questions that are viewer related, however some answers require more attention and often additional work on my part before a proper reply can be posted. When it takes me more time to answer somebodyâs posts usually means just that
Did I describe this issue clearly? Can you reproduce the problem I encountered on your endďź
Yes you did, and I cannot perfectly reproduce the problem youâre describing on my end, but I may still know whatâs going.
Have you ever tried to pass in 16000 objects simultaneously?
Yes I have, even made a code sandbox for this purpose
Because you are usually cryptic in describing the bigger picture of what you are trying to do, Iâll have to make some assumptions:
- You have forked(one way or another) frontend-2 and you are either changing the application, to turn it into your own, either making a new one from scratch with frontend-2 as inspiration.
- You still havenât answered which viewer version you are using, so Iâll have to assume that youâre using the latest API 2.0 version
Iâve made this sandbox where I load a large model, about the same size as your model (which I cannot access because you removed access), then I get ID_COUNT
number of random object ids (default is 64000) which you can hide via a button. It takes 1-2 seconds to hide those 64000 ids. If I am to get 16000 random ids, like in you post, hiding them is super fast, so I upped your number so I can get an idea on how much time it takes. If you increase that number of ids, the time it takes also increases, but in order to get to your 30 seconds worth if waiting, you probably have to send millions
.
We could execute all of these operations faster, and weâll probably work on that in one of the next iterations on the viewer. But until then, there are also things developers can do to speed things up. Iâll talk next about that
Youâve stated:
Then, when I called the hideObjects method, I passed in âidsâ equivalent to the entire scene
The viewer itself does not stop you from doing that, but what you end up doing is pilling up redundancy, and hereâs why: Internally, when passing an id to the viewer in order to hide/select/isolate/etc, there will eventually be a call to getRenderViewNodesForNode
or getRenderViewsForNode
which starts at the node with the id you passed in and walks downwards
in the tree and returns all nodes/renderviews that are displayable. If you take all your ids from the scene and pass them to hide/isolate/select/etc what will happen is that the displayable nodes will get collected more than once (possibly a lot more). Itâs almost like telling it to hide/isolate/select everything 100 times one after the other.
If you do want to hide everything at once, all you need to do is pass the subtree root id (which will typically be the adress of the streamâs root object if itâs a speckle stream) to the hide function. This action is exemplified in the sandbox I made. You will see that hiding everything this way, even if internally it still needs to go over all displayables and act on them itâs fast