I would like to refresh the dat.gui menu with new values. I have loaded a model and display in folder the name of the objects inside a gui folder.
How can I display the new
Echt Einfach's solution didn't work for me, and Stemkoski's one is a bit wide. I finally made it with the updateDisplay
function:
for (var i in gui.__controllers) {
gui.__controllers[i].updateDisplay();
}
http://workshop.chromeexperiments.com/examples/gui/#10--Updating-the-Display-Manually
Note that if you have the values in some folder folder1
the call is like this:
for (var i = 0; i < this.gui.__folders.folder1.__controllers.length; i++) {
this.gui.__folders.folder1.controllers[i].updateDisplay();
}
If you do not want to hard-code folder1
, or simply want to update all folders, you can proceed as follows:
for (var i = 0; i < Object.keys(gui.__folders).length; i++) {
var key = Object.keys(gui.__folders)[i];
for (var j = 0; j < gui.__folders[key].__controllers.length; j++ )
{
gui.__folders[key].__controllers[j].updateDisplay();
}
}