Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added new DevTools#30870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
mrdoob wants to merge56 commits intodev
base:dev
Choose a base branch
Loading
fromdevtools
Draft

Added new DevTools#30870

mrdoob wants to merge56 commits intodevfromdevtools

Conversation

mrdoob
Copy link
Owner

Description

Started a new and simpler Three.js DevTools.

Screenshot 2025-04-05 at 10 25 20

lin72h and ruofeidu reacted with thumbs up emojilin72h, GGAlanSmithee, tseijp, dbuck, and ruofeidu reacted with hooray emojigkjohnson, JianJroh, Fennec-hub, Mugen87, ilyazub, joevingracien, boyaquito, RodrigoHamuy, ntnyq, brunosimon, and 20 more reacted with heart emojicmhhelgeson, gkjohnson, Mugen87, Bug-Reaper, jtydhr88, zineanteoh, Romaixn, Darkensses, and Degubi reacted with eyes emoji
@mrdoobmrdoob added this to ther176 milestoneApr 5, 2025
@mrdoobmrdoob requested a review fromCopilotApril 5, 2025 02:40
Copilot

This comment was marked as outdated.

mrdooband others added3 commitsApril 5, 2025 11:45
… local variableCo-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@mrdoob
Copy link
OwnerAuthor

We now show the three.js version detected in the icon badge:

Screenshot 2025-05-12 at 20 51 53
Mugen87 and lin72h reacted with heart emoji

@mrdoobmrdoob modified the milestones:r177,r178May 30, 2025
@mrdoobmrdoob modified the milestones:r178,r179Jun 30, 2025
@mrdoob
Copy link
OwnerAuthor

We can now show the object transforms.

Screen.Recording.2025-07-13.at.5.44.41.PM_.mov
Darkensses reacted with heart emoji

@mrdoobmrdoob requested a review fromCopilotJuly 14, 2025 00:28
Copy link

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR introduces a new, simplified Chrome DevTools extension for inspecting Three.js scenes and renderers, including panel UI, messaging infrastructure, and documentation.

  • Added panel UI (panel.js,panel.html,panel.css) for rendering scene and renderer details
  • Implemented messaging flow (devtools.js,content-script.js,bridge.js,background.js) between page, background, and panel
  • Included extension manifest and README for setup and architecture overview

Reviewed Changes

Copilot reviewed 10 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
devtools/panel/panel.jsUI logic for scene tree, renderer sections, and floating panel
devtools/panel/panel.htmlHTML structure for DevTools panel
devtools/panel/panel.cssStyling for panel components and floating details
devtools/manifest.jsonExtension metadata, permissions, and devtools page configuration
devtools/index.htmlLoader page for DevTools panel
devtools/devtools.jsRegisters the “Three.js” tab in Chrome DevTools
devtools/content-script.jsInjects bridge script and relays messages
devtools/bridge.jsIn-page bridge interacting with Three.js and dispatching events
devtools/background.jsManages port connections and message forwarding
devtools/README.mdInstallation and architecture documentation
Comments suppressed due to low confidence (1)

devtools/panel/panel.js:4

  • The utility functiongetObjectIcon has no associated tests. Adding unit tests to cover each icon mapping will help prevent regressions as new object types are added.
function getObjectIcon(obj) {

Comment on lines +86 to +102
const intervalId = setInterval( () => {

backgroundPageConnection.postMessage( {
name: 'request-state',
tabId: chrome.devtools.inspectedWindow.tabId
} );

}, 1000 );

backgroundPageConnection.onDisconnect.addListener( () => {

console.log( 'Panel: Connection to background page lost' );
clearInterval( intervalId );
clearState();

} );

Copy link
Preview

CopilotAIJul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Polling the entire state every second can be inefficient and may cause unnecessary UI updates. Consider switching to an event-driven update model where the bridge pushes updates only when data changes.

Suggested change
constintervalId=setInterval(()=>{
backgroundPageConnection.postMessage({
name:'request-state',
tabId:chrome.devtools.inspectedWindow.tabId
});
},1000);
backgroundPageConnection.onDisconnect.addListener(()=>{
console.log('Panel: Connection to background page lost');
clearInterval(intervalId);
clearState();
});
backgroundPageConnection.onMessage.addListener((message)=>{
if(message.name==='state-update'){
updateState(message.state);
}
});
backgroundPageConnection.onDisconnect.addListener(()=>{
console.log('Panel: Connection to background page lost');
clearState();
});

Copilot uses AI. Check for mistakes.

Comment on lines 295 to 297
summaryElem.innerHTML = `<span class="icon toggle-icon"></span>
<span class="label">${displayName}</span>
<span class="type">${obj.type}</span>`;
Copy link
Preview

CopilotAIJul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Using innerHTML with interpolated content can introduce XSS risks if any data is unexpected. Prefer building DOM nodes via createElement and textContent, or sanitize the inserted HTML.

Suggested change
summaryElem.innerHTML= `<spanclass="icon toggle-icon"></span>
<spanclass="label">${displayName}</span>
<spanclass="type">${obj.type}</span>`;
consttoggleIconSpan=document.createElement('span');
toggleIconSpan.className='icon toggle-icon';
constlabelSpan=document.createElement('span');
labelSpan.className='label';
labelSpan.textContent=`${obj.type} `;
constobjectDetailsSpan=document.createElement('span');
objectDetailsSpan.className='object-details';
objectDetailsSpan.textContent=details.join(' ・ ');
labelSpan.appendChild(objectDetailsSpan);
consttypeSpan=document.createElement('span');
typeSpan.className='type';
typeSpan.textContent=obj.type;
summaryElem.appendChild(toggleIconSpan);
summaryElem.appendChild(labelSpan);
summaryElem.appendChild(typeSpan);

Copilot uses AI. Check for mistakes.

row.style.marginBottom = '2px';

// Pad label to ensure consistent alignment
const paddedLabel = label.padEnd(16, ' '); // Pad to 16 characters
Copy link
Preview

CopilotAIJul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

[nitpick] The padding length16 is a magic number. Extract it into a named constant (e.g.,LABEL_PAD_LENGTH) so its purpose is clear and maintainable.

Suggested change
constpaddedLabel=label.padEnd(16,' ');// Pad to16 characters
constpaddedLabel=label.padEnd(LABEL_PAD_LENGTH,' ');// Pad toLABEL_PAD_LENGTH characters

Copilot uses AI. Check for mistakes.

let displayName = obj.name || obj.type;

// Default rendering for other object types
const elem = document.createElement( 'div' );
Copy link
Preview

CopilotAIJul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

These tree-item divs represent interactive nodes but lack ARIA roles for screen readers. Consider using role="treeitem" and aria-expanded attributes to improve accessibility.

Copilot uses AI. Check for mistakes.

@ruofeidu
Copy link
Contributor

This is amazing!

mrdoob reacted with heart emoji

@mrdoob
Copy link
OwnerAuthor

Sometime is not easy to find where in the page the renderer is...

Screen.Recording.2025-07-18.at.12.08.59.PM.mov

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@Mugen87Mugen87Mugen87 left review comments

Copilot code reviewCopilotCopilot left review comments

Assignees
No one assigned
Labels
Projects
None yet
Milestone
r179
Development

Successfully merging this pull request may close these issues.

6 participants
@mrdoob@RenaudRohlinger@ruofeidu@Mugen87@cesmoak@Darkensses

[8]ページ先頭

©2009-2025 Movatter.jp