I want to be able to run specific code when a user changes a parameter of a model, I will do this using the ShapeDiver API. I believe I can get this working using event listeners, but I cant get it working following the ShapeDiver API documentation. I hope someone can help.
Do you also correctly get the list of model parameters before you call SetupEventListeners()? It seems to me that this could be a timing issue. Depending on your environment, you might also need to add window. before calling the API?
I just realized that you are probably using iframe embedding, which is not compatible with the event listeners. You will need to switch to direct embedding, as shown in this template for example:
I also seem to be unable to render any kind of parameter controls when using direct embedding. Could this be due to these errors I’m having or something else?
Those errors happen in some cases but should not cause any issues. The controls are not part of the core viewer, if you want to include them instead of your own controls, you need to include a slightly more complicated template:
Thank you for your help! I have got embedding working now.
I was wondering if you could help with another query I have.
A model I’m working with has had two data outputs setup, yet when I attempt to log all exports on said model, an empty array is returned. See code and returned data below.
The following code:
Returns this:
I also have some models with around 6 different exports setup yet when I make an API call to fetch all exports I only have 4 returned.