I am trying to dynamically show and hide specific nodes (objects) in my scene using the Shapespark Viewer API by adding a script to body-end.html
.
I’ve encountered an issue where the standard API methods for visibility control don’t seem to be available in my setup. Here’s what I’ve found:
- Calling
WALK.getViewer()
returns an object (which my console logs asPv
). - I am successfully using
Pv.onSceneReadyToDisplay(callback)
to wait for the scene to be ready. - However, this
Pv
object does not have thehide("node-name")
orshow("node-name")
methods as described in the API documentation (GitHub - shapespark/shapespark-viewer-api: JavaScript API for interacting with the Shapespark 3D scene.). Attempting to call them results in a “is not a function” TypeError. - I can successfully retrieve a node object (logged as
Pm
in my console) usingPv.findNodesOfType("my-object-name")
. - However, this retrieved node object (
Pm
) does not appear to have a directvisible
property or any apparent method to control its visibility (e.g.,.setVisibility()
).
Could you please advise on the correct way to control the visibility (show/hide) of specific named nodes (e.g., “001”, “002”) via JavaScript in this scenario? How can I change the visibility of a node using the Pv
object or the node objects retrieved from it?
Any guidance or examples would be greatly appreciated.
Thank you for your assistance.