Skip to content

feat(editor): one Resources tab, and reference rows under each mesh - #42

Closed
pythonlearner1025 wants to merge 1 commit into
mainfrom
feat/resources-tab-references
Closed

pythonlearner1025 wants to merge 1 commit into
mainfrom
feat/resources-tab-references

Conversation

@pythonlearner1025

Copy link
Copy Markdown
Member

What part this touches

The editor's left panel, in packages/editor. Today it has four tabs: Objects, Materials, Textures, Geometries. Objects shows the three.js object tree of the active document. The other three list the resources that document holds. A resource is shared: one material can serve many meshes, so the lists show each resource once, and the Objects tree never shows which resource a mesh uses. The Inspector on the right shows the selected object or resource. The Files and Library bottom panel is not touched.

The tab strip is declared in ThreeEditorComponent.tsx. The Objects tree is BPHierarchyComponent.tsx. The three resource trees are BPMaterialsTreeComponent.tsx, BPTexturesTreeComponent.tsx, and BPGeometriesTreeComponent.tsx.

The problem

  1. Select a mesh in Objects. The tree row shows a name and nothing else. The Inspector shows its material, but the tree does not.
  2. To see what else uses that material, switch to the Materials tab and search by name. Nothing links the two views.
  3. Three separate resource tabs split one question, "what does this document hold", across three clicks.
  4. Double-click on a placed asset root only frames the camera. Opening the asset's own document takes the Inspector's Edit Asset button.

The owner's words: "why can't i visually see what resources are applied to a particular node? can't this be shown as children of this node?"

The fix

  • Materials, Textures, and Geometries become one Resources tab with three collapsible sections and count badges. The three trees stay as components and the new tab composes them.
  • Under a mesh, line, or points row, the Objects tree shows reference rows, built when the row expands: its geometry, its material, one row per material in an array, one row per assigned texture slot under each material, and one row per entity component.
  • A reference row is icon only. The icon says geometry, material, texture, or component. The texture slot name lives in the tooltip.
  • A reference row is italic, carries a link glyph, is not draggable, and has no context actions. It is a reference, not a child. A shared material shows under every mesh that uses it.
  • Click on a reference row selects that resource. The Inspector shows it. The Objects tree keeps its scroll and expansion.
  • Double-click on a reference row switches the left panel to Resources with that row selected and scrolled into view.
  • Double-click on an asset root opens that asset's document through store.open, the same call the Inspector's Edit Asset button makes.
  • Preview-rig lights in asset documents render dimmed in the Objects tree.
  • One list builder, sceneResources.ts, feeds the three sections. One click path, selectResource.ts, serves the trees and the reference rows.

The risk trade

  • Double-click on an asset root no longer frames the camera. It opens the document. The f key still frames. This follows the owner's mockup.
  • Reference rows refresh on the events the Objects tree already uses. A material rename shows on the next tree refresh, not instantly.
  • A component row selects its object, because a component has no Resources row. Its double-click does not switch tabs.
  • The Materials section lists every material instance the importer created, as the Materials tab did before. A document with 160 copies of "Map concrete" shows 160 rows. Merging by identity is a separate change.
  • Reference rows build on expand, not up front, so a large scene pays nothing until a mesh is opened.
  • Rejected alternative: a fourth tab that lists references for the selected object. It would keep the two views apart, which is the problem.

Tests

  • npm run typecheck, npm run lint, npm run build:editor: all exit 0.
  • No unit tests were added. The repo adds tests only for flaky manual behaviour or a user-reported bug.
  • Headless walkthrough with Playwright against a read-only clone of the terminator project, in ~/games/terminator-evidence/docs/evidence/kite3d-resources-tab/ with 14 screenshots and walkthrough.log:
    • Left tabs: Objects, Resources. Badges: Materials 160, Textures 447, Geometries 402. Section rows 1009, and the sums agree.
    • An Endo mesh lists its geometry, its material, and five texture slots: map, aoMap, normalMap, roughnessMap, metalnessMap. The same material appears under both Endo meshes.
    • Reference rows report draggable=false and zero context items. Object rows keep draggable=true and five items.
    • Click puts the material in the Inspector. Double-click opens Resources with the row selected and in view.
    • A collapsed section stays collapsed after a reload.
  • Without the fix the tab strip has four tabs, and a mesh row has no children.

Deploy

The editor ships inside the @kite3d/editor and kite3d packages. Nothing ships from this PR until it lands on main and a release runs.

git checkout main && git pull
npm run build
npm run release:dry
npm run release

The game links the engine by file path, so a rebuilt packages/editor/dist reaches the local editor on the next restart of npx kite3d dev.

Rollback: revert the squash commit on main, rebuild, and release the next alpha.

git revert <squash sha>

🤖 Generated with Claude Code

The left panel keeps Objects first. Materials, Textures, and Geometries
become one Resources tab with three collapsible sections and count
badges, composed from the three existing trees. Files and Library stay
in the bottom panel.

Under a mesh, line, or points row the Objects tree now shows what the
object references, built on expand: its geometry, its material or one
row per material in an array, one row per assigned texture slot under
each material, and one row per entity component. A reference row is
icon only, italic, marked with a link glyph, not draggable, and has no
context actions. Click selects the resource so the Inspector shows it.
Double-click switches to Resources with that row highlighted and in
view. Double-click on an asset root opens that asset's document
through store.open, the same call as the Inspector's Edit Asset button.
Preview-rig lights in asset documents render dimmed.

Verification: npm run typecheck, npm run lint, and npm run build:editor
exit 0. Headless walkthrough against a clone of the terminator project:
tabs Objects and Resources; badges Materials 160, Textures 447,
Geometries 402, 1009 rows; an Endo mesh lists its geometry, material,
and the map, aoMap, normalMap, roughnessMap, and metalnessMap slots; a
click puts the material in the Inspector; a double-click opens
Resources with the row selected and in view. Screenshots under
~/games/terminator-evidence/docs/evidence/kite3d-resources-tab/.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@pythonlearner1025
pythonlearner1025 deleted the feat/resources-tab-references branch September 16, 2026 22:29
pythonlearner1025 added a commit that referenced this pull request Sep 17, 2026
…erence rows

The reference rows a mesh gained in #42 read as children of the mesh,
and the next sibling mesh read as a child too. Two causes: a row with
no caret lost the 26 px caret slot, so a reference row started 26 px
left of an object row at the same depth and the columns drifted; and
the tree drew no indent guides, so nothing marked where a subtree
ended. Every row now keeps the caret slot whether or not it has a
caret, and a row with no icon renders an empty icon slot, so rows at
one depth share their caret and icon x. Each indent slot draws a
vertical guide from the same custom property the padding uses, and the
depth loop runs to 20 so Blueprint's own wider step can no longer win
past depth 10. A mesh's reference rows draw a tinted band with a 2 px
rule at the left and a dotted guide over their own last levels, so the
block has a visible start and end.

Verification: headless Chrome on the terminator project, before and
after on the same walk. After, rows at one depth share the caret x and
the icon x; before, two rows at depth 6 had icons 26 px apart and the
texture rows sat left of their own grandparent's icon. The seven
reference rows carry the band and the mesh above, the sibling mesh
below and the next asset row do not. Depths 1, 5, 10, 11, 12 and 20
each answer a guide width of ten pixels per level. Behaviour is
unchanged field for field against the previous build: click, double
click, the context menus, drag state, and the reference rows still
refusing drag and menus. Dark and light themes, hover, a closed mesh,
a scrolled tree and the Resources tab all checked; zero page errors.
Typecheck, lint, the kite3d suite and the scripts tests green; CI on
the branch green. Squash of PR #47.

Closes #47

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant