I am rendering parameters menu in viewer API. Now stacked trying to implement an update and cancel buttons. I intend to change one or multiple parameters and update only on demand.
I have already founded the instruction to stop auto update:
session.automaticSceneUpdate = false
And update in coding: viewport.update()
Searched documentation and founded some instructions for api v2. But not v3.
Examples will be amazing.
Thanks.
You can find here equivalences between viewer 2 and viewer 3: Viewer 2 - Migration Guide
In particular, you will notice that the viewer 3 API decouples the update of parameter values and sending the customization request:
session.parameters["parameterId"].value = newValue;
await session.customize();
This means that, when implementing your UI, you can simply connect the UI controls to updating values of the parameters, and then connect an update button to the session.customize()
function.
If you want to implement a cancel button as well, you can store previous parameter values and restore them when clicking on the button.
1 Like