Skip to content

fix(editor): Content Browser context menus, File menu, and drag-and-drop - #756

Merged
JeanPhilippeKernel merged 2 commits into
developfrom
fix/project-view-modal-popup-timing
Sep 6, 2026
Merged

fix(editor): Content Browser context menus, File menu, and drag-and-drop#756
JeanPhilippeKernel merged 2 commits into
developfrom
fix/project-view-modal-popup-timing

Conversation

@JeanPhilippeKernel

Copy link
Copy Markdown
Owner

Summary

  • Content Browser: fixed a popup-timing race and missing focus that made Create Folder/Rename/Delete non-functional, polished the modal UI, fixed a shared-popup-key bug in the grid's context menu, and added a New File/New Folder option on right-click in empty grid space.
  • File menu: New Scene, Open Scene, and Quit now actually work; Save Scene/Save Scene As fixed a dangling-pointer bug and are stubbed pending the scene serializer rebuild (feat(scene): SceneSnapshot struct + ISceneSerializer interface — foundation #713-test(scene): SceneSerializationTest.cpp — 8 tests for YAML + binary serializers #719); deleted the dead Messenger system.
  • Native file dialog: switched from a blocking runModal call (froze the whole engine loop) to an async beginWithCompletionHandler, bridged into the existing coroutine scheduler.
  • Drag-and-drop: fixed two ZUI framework bugs that made every drag-and-drop in the app non-functional (frozen drop-target key, payload length zeroed on success); wired up .zemesh/.zescene drops on the viewport.
  • Fixed the Inspector's UUID field display (was reinterpreting raw bytes as a C string).
  • Fixed Escape closing the whole editor instead of just canceling a modal.

Material/texture resolution for dropped meshes is intentionally left out — the mesh's embedded material UUID and the asset registry's UUID for that file come from independent, uncoordinated code paths today. Tracked separately in #755.

Test plan

  • Create Folder / Rename / Delete in the Content Browser (left tree and grid)
  • Right-click empty grid space → New File / New Folder
  • File menu: New Scene, Open Scene (native dialog), Save Scene/Save As (safe stub), Quit
  • Escape cancels modals without closing the app
  • Drag a .zemesh from the Content Browser onto the viewport — actor spawns and renders
  • Inspector shows a real UUID string for MeshUUID

…ag-and-drop

Content Browser:
- Create Folder/Rename/Delete context menus and modals were built but never
  wired correctly — a popup-timing race meant the modal always closed itself
  before it could render, and the name field never received keyboard focus.
- Polished the modal UI (centered, right-aligned buttons, Enter/Escape,
  disable-when-empty, red Delete styling, pre-selected Rename text).
- The grid's context menu used one shared popup key for every card, so
  opening one card's menu opened every card's; fixed with a per-card key.
- Right-click on empty grid space now opens New File / New Folder.

File menu:
- New Scene only cleared the selection — now actually clears the scene
  (ActorManager::DestroyAll + scene->Reset()).
- Open Scene just logged a hint; now opens a native file dialog defaulting
  to the project's scene folder.
- Save Scene / Save Scene As constructed the serializer as a local stack
  variable handed to a background thread pool that outlived it — a
  dangling-pointer bug. Scene serialization is being rebuilt from scratch
  (#713-#719), so these are stubbed behind Editor::SaveScene/SaveSceneAs
  rather than patched against a format about to be replaced.
- Quit called glfwSetWindowShouldClose, which nothing in the main loop
  reads — added Engine::RequestClose(), which does what the real OS
  window-close path does.
- Removed a leftover dev shortcut that fired a window-close event on every
  Escape press, regardless of context — harmless when this was a bare test
  window, but closes the whole editor today when Escape cancels a modal.
- Deleted Tetragrama/Messengers/ and MessageToken.h: every token they
  carried had zero consumers repo-wide, leftover from the pre-ZUI editor.

Native file dialog:
- NSOpenPanel's runModal blocked the main thread for as long as the dialog
  was open, freezing the whole engine loop. Switched to
  beginWithCompletionHandler, bridged into the existing coroutine scheduler.
  Adds a default-directory and message parameter (Windows/Linux best-effort,
  untested on this machine).

Drag-and-drop:
- Two bugs in ZUIInteractionPass made every drag-and-drop in the app
  non-functional: the drop target was read from ctx->HotKey, which is
  frozen while the mouse is held, so it always resolved to wherever the
  drag started rather than where it was released; and the payload length
  was zeroed in the same statement that reported the drop as successful,
  so every drop reported success with an empty payload.
- Dropping a .zemesh/.zescene onto the viewport now resolves the VFS-style
  drop path to native and ingests the mesh explicitly (the registry's
  auto-ingest path is dead code, tracked separately in #755). Material/
  texture resolution is intentionally left out — the mesh's embedded
  material UUID and the registry's UUID for that file come from
  independent, uncoordinated code paths today (#755).
- Added a small drag-ghost indicator so a drag in progress is visible.

Also fixes the Inspector's generic field renderer reinterpreting a
uuids::uuid as a C string instead of formatting it, and runs clang-format
over the touched trees.
FileOpenPicker has no SuggestedStartFolder API — WinRT pickers only
support a fixed PickerLocationId enum, not an arbitrary start folder,
which broke the Windows CI build (C2039). default_dir/message have no
effect on Windows as a result; ComputerFolder is used unconditionally.
@JeanPhilippeKernel
JeanPhilippeKernel merged commit f6f60d7 into develop Sep 6, 2026
17 checks passed
@JeanPhilippeKernel
JeanPhilippeKernel deleted the fix/project-view-modal-popup-timing branch September 6, 2026 05:23
@github-project-automation github-project-automation Bot moved this from In Progress to Done in ZEngine Board Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-linux Work on Linux system area-macOS Work on macOS system area-window Work on Window system

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant