Skip to content

Commit d86b81b

Browse files
committed
Clean up.
1 parent e5f8c81 commit d86b81b

File tree

3 files changed

+10
-31
lines changed

3 files changed

+10
-31
lines changed

devtools/bridge.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060

6161
reset() {
6262

63-
// console.log('DevTools: Resetting state');
6463

6564
// Clear objects map
6665
this.objects.clear();
@@ -190,7 +189,6 @@
190189
// Listen for Three.js registration
191190
devTools.addEventListener( 'register', ( event ) => {
192191

193-
// console.log('DevTools: Three.js registered with revision:', event.detail.revision);
194192
dispatchEvent( 'register', event.detail );
195193

196194
} );
@@ -313,8 +311,6 @@
313311

314312
}
315313

316-
// Start periodic renderer checks
317-
// console.log('DevTools: Starting periodic renderer checks');
318314

319315
// Function to check if bridge is available
320316
function checkBridgeAvailability() {
@@ -441,7 +437,6 @@
441437

442438
if ( ! object || ! object.uuid ) return; // Simplified check
443439

444-
// console.log('DevTools: Processing object during reload:', object.type || object.constructor.name, object.uuid);
445440

446441
// Get object data
447442
const objectData = getObjectData( object );
@@ -456,7 +451,6 @@
456451
// Process children recursively
457452
if ( object.children && Array.isArray( object.children ) ) {
458453

459-
// console.log('DevTools: Processing', object.children.length, 'children of', object.type || object.constructor.name);
460454
object.children.forEach( child => observeAndBatchObject( child ) );
461455

462456
}
@@ -478,8 +472,6 @@
478472
// Update the cache
479473
sceneObjectCountCache.set( scene.uuid, currentObjectCount );
480474

481-
} else {
482-
// console.log(`DevTools: Scene ${scene.uuid} count unchanged (${currentObjectCount}), skipping dispatch.`);
483475
}
484476

485477
}

devtools/content-script.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* global chrome */
22

33
// This script runs in the context of the web page
4-
// console.log( 'Three.js DevTools: Content script loaded at document_readyState:', document.readyState ); // Comment out
54

65
// Inject the bridge script into the main document or a target (e.g., iframe)
76
function injectBridge( target = document ) {
@@ -97,8 +96,8 @@ function handleWindowMessage( event ) {
9796

9897
}
9998

100-
const messageWithSource = { ...event.data, source };
101-
chrome.runtime.sendMessage( messageWithSource );
99+
event.data.source = source;
100+
chrome.runtime.sendMessage( event.data );
102101

103102
}
104103

devtools/panel/panel.js

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ const state = {
4545
objects: new Map()
4646
};
4747

48-
// console.log('Panel script loaded');
4948

5049
// Create a connection to the background page
5150
const backgroundPageConnection = chrome.runtime.connect( {
@@ -81,7 +80,6 @@ backgroundPageConnection.onDisconnect.addListener( () => {
8180

8281
} );
8382

84-
// console.log('Connected to background page with tab ID:', chrome.devtools.inspectedWindow.tabId);
8583

8684
// Store renderer collapse states
8785
const rendererCollapsedState = new Map();
@@ -138,9 +136,6 @@ function handleThreeEvent( message ) {
138136
// Also update the generic objects map if renderers are stored there too
139137
state.objects.set( detail.uuid, detail );
140138

141-
// The DOM update logic previously here is redundant because updateUI()
142-
// rebuilds the entire renderer element anyway, using the updated data
143-
// from state.renderers and the persisted open/closed state.
144139

145140
break;
146141

@@ -397,23 +392,16 @@ function renderObject( obj, container, level = 0 ) {
397392
.filter( child => child !== undefined )
398393
.sort( ( a, b ) => {
399394

400-
// Sort order: Cameras, Lights, Groups, Meshes, Others
401-
const typeOrder = {
402-
isCamera: 1,
403-
isLight: 2,
404-
isGroup: 3,
405-
isMesh: 4
395+
const getTypeOrder = ( obj ) => {
396+
if ( obj.isCamera ) return 1;
397+
if ( obj.isLight ) return 2;
398+
if ( obj.isGroup ) return 3;
399+
if ( obj.isMesh ) return 4;
400+
return 5;
406401
};
407-
// Refactored to avoid optional chaining parser error
408-
const findOrder = ( obj ) => {
409402

410-
const entry = Object.entries( typeOrder ).find( ( [ key ] ) => obj[ key ] );
411-
return entry ? entry[ 1 ] : 5; // Check if entry exists, then access index 1 (value)
412-
413-
};
414-
415-
const aOrder = findOrder( a );
416-
const bOrder = findOrder( b );
403+
const aOrder = getTypeOrder( a );
404+
const bOrder = getTypeOrder( b );
417405

418406
return aOrder - bOrder;
419407

0 commit comments

Comments
 (0)