feat(editor): Open in New Tab is a menu item, double-click frames the camera - #49
Closed
pythonlearner1025 wants to merge 1 commit into
Closed
pythonlearner1025 wants to merge 1 commit into
pythonlearner1025 wants to merge 1 commit into
Conversation
… camera A double click in the Objects tree frames the camera on the row's object again, on every row. Nothing opens a tab by double click. Opening a document is now the explicit item "Open in New Tab", first on the right click menu, in the Objects tree and in the Files panel. The Files panel keeps its double click open, because a file list has no camera to frame. The prop that resolved a row to an asset answers a path or null now, and the tree builds the item from that. Its old rule rejected any object that carries _tpRootPath. Every object in an open document carries it, the scene's own children included, so that rule answered a path for no row and the double click open it guarded never ran. The dead newTab branch in the Files panel's openFile, a second browser window that was never built, goes with its parameter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What part this touches
The editor's left panel holds the Objects tree: one row per object in the open document. The bottom
slot holds the Files panel, a file browser over the project folder. The centre holds the Viewport
with a strip of document tabs.
DocumentStore.open(path)is the one call that puts a file on theViewport as a tab.
Three files carry the gestures.
BPHierarchyComponent.tsxis the Objects tree: it handles a click, adouble click and a right click on a row.
ObjectHierarchyComponent.tsxwraps that tree and owns themenu actions.
FilesPanel.tsxdraws the file grid and its menus.The problem
What a double click opened was arbitrary. On a placed asset's root it was meant to open that asset's
file as a tab. On any other row it framed the camera. In the Files panel it opened whatever the
extension said. One gesture, three meanings.
The asset open never ran. The wrapper resolved a row to a path like this:
_tpRootPathnames the file an object was cloned out of. Every object in an open document carriesit, the scene's own children included. Measured on the terminator project, every top level row
answered
_tpRootPathofhttp://127.0.0.1:4477/files/assets/main.scene.gltf?v=add4cd60..., so theresolver answered
falsefor every row and the double click framed the camera instead.So the Objects tree had no way to open a placed asset's file. The Inspector's Edit Asset button is
absent on those rows too, for the same reason: I counted
[title="Edit Asset"]on a selectedUnit_HK-Tankrow and got 0.openFilein the Files panel also held a dead branch: a commentedwindow.openand a barereturnbehind a
newTabflag. Cmd double click hit it and did nothing.The fix
Double click in the Objects tree frames the camera on the row's object, on every row.
Nothing in the Objects tree opens a tab by double click.
The right click menu holds "Open in New Tab" first, above Isolate, on a row that resolves to a file.
The item is absent, never greyed out, on a row that resolves to nothing.
The Files panel's file menu holds the same item first, above the file items.
The Files panel keeps double click as its open, because a file list has no camera to frame.
The tree prop
onOpenAssetbecomesdocumentPath, which answers a path or null and opens nothing.The wrapper's
openDocumentaction callsstore.open(path), the call the Inspector's Edit Asset makes.The resolver reads
userData.rootPathalone, so a placed asset's root answers its file again.An object inside an asset has no
userData.rootPath, so it answers null and gets no item.The dead
newTabbranch inopenFilegoes, with its parameter and the twoe.metaKeyreads.The risk trade
Dropping the
_tpRootPathtest widens what the item appears on. That is the point: with the test inplace the item appears on nothing. The cost is a row that names a file the project no longer has.
The item still shows there, because the path reads as openable, and the open fails with a red toast
and a cold tab. I drove that path: the toast says "Unable to open
assets/models/units/endo/missing.gltf" and the editor keeps running. The Files panel has done the
same for any unreadable file since before this change, so the failure is the store's, not the menu's.
The rejected alternative was to keep the resolver byte for byte and demonstrate the item somewhere
else. There is nowhere else: no row in a document loaded from a file passes that test, so the item
would have shipped dead, the way the double click open shipped dead.
I left the Inspector's Edit Asset button alone. It carries the same dead test and it is a separate
fix.
Tests
Headless, Playwright with the installed Google Chrome at 1512x982, against my build of the editor
served by
kite3d devwithCI=1on port 4477 over/Users/minjunes/games/terminator-next. Theserved bundle is my build:
assets/index-Bj8x1xNg.jsmatchedpackages/editor/distby sha256.Screenshots I looked at, all under
/private/tmp/claude-501/-Users-minjunes-blitz/278f5f97-7e16-4722-b1bc-c061014966db/scratchpad/evidence/open-in-tab/:00-objects-menu-asset-row-before.pngand00-objects-menu-asset-row-after.png, the same row andthe same viewport on both builds. The only difference is the new first item.
01-objects-menu-asset-row-after.png, the item above Isolate.02-objects-doubleclick-frames-camera.png, the camera framed on the unit.03-endo-document-on-viewport.png, endo.gltf on the Viewport after the item.04-objects-menu-plain-node.png, Player_Start with no such item.08-files-menu-openable-file.png, the Files panel menu with the item above Import in Scene.11-edge-missing-file.png, the red toast on the worst path.12-reference-row-reveals.png, a reference row still revealing in Resources.What I drove and read, from
walkthrough.log,compare.logandedges.login the same folder:Unit_T-800_Endo: camerapos [62,49,60] target [0,0,0]becamepos [49.21,33.11,40.22] target [23.35,0.99,0.23]. Tabs stayed["main.scene.gltf"].["Open in New Tab","Isolate","Move Up","Move Down","Scale to Radius", "Auto Center","Pivot to Node Center","Duplicate Object","Delete Object"]. Clicking the item madetabs
["main.scene.gltf","endo.gltf"]withendo.gltfactive and the endo model on the Viewport.endo.gltfwas active. Thesecond open focuses the tab it already made.
Player_StartandGame_Manager: no such item, and the rest of both menus is character forcharacter what the baseline build shows.
Default Camerastill offers Make Asset.Player_Start: camera target became[0,0,9], the node's position. Double clickScene: camera framed the whole model root. Neither added a tab.main.jsand theassetsfolder open no menu at all, as before.assets/models/units/scout/scout.gltfopens["Open in New Tab","Import in Scene"]. Double clickon it still opened it, tabs went from two to three with
scout.gltfactive. The item on a filealready open focused its tab.
to Resources.
Edges, driven through the real menu after setting
userData.rootPathon a live row:AGENTS.md: no item.editor keeps running with a cold tab.
Suites, all green:
npm run typecheckexit 0,npm run lintexit 0,npm test -w packages/kite3d10 tests in 5 files,
npm run test:scripts2 tests. The kite3d test that opens a document from theFiles panel by double click passes untouched.
What fails without the fix: on
origin/mainthe same right click onUnit_T-800_Endogives["Isolate","Move Up","Move Down","Scale to Radius","Auto Center","Pivot to Node Center", "Duplicate Object","Delete Object"], with no way to open that unit's file from the Objects tree.No test was added. Every check here is a manual headless run, and the repository bans proactive
tests.
Deploy
The editor bundle ships it, through the next
kite3drelease on npm. Build withnpm ci && npm run build, then release withnpm run release. Rollback is the previous version onnpm:
npm i -D kite3d@0.21.0-alpha.7.