Add DevTools enable/disable toggle functionality #32250
Closed
+154
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add DevTools enable/disable toggle functionality
Problem
Screen.Recording.2025-11-12.at.12.42.13.PM.mov
Users with the Three.js DevTools extension installed couldn't temporarily disable it without removing the entire extension. This made it difficult to compare performance metrics or debug issues that might be related to devtools interference.
Fixes #31015
Solution
Added a simple toggle system that allows users to enable/disable DevTools at runtime:
THREE.DevToolsobject withenabledpropertytoggle(),setEnabled(boolean)Usage
Demo
Test page available at
/devtools-test.htmlwith interactive controls.Screen Recording
Changes Made
src/devtools/DevTools.js- Core control systemsrc/renderers/webgl/WebGLProgram.js- Added enabled checksrc/Three.js- Export DevTools APIdevtools-test.html- Demo pageTesting
/devtools-test.htmlThe implementation is backward compatible and adds minimal overhead.