I’m looking to hide a nested model completely from from the body-end.html file.
I am able to do this through changing the material on the object but I was wondering if there is a possibility to hide an object on the highest level (the AssimpFBX$_Translation)?
Because this way a few elements could be grouped and hidden together.
This part of the API isn’t yet official, but you achieve this with:
for (const node of viewer.findNodesOfType('<OBJECT TYPE NAME>')) {
node.hide(); // node.show();
}
The nodes intended to be dynamically hidden/shown must be marked as editable using the Viewer.setNodeTypeEditable('<OBJECT TYPE NAME>') function before the scene is loaded.
Could you share a link to your scene, so we could take a look? If the scene isn’t public you can send the link through forum’s PM or support@shapespark.com
Hello there! We were able to make the function work! But we are running into an issue now.
Every time we use the hide/ show function it also hides/ shows all the materials that are inside of that node. So because other objects in the scene use the same materials, It hides/ shows things that we did not mean to.
Is there a way to limit the function to only objects and not materials?
I cannot find any hide/show calls in this scene. Do you have a version with your current hide/show code?
Do you call:
var viewer = WALK.getViewer();
viewer.setNodeTypeEditable('300 PREMIUM STYLE');
viewer.setNodeTypeEditable('300 MEDIUM STYLE');
viewer.setNodeTypeEditable('300 STANDARD STYLE');
at the beginning of your script? Marking these objects as editable is important to prevent nodes sharing the same material from being merged as a part of performance optimization.
I would like to ask you if there is a way to change the loading cover picture (maybe thumbnail as well) depending on the URL. We already put the files in the extra-assets folder. But we have not been able to access them.
Hello Wojtek, we have added this part of the code to the body-end.html trying to change the cover image for each URL but it gives us an error. WALK.getExtraAssetUrl is not a function
The extra assets path, so also the WALK.getExtraAssetUrl function is available only after the window has been loaded. Delay this part of the code by executing it from a load event handler: addEventListener('load', ...)