It used to be possible to access the editor instance from the chrome inspector by simply typing editor. This no longer works, I used to use this all the time to edit certain things that couldn't be changed using UI. editor.selected for example.
Would simply adding window["editor"] = editor in the index.html suffice here?
I suppose this got removed with the addition of ES6 modules. (1499ef3bca89ea6044c06095ecc26117a41dc984)
Yes, things get more encapsulated when using modules. But I don't vote to make the editor variable globally accessible. If we would have developed the editor from scratch with modules, we never would expose such variables.
I know globally available variables can be quite handy but it's the result of an anachronistic coding style.
Hmm yeah I often run into the same issue when starting a new project. It's nice to be able to access things from the inspector but you don't want to use global variables.
Do you know of any nice way to still be able to play around with the selected object from the inspector for instance, without making any new global variables?
Have you considered to use three.js dev tools?
Ah, I wasn't aware of its existence. I'll check it out, thanks!
Actually, I do think we should do a window.editor = editor (and probably window.THREE = THREE). It's good to be able to run scripts from the console some times.
How's this? #18349
Most helpful comment
Actually, I do think we should do a
window.editor = editor(and probablywindow.THREE = THREE). It's good to be able to run scripts from the console some times.