Skip to content

Library popover: much wider default, single-click open, hover-preview clips - #248

Open
OmarB97 wants to merge 12 commits into
lightningpixel:mainfrom
OmarB97:feat/asset-library-ux-v2
Open

Library popover: much wider default, single-click open, hover-preview clips#248
OmarB97 wants to merge 12 commits into
lightningpixel:mainfrom
OmarB97:feat/asset-library-ux-v2

Conversation

@OmarB97

@OmarB97 OmarB97 commented Jul 28, 2026

Copy link
Copy Markdown

Builds on feat/asset-library-ux (PR #247, still open) -- same head-branch-per-PR-against-main pattern as #242/#243/#244/#245/#246/#247. Scoped entirely to the Library popover in the Generate area; doesn't redo anything #247 already shipped (taller default, bottom drag handle with persisted height, search auto-expand, 40px thumbnails).

Problem

Follow-up feedback on the #247 popover, from real use:

  • The panel is full-height now, but its width floor/default/ceiling (260/320/560) were left alone -- confirmed on screen at roughly 280px wide, a worse shape than before: tall and unusably narrow, with names and paths truncating.
  • Opening an asset was a forced two-step: click a row to select it, then separately click "Open selected asset." The button stayed the only way to actually open something.
  • No way to preview an animation clip without leaving the list, and no hover feedback at all on a row's thumbnail.

Changes

  • Width floor/default/ceiling raised to 380/640/960 (from 260/320/560) in assetLibraryUi.ts. The floor moved too, not just the default: getStoredAssetLibraryPanelWidth() clamps whatever's in localStorage through the current bounds, so a panel someone already dragged down toward the old ~260-280px floor in a prior session clamps back up to something usable on the next launch instead of silently staying cramped. At the new width a row's thumbnail, name, full workspace path, and type badge all sit on one line without truncating for realistic asset names -- verified against real workspace assets, not fixtures (see Verification). No other layout changes; the drag handle, persistence mechanism, and max-width viewport clamp from Rework the Library popover: usable default size, search auto-expand, drag-resizable height #247 are untouched.
  • A row click opens the asset -- no second click. handleOpenSelectedLibraryEntry in GeneratePage.tsx is now backed by a shared openLibraryEntry(entry) helper; a row's onActivate calls it directly after selecting, and the "Open selected asset" button calls it via the existing selected-entry lookup. Non-openable entries still just select and surface their existing "why not" message -- only openable entries actually open. The button remains as a secondary affordance (useful to retry after a transient error) but is no longer the only path.
  • Hover preview clips, wired for a pipeline that doesn't exist yet. On hover, a row with a rendered preview manifest swaps its static thumbnail for a looping WebP clip; a small ‹ › control appears on the tile to cycle clips when a model has more than one, without leaving the list. This reuses the existing workspace:library:thumbnail IPC channel end to end rather than adding a parallel one:
    • AssetLibraryThumbnailRequest gained an optional previewClip field; AssetLibraryThumbnailResult's success case gained an optional previews: { clip, duration }[].
    • The default (no previewClip) request behaves exactly as before, plus now attaches the manifest's clip list (name + duration only, no image bytes) when a <model>.previews.json manifest exists beside the asset -- so the UI learns whether hover-to-animate is available for free, off the same eager thumbnail load every entry already does.
    • Passing previewClip: <name> fetches that one clip's <model>.preview-<clip>.webp as a data URL instead, lazily (only on hover, only once per clip per row) and cached per row for the row's lifetime.
    • The manifest's file field is trusted only as a filename (basename()-only, any directory component discarded) and the reconstructed sibling path is re-validated through the same normalizeWorkspaceAssetPath guard every other workspace-library read already uses, so a malformed or stale manifest can never point outside the asset's own directory. A non-.webp extension or a file that doesn't exist both fail closed the same way a missing thumbnail does today.
    • No preview manifests exist yet -- that pipeline is a separate, in-flight piece of work -- so today this is inert: previews is absent from every response, no extra IPC calls happen, and every row renders and behaves exactly as it did before this PR. Confirmed on the real desktop build, not just by reading the code (see Verification).

Files changed

  • src/areas/generate/assetLibraryUi.ts -- width floor/default/ceiling constants.
  • src/areas/generate/assetLibraryUi.test.ts -- updated width-bound assertions, including the "already-narrow persisted value clamps up" case.
  • src/areas/generate/GeneratePage.tsx -- openLibraryEntry extraction + row-activation wiring; new AssetLibraryEntryRow component (hover state, lazy per-clip fetch, mini cycle control); libraryPreviews state and fetchLibraryPreviewFrame.
  • src/shared/types/assetLibrary.ts -- AssetLibraryPreviewClip; previewClip on the thumbnail request; previews on the thumbnail result.
  • src/shared/types/assetLibrary.test.ts -- type-shape coverage for the new request/result fields.
  • electron/main/artifact-registry-service.ts -- preview manifest parsing, clip-path resolution (basename + normalizeWorkspaceAssetPath re-validation), and the extended readWorkspaceAssetLibraryThumbnail/IPC handler.
  • electron/main/artifact-registry-service.test.ts -- manifest happy path, missing/malformed manifest, and traversal/wrong-extension safety tests for the new clip resolution.
  • electron/preload/artifact-registry-preload.test.ts -- previewClip passthrough over the existing channel.
  • src/areas/generate/assetLibraryService.test.ts -- renderer-side previewClip passthrough.

Verification

Built, packaged (npm run package, AppImage target), and installed the same way the currently-running build was installed: asar extracted into resources/app, original parked as app.asar.orig, prior install backed up before swapping in.

  • Opened the Library against the operator's real workspace assets (no fixtures): at the width the app landed on after this change, every visible row's thumbnail, name, full path, and MESH badge rendered on one line, fully untruncated.
  • Dragged the resize handle wider; it moved smoothly past the old 560px ceiling up toward the new 960px one, and the wider rows stayed just as readable.
  • Single-clicked a row with no other interaction: it highlighted as selected and the mesh loaded into the viewer immediately (Export/Smooth/Decimate appeared, poly/vert count populated, viewer gizmo appeared) -- confirmed via the local API log showing the GET /workspace/... for that exact asset, fired by the one click.
  • For the hover-preview path, temporarily wrote a real two-clip .previews.json manifest plus two small real WebP images beside one existing workspace asset (not shipped with this PR -- removed immediately after verification): hovering swapped the static thumbnail for the first clip's image, the ‹ › control appeared, and clicking it swapped to the second clip's image without opening the asset (confirmed no new GET /workspace/... request fired for that click). Removed the fixtures and refreshed: hovering the same row went back to exactly the old behavior, no leftover control, no errors.
  • Confirmed the no-manifest case independently, before creating any fixtures: hovering assets with no preview data showed only the existing hover-tint behavior, no cycle control, no console/log errors.
  • npm run lint and npm test (test:py + test:node, all green) both pass.

Test plan

  • npm run lint
  • npm test
  • npm run build
  • npm run package (AppImage) + real install + manual verification on the desktop app, including a temporary hand-built preview manifest to exercise the hover/cycle path end to end

OmarB97 and others added 12 commits July 27, 2026 15:52
Rigged models (from the rigging extensions, or any GLB with clips) render
frozen in bind pose today: the viewer loads the glTF but never creates an
AnimationMixer, so the clips it just parsed never run. That reads as a
failed rig rather than a missing feature.

Create a mixer for models that carry clips, tick it from useFrame, and
dispose it with the model. When a file carries more than one clip, offer a
small picker so each motion can be reviewed without leaving the app.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Asset rows now render their pre-rendered <name>.thumb.png beside the
filename instead of showing bare text, falling back to the existing
text-only row when no thumbnail exists. The Library panel can also be
resized by dragging its edge, with the chosen width persisted across
restarts.
npm ci fails on main because the committed lockfile is stale against
package.json; npm install (what upstream CI itself falls back to) brings
it back in sync. Committing the result so ci is usable again on this
branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Ctrl/Cmd with +, -, or 0 now scales the whole window like a browser,
clamped to [-2, 4] and persisted to <userData>/ui-zoom.json so it survives
restarts. This extends the existing before-input-event handler (where the
macOS quit shortcut already lives) and calls webContents.setZoomLevel
directly, deliberately not CSS zoom: a CSS transform scales the rendered
pixels without telling the 3D viewport, so pointer math there (raycasting,
gizmo dragging) goes wrong as soon as the page is scaled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The panel's resize handle was a 1px strip with no resting affordance —
easy to miss entirely. Widen it to 2px with a visible resting tint plus a
stronger hover/active highlight, mark it up as a proper separator
(role, aria-orientation, title) matching the Library panel's handle, raise
the width cap from 520 to 900 so wide parameter forms have room, and
persist the chosen width to localStorage (modly-panel-width) the same way
the Library panel already remembers its own width.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Parameter labels used a truncating 5rem column that clipped anything
  longer than a couple of words; widen it to 8rem and let it wrap.
- The prompt textarea was a fixed 3-row, non-resizable box; make it 14
  rows by default and user-resizable (resize-y, 14rem min-height).
- Say plainly which Generate inputs are required vs optional: "Your
  sketch or photo -- required" and "Extra details -- optional".
- Add a text param type (a plain input, unlike the existing string type
  folder picker) so free-text fields like the exporter new name, project,
  and tags params render as usable text boxes instead of falling through
  to a numeric input.
- Render clickable tag-suggestion pills beneath any tags param: slugified
  words from that node typed name/project fields, plus a small fixed
  game-asset vocabulary, deduped and capped at 10. Clicking a pill toggles
  it in the comma-separated value; no network calls.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The clip picker was a raw select mounted via drei Html at the model
origin, recreating the whole AnimationMixer every time the clip changed
(a hard cut, not a blend) and easy to lose behind the scene. Replace it
with a proper bottom-left overlay component (MotionBar), matching the
existing ViewerToolbar/stats-overlay idiom:

- The mixer and active AnimationAction now live for as long as the model
  does; switching clips fades the old action out and the new one in over
  0.25s instead of recreating anything.
- GltfMeshModel reports its clip list up to Viewer3D (the same
  onStats/onObject callback pattern already used here), which owns the
  active index and renders MotionBar as a plain sibling of the Canvas.
- Zero clips renders nothing, exactly one clip shows its name read-only,
  more than one gets a labelled dropdown plus a Next button that cycles
  with a cross-fade. All playback loops.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The built-in exporter named every file export-<epoch-ms>.glb, so a folder
of work told you nothing. Add three optional params: model_name (used to
slug the file name, falling back to a dated model-YYYY-MM-DD-HHMM name),
project (files land under Exports/<project-slug>/ so a game groups
together instead of one long list), and tags. Output is always
<slug>-<4-char-unique>.<ext> so re-exports never collide.

Tags are the operator typed list plus what the file itself can tell:
rigged (has skins), animated plus clip-<name> per animation, textured,
and one of low-poly/mid-poly/high-poly by triangle count, plus the
project slug. Tags are written both as a <file>.tags.json sidecar and
embedded under the glTF asset extras (extras.modly), so they travel with
the file either way.

Ported from the already-working implementation at
/mnt/tank/modly/app/extracted/resources/builtin-extensions/mesh-exporter
on the operator machine.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The agent had no idea what was actually on screen beyond a mesh path and
triangle count -- it couldn't tell you which clip was playing, what the
model was named, or what game it belonged to. Extend both ends of that
pipeline:

- ChatPanel now mirrors the viewer's selected clip and full clip list
  (Viewer3D reports them into appStore alongside the existing
  meshStats/meshSelected pattern) into the /agent/chat context, so
  requests like "make the stroll slower" resolve without re-asking.
- agent.py resolves the current mesh's name/project/tags from its
  .tags.json sidecar, falling back to the GLB's own embedded
  extras.modly when no sidecar exists, and renders them into the system
  prompt in the same style as the existing scene-context lines.

Lineage: when mesh-exporter's input traces back to an existing workspace
asset, record derived_from in the sidecar -- the source's workspace-
relative path plus its name if it had one. The workflow runner threads a
sourceAssetPath through NodeOutput/ProcessInput from wherever a mesh
first resolves (the Load 3D Mesh node) down to whichever node eventually
exports, so multi-step chains still carry it. Re-deriving from an already
-derived asset keeps just the immediate parent plus the chain's root
(read from the parent's own derived_from, if any) instead of growing an
unbounded list. Surfaced in the chat context alongside name/project/tags.

Also fixes an open question: the rig-and-animate extension's "Describe
the movement" param sets multiline: true, a flag ParamField never
checked -- it fell into the plain "string" case and rendered as a single
-line input with a stray folder-browse button. ParamField now renders
any multiline-flagged param as a resizable textarea (matching the
existing "Extra details" box), independent of its base type.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Search now force-expands every section that contains a match instead of
requiring a manual Show click per group, and clearing the query falls
straight back to whatever was collapsed before (collapsedSectionKeys is
never mutated by the search itself).

The listing area now flexes to fill a resizable popup instead of being
capped at max-h-64 (roughly 3-4 rows) - a new bottom-edge drag handle
mirrors the existing width handle, with its own clamp/persist pair so
the height survives restarts the same way the width already does.

Also fixes the search input rendering as an oversized box with the
placeholder vertically centered in the middle of it - a known Chromium
input[type=search] quirk, fixed with appearance-none like the rest of
the app's inputs effectively already assume.
The panel width floor, default, and ceiling were all far too small
(260/320/560) for a panel that is now full-height - a thumbnail, a
readable name, its full workspace path, and its type badge could not
share a row without truncating. Raised to 380/640/960 and, since the
floor moved too, a panel already dragged down toward the old 280px-ish
minimum on a prior run now clamps back up to something usable on the
next launch instead of silently staying cramped.

Selecting a Library row and then separately clicking "Open selected
asset" is gone as a required two-step. A row click now selects and
opens in one motion via a shared openLibraryEntry() helper; the button
stays as a secondary affordance (useful to retry after an error) but
is no longer the only path. Non-openable entries still just select and
show their reason, same as before.

Hover previews: on hover, a row with a rendered preview manifest swaps
its static thumbnail for a looping WebP clip, with a small mini-select
control to cycle clips when more than one exists - lazily fetched and
cached per row, never fetched for rows with no manifest. This reuses
the existing workspace:library:thumbnail IPC channel rather than adding
a parallel one: an optional previewClip request field fetches a named
clip's WebP instead of the static thumbnail, and the default (no
previewClip) response now also carries the manifest's clip list when
one exists. The manifest's file field is trusted only as a filename
(basename-only) and re-resolved through the same
normalizeWorkspaceAssetPath guard every other workspace read uses, so
a malformed or stale manifest can never point outside the asset's own
directory. No preview manifests exist yet (that pipeline is separate,
in flight elsewhere) so today this is inert: previews stays empty and
every row behaves exactly as it did before this change.
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