refresh dat.gui with new values

前端 未结 8 1390
时光取名叫无心
时光取名叫无心 2021-01-31 19:55

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

8条回答
  •  温柔的废话
    2021-01-31 20:15

    It's easy when I have read the source code of dat.gui:

    https://github.com/dataarts/dat.gui/blob/master/src/dat/controllers/Controller.js#L36

    As you see, this.object = object, this is a controller you add, and object is what you need to change. Here is example code:

    var gui = new dat.GUI();
    
    // init a controller
    var controller = gui.add(object, 'property');
    
    // update a controller
    controller.object = newObject;
    

提交回复
热议问题