lil-gui
lil-gui copied to clipboard
Option to set 'Folders closed by default'
When we initialise the gui maybe we can pass 'defaultClosed:true' or something like that to set the folder's default open or close state
i'm migrating a three js project with lots of folders being created in different files and to prevent all the folder from getting opened ,at the end of all the folder creation , I loop/traverse/foldersRecursive
through the folders and do close.() on them . works great but not ideal while developing
excellent work btw !
Thanks! I could see us adding something like this if enough people want it. Maybe closeFolders: true
? Or do you imagine that applying to the root GUI as well?
const gui = new GUI({closeFolders: true});
the root folder & every folder created from now on is closed
and user can just do gui.open()
to keep the root open if needed
So if it was called closeFolders
I'd probably assume it only applies to "inner GUI's"—the root panel isn't typically referred to as a folder even though it technically is.
It makes me wonder which is the more common scenario: everything closed like you describe, or only folders closed. I'm thinking of the PIXI filter demo as one example, but I'll let others chime in with what they might expect a feature like this to do.
the pixi demo portrays my problem nicely , my project is similar + there's folders inside folders and each folder is created in a different js file
if all folders created in this gui no matter how deep , are closed, it's a win.
should the root should stay open or not ? i'll leave it up to you/others
Cool—we could do closeFolders: true
so that everything made with addFolder
is closed, and the root is open by default (which you're obviously free to close()
as well). Interestingly enough, that basically that makes folders behave exactly as they do in dat.gui.
Hi, I also want this feature, close all folders by deafult. Thanks, Pavan
new GUI({ closeFolders: true })
is definitely planned for the next release.
Until then, anyone can use this snippet for the same result:
const addFolder = GUI.prototype.addFolder;
GUI.prototype.addFolder = function(...args) {
return addFolder.call(this, ...args).close();
};
As of version 0.18, new GUI({ closeFolders: true })
works as described above.