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
Wrote a function to update dat.gui dropdowns with a new set of values:
function updateDatDropdown(target, list){
innerHTMLStr = "";
if(list.constructor.name == 'Array'){
for(var i=0; i" + list[i] + "";
innerHTMLStr += str;
}
}
if(list.constructor.name == 'Object'){
for(var key in list){
var str = "";
innerHTMLStr += str;
}
}
if (innerHTMLStr != "") target.domElement.children[0].innerHTML = innerHTMLStr;
}
Usage:
myDropdown = gui.add(MyObject, 'myVariable', ['one','two','three']);
updateDatDropdown(myDropdown , ['A','B','C']);
// Also accepts named values
updateDatDropdown(myDropdown , {'A':1,'B':2,'C':3});