7 Commits

Author SHA1 Message Date
Homer bad780de9d Editor: Unity-style file explorer in the Project panel
The last item of the Stage-10 editor-UX batch. The Project panel's
fixed typed-folder listing becomes a real file explorer over assets/:

- breadcrumbs + double-click folder navigation, " New Folder", inline
  rename rows, context menus (Open / Rename / Delete), drag a row onto
  a folder (or "..") to move it, drag files in from the OS to import
  into the current folder, double-click to open (scripts via the
  external-editor flow, others via xdg-open).
- All behavior lives egui-free in editor/src/explorer.rs (listing,
  breadcrumbs, name validation/uniquing, create/rename/move/delete/
  import) and is unit-tested; the shell only renders it. Renames and
  moves ride the uid-preserving AssetDatabase ops so saved AssetRefs
  keep resolving; unregistered files fall back to fs::rename. Folders
  delete only when empty — no recursive asset deletion.
- Engine: AssetDatabase::scan now walks the WHOLE assets/ tree instead
  of just the typed folders, so assets organised into custom folders
  register and survive rescans (covered by updated unit tests).

File operations act immediately and bypass the undo stack, like the
hierarchy's structural edits. GUI piece — needs an eye-check before
promotion to main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 21:01:05 +02:00
Homer 3c59faa506 Editor: native folder picker for New/Open Project
Stage-10 editor-UX follow-up ("typing the path by hand is very hard to
use"). Both project dialogs gain a Browse… button that opens the native
folder picker via rfd's xdg-portal backend — pure Rust, one build works
on Wayland and X11 through xdg-desktop-portal. The dialog runs on a
helper thread reporting over an mpsc channel (polled once per frame in
Shell::build), so the editor keeps rendering while the picker is up;
one pick at a time, and the typed path field remains as a fallback for
portal-less environments.

GUI piece — needs an eye-check (on both Wayland and Xorg) before
promotion to main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 20:47:12 +02:00
Homer 608898411a Editor: open scripts in an external editor
Stage-10 editor-UX follow-up, second half of in-editor script authoring:

- "✏ Edit" button on the Script inspector section (enabled once a
  source is assigned) and double-click on any script in the Project
  panel open the .rhai in the user's editor. Non-script assets
  double-click through xdg-open.
- Resolution order: the new External Editor preference command (spawned
  detached as `<command> <file>`, flags allowed), else $VISUAL/$EDITOR
  in a new Terminal-panel tab (TUI editors work in-editor via the
  existing PTY widget), else xdg-open.
- New `editor.external_editor` settings section (ExternalEditorPrefs)
  registered by EditorState, persisted with the preferences file, with
  a rich row in the Preferences window; registration covered by a unit
  test. Editor crate now depends on serde directly for its own
  sections.

Saved edits flow back through the file watcher's live reload, including
into a playing scene. GUI piece — needs an eye-check before promotion.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 20:41:37 +02:00
Homer fd25677631 Editor: "New Script" button on the Script inspector
Stage-10 editor-UX follow-up. The Script component's inspector section
now ends with a name field + " New Script" button (Enter in the field
also submits): it writes a fresh .rhai from the tested template into
assets/scripts/ via create_script_file (sanitized stem, collisions
suffixed), registers it in the asset database, saves the manifest, and
assigns it to the component's `source` through the normal edit path —
so the assignment is one undoable SetFieldCmd. Disabled with a hint
while no project is open; failures land in the Console via the log.

GUI piece — needs an eye-check before promotion to main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 20:33:23 +02:00
Homer 1f3a034215 Asset database file ops + script-file creation helpers
Groundwork for the Stage-10 editor-UX batch (file explorer, New Script
button), all pure logic proven by unit tests:

- `AssetDatabase::move_asset` / `move_folder` / `delete_asset`: perform
  the disk operation and the uid-map update together, so renaming or
  moving an asset (or a whole folder) keeps its uid and every saved
  `AssetRef` resolving. Kinds re-classify from the new path; `..` and
  existing destinations are refused via the new `AssetDbError` enum;
  deleted uids are never reused.
- Editor `assets.rs`: `script_template` (compiles under the sandboxed
  ScriptEngine — covered by a test), `sanitize_script_stem`, and
  `create_script_file` which writes a collision-free
  `assets/scripts/<stem>.rhai` and returns the relative path for
  database registration.
- docs/assets.md: new "File operations" section + the missing Script
  row in the typed-folder table.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 20:29:08 +02:00
Homer b13e40770e Fix float-literal fallback lints for Rust 1.97
rustc 1.97 promotes the float-literal type-fallback check on generic
`impl Into<f32>` arguments (rust#154024) to a denied lint, which breaks
the editor's `#![deny(warnings)]` build: every bare literal passed to
`egui::Stroke::new` now needs an explicit type. Suffix the eleven
affected literals with `_f32`; no behavior change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 20:29:08 +02:00
Homer Simpson f56a1eea3b Import Oxide engine (Stages 0–10) under MIT license
Full project snapshot migrated to new Gitea remote without history:
engine, editor, physics, script, examples, tests, docs, and assets.
Relicensed from GPLv3 to MIT and updated repo URLs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 20:41:02 +02:00