Compare commits

..
Author SHA1 Message Date
Rbanh 9a67a25a15 Clarify renderer foundation follow-ups
CI / Format, lint, test, build (push) Waiting to run
2026-07-12 23:01:02 -04:00
Rbanh 0ce43fc399 Add collider authoring diagnostics
CI / Format, lint, test, build (push) Waiting to run
2026-07-12 22:48:00 -04:00
Rbanh 0e7aed40f1 Add transactional physics placement
CI / Format, lint, test, build (push) Waiting to run
2026-07-12 22:07:17 -04:00
Rbanh d1a56f77cc Add terrain material layer painting
CI / Format, lint, test, build (push) Waiting to run
2026-07-12 21:00:13 -04:00
Rbanh 293811aecd Add terrain sculpt stroke tools
CI / Format, lint, test, build (push) Waiting to run
2026-07-12 19:50:47 -04:00
Rbanh ed21bcc52d Add chunked terrain authoring foundation
CI / Format, lint, test, build (push) Waiting to run
2026-07-12 18:43:42 -04:00
Rbanh 577d8dcb27 Refresh production readiness matrix
CI / Format, lint, test, build (push) Waiting to run
2026-07-12 18:10:03 -04:00
Rbanh ba59f57a5a Finish non-blocking native dialog workflows
CI / Format, lint, test, build (push) Waiting to run
2026-07-12 18:06:57 -04:00
Rbanh d038cf3670 Add non-blocking native dialog broker 2026-07-12 17:48:51 -04:00
Rbanh 61be2440bd Document collaborative file safety acceptance
CI / Format, lint, test, build (push) Waiting to run
2026-07-12 17:43:07 -04:00
Rbanh 3794faa4aa Document material workflow acceptance
CI / Format, lint, test, build (push) Waiting to run
2026-07-12 13:18:40 -04:00
Rbanh 02247f029a Add material library and targeted surface drops 2026-07-12 13:14:47 -04:00
Rbanh 3931de1f0a Fix hot reload feature matrix
CI / Format, lint, test, build (push) Waiting to run
2026-07-12 11:35:57 -04:00
Rbanh f2ad88fd03 Define production readiness acceptance gate 2026-07-12 11:29:17 -04:00
Rbanh 5a82a9ee29 Add collaborative authored-file safety 2026-07-12 11:27:57 -04:00
Rbanh b4aa61e394 Ship production navigation authoring workflow 2026-07-12 02:53:43 -04:00
Rbanh 0798aa5d57 Build renderer and material component foundations
Add dedicated skinned rendering, pose restoration, shared Material and Material Instance slots, registry-driven components, Surface/Solari integration, transactional schema upgrades, navigation authoring, documentation, and evaluation evidence.
2026-07-12 00:24:06 -04:00
Rbanh 0553a85220 Build production-ready editor authoring workflows
CI / Format, lint, test, build (push) Waiting to run
2026-07-11 12:41:04 -04:00
Rbanh cc1fa6ea3b Improve editor workflows and thumbnail resilience 2026-07-10 00:48:25 -04:00
Rbanh b5e561904c Upgrade to Bevy 0.19 and harden editor workflows
CI / Format, lint, test, build (push) Has been cancelled
2026-07-09 23:43:47 -04:00
Rbanh 3f85d25cc7 Group brush CSG history edits 2026-06-06 14:22:36 -04:00
Rbanh 1b9fbebda1 Group brush clip history edits 2026-06-06 14:19:35 -04:00
Rbanh 48b1448c57 Improve quick brush creation workflow 2026-06-06 14:16:12 -04:00
Rbanh f09d35e54e Add brush clip preview
CI / Format, lint, test, build (push) Has been cancelled
2026-06-06 06:48:31 -04:00
Rbanh 4b6617f7f2 Preview brush CSG operations
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:43:25 -04:00
Rbanh b2305932d9 Expand brush validation coverage
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:38:37 -04:00
Rbanh dc593978d8 Hydrate brush face materials
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:35:21 -04:00
Rbanh 09f707b139 Add brush diagnostics window
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:30:18 -04:00
Rbanh 8abe47047d Validate brush CSG inputs
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:27:48 -04:00
Rbanh d9e52d753b Reject invalid brush element edits
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:25:43 -04:00
Rbanh 11b0df2b5f Block saving invalid brushes
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:22:35 -04:00
Rbanh 015ae6da63 Add brush face asset pickers
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:20:08 -04:00
Rbanh 4dc22cd3b6 Add brush validation diagnostics
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:14:00 -04:00
Rbanh d847706b8f Add brush face controls
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:09:02 -04:00
Rbanh 02beeb7085 Add brush CSG commands
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:06:19 -04:00
Rbanh 93ab6c2ea2 Add brush element drag edits
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 06:01:56 -04:00
Rbanh 0bfc062ba7 Add brush element edit modes
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 05:57:50 -04:00
Rbanh fcd34f9079 Add draw brush tool
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 05:52:52 -04:00
Rbanh 9f95ba3082 Add brush authoring schema
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 05:42:19 -04:00
Rbanh cc6acb188d Complete M0 editor asset workflow
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 05:05:52 -04:00
Rbanh d77cc6a40e Add editor operator lifecycle bridge
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 04:07:58 -04:00
Rbanh 2054fa2558 Advance M0 scene and rendering foundations
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 03:50:03 -04:00
Rbanh 2fa64106c8 Polish inspector add component workflow
CI / Format, lint, test, build (push) Waiting to run
2026-06-06 03:08:28 -04:00
Rbanh 19c4d017dc Start M0 editor workflow polish 2026-06-06 02:15:14 -04:00
486 changed files with 88149 additions and 31804 deletions

No files matched your search

+4
View File
@@ -6,3 +6,7 @@ rustflags = ["-C", "link-arg=-fuse-ld=mold"]
[alias] [alias]
clean-target = "run -p xtask --bin clean-target --" clean-target = "run -p xtask --bin clean-target --"
validate-levels = "run -p xtask --features validate-levels --bin validate-levels --"
bake-navigation = "run -p xtask --features validate-levels --bin bake-navigation --"
package-project = "run -p xtask --features validate-levels --bin package-project --"
upgrade-project = "run -p xtask --features validate-levels --bin upgrade-project --"
@@ -0,0 +1,105 @@
# Skeletal Animation Import, Preview, And Authoring
Working implementation plan for Gitea issue
[`#46`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/46).
This is the minimum production animation loop required by the M7 content-production milestone.
## Status
Implementation and production acceptance are complete. The persistent/runtime contract, generated
manifest, stable model/clip identity, runtime adapter, browser drag workflow, typed inspector, and
headless validation are implemented. Live acceptance covers import, placement, preview, scrub,
save/reload hydration, PIE playback, source relocation, development packaging, and standalone
runtime playback with the committed RobotExpressive fixture.
## Outcome
An author can import a supported skinned model, inspect its skeleton and clips, place an animated
actor, preview and scrub a clip without dirtying the scene, save a small named state set, and drive
the same state changes in PIE and a packaged game. Missing content and skeleton mismatches fail with
owner-attributed repair guidance before packaging.
## Format Policy
- Animation authoring v1 supports glTF 2.0 (`.gltf` and `.glb`) through Bevy's native scene,
skinning, and animation assets.
- FBX remains supported for the existing static mesh import path. An FBX containing animation stacks
or skin deformers is not a supported animated source and must produce a blocking, actionable
diagnostic.
- Animated FBX support cannot be enabled until the loader constructs the source hierarchy, Bevy
skinned-mesh bindings, and `AnimationClip` assets. Metadata counts alone do not qualify as support.
## Architecture
- The asset registry UUID remains the parent model identity. A generated animation manifest under
`assets/animations/generated/` records the source fingerprint, skeleton signatures, stable clip
sub-asset IDs, clip metadata, and animation events.
- `shared::AnimationControllerDesc` is reflected and serializable. It references imported skeletons
and clips through stable `EditorAssetRef` values and owns one layer of named states, a default
state, playback range/loop/speed, and default crossfade duration.
- `game` owns the runtime adapter. It waits for the model `WorldAssetRoot` instance to become ready,
attaches transient animation graph/player state, and exposes a request API for changing an actor's
named state.
- `editor` owns import presentation, clip/skeleton shelves, drag assignment/placement, inspector
controls, and non-dirty preview/scrubbing. Preview uses the runtime adapter rather than a separate
interpretation of the authored contract.
- `scene` and package validation resolve the same manifests and stable references used by editor and
runtime hydration.
## Authoritative Data
The generated manifest is keyed by the model's stable registry UUID and includes:
- schema version and source path/fingerprint;
- scenes and exact skeleton signatures;
- stable skeleton and clip sub-asset IDs;
- clip label, source index, duration, target skeleton signature, and event markers;
- import diagnostics, including unsupported animated FBX content.
An exact skeleton signature is a deterministic hash of normalized ordered joint target paths and
bind-pose structure. Retargeting v1 accepts only an exact signature match. No implicit joint-name,
humanoid, or proportional remapping is allowed.
## Implementation Sequence
1. Add the versioned animation manifest schema, stable sub-asset identity rules, glTF extraction,
FBX blocking diagnostics, and focused importer tests.
2. Add `AnimationControllerDesc`, named state/event types, registration, migration defaults,
actor validation, history snapshots, scene round-trip coverage, and runtime-only strip policy.
3. Replace broad imported-model child cleanup with a dedicated generated instance root, then hydrate
the ready scene instance into a transient graph/player and implement the game state-request API.
4. Extend Asset Browser model shelves with skeleton and clip rows, compatibility status, preview,
scrub/range/loop controls, and clip drag placement or assignment.
5. Add the typed Animation Controller inspector, undoable state edits, PIE pause/stop reconciliation,
owner-attributed project validation, and package dependency collection.
6. Commit a small redistributable animated GLB and sample scene, then run import, round-trip,
headless, live editor/PIE, and packaged-runtime acceptance.
## Acceptance Gates
- A committed skinned GLB and its clips import, preview, save, hydrate, and play in PIE and a
packaged runtime.
- Moving or renaming the source inside the project preserves controller clip references through the
registry UUID and stable sub-asset IDs.
- Missing manifests/clips and mismatched skeleton signatures produce actor/property-attributed
diagnostics with a concrete repair action.
- Gameplay can request a valid named state through the public game API; invalid requests leave the
current state intact and report a diagnostic.
- Preview follows the authored loop/range/speed settings, stops cleanly, and never mutates the scene
descriptor, history, or dirty state.
- Generated graph/player/instance components never serialize into authored scenes, and model
rehydration never deletes authored hierarchy children.
- Animated or skinned FBX content blocks animation import with a diagnostic that explains the glTF
v1 requirement.
- Focused importer, validation, hydration, request-API, and editor operator tests pass alongside
workspace tests, `cargo validate-levels`, package validation, and live smoke testing.
## Deliberate Boundaries
- V1 provides one animation layer with named states, one default state, and a default crossfade. It
does not include a visual state graph, blend trees, transition-condition authoring, inverse
kinematics, motion matching, or root-motion extraction.
- Event markers are normalized data and runtime notifications; V1 has no timeline scripting system.
- Retargeting is exact signature match only.
- FBX static mesh import remains available, but animated FBX conversion is separate loader work and
cannot silently fall back to bind-pose or metadata-only playback.
@@ -0,0 +1,72 @@
# Audio Authoring And Runtime Parity
Working implementation plan for Gitea issue
[`#47`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/47).
This is the minimum complete audio loop required by the M7 content-production milestone.
## Status
Completed and production-accepted in Gitea #47. Permanent behavior is documented in
[ADR 0030](../../docs/adr/0030-audio-authoring-and-bus-schema.md) and
[Audio Authoring](../../docs/editor/audio-authoring.md).
## Outcome
An author can import a supported audio clip, place or assign it as an authored source, tune playback
and spatial behavior, audition it without dirtying the scene, save/reload it, and hear equivalent
behavior in PIE and a packaged game. Projects expose stable Master, Music, and SFX buses with runtime
gain/mute hooks and validation that also runs headlessly.
## Architecture
- `shared` owns reflected, serializable source/listener/attenuation descriptors and stable actor kinds.
- `settings` owns versioned project bus definitions and validation; bus references use stable IDs.
- `game` hydrates authoring descriptors into Bevy audio playback/listener components and applies bus
controls. Hydrated components remain derived and are never scene source of truth.
- `editor` owns asset discovery/import UX, inspector controls, drag/drop placement, visualizers, and
transient audition state. Audition never mutates an authored descriptor or marks a scene dirty.
- Scene and project validation share the same clip-reference, bus-reference, range, and listener rules
used by packaging. Missing, excluded, unsupported, or Git LFS pointer clips block release validation.
## Supported Content
- Ogg Vorbis is the baseline runtime format.
- WAV, MP3, and FLAC support is enabled explicitly in the workspace Bevy feature set.
- Audio sources support gain, pitch, looping, autoplay, spatial blend, attenuation, and bus routing.
- Listener authoring supports enabled state, priority, and ear gap; at runtime exactly one enabled
listener is selected deterministically.
- Default project buses are `master`, `music`, and `sfx`; Music and SFX route to Master.
## Implementation Sequence
1. Add shared descriptors, settings schema/defaults/validation, launcher scaffolding, and migrations.
2. Add audio clip catalog classification, import target, search/filter/details, and drag payloads.
3. Add runtime source/listener hydration, deterministic listener selection, and bus controls.
4. Add inspector cards with undoable edits and scene save/validation allowlists.
5. Add viewport icons/range visualizers and transient audition/stop using the editor camera listener.
6. Add a small sample clip/scene, focused round-trip and PIE tests, live QA, permanent docs, and Gitea
acceptance evidence.
## Acceptance Gates
- Dragging a clip into the viewport creates an audio source; dropping onto a compatible selected
source assigns the clip through one undoable command.
- Inspector edits survive save/reload and PIE hydration without generated playback state leaking into
the authored scene.
- Spatial preview follows the editor camera, stops on explicit Stop, mode/project changes, or source
deletion, and never changes scene dirty state.
- Bus definitions persist with stable IDs, invalid parent cycles/references are rejected, and runtime
gain/mute hooks affect routed sources.
- Headless validation reports missing/unpackageable clips, unsupported values, invalid buses, and
ambiguous enabled listeners with actor/property context.
- Focused unit/integration tests, `cargo validate-levels`, package validation, and live editor/game
smoke tests passed for issue `#47` closure.
## Deliberate Boundaries
- This slice does not include DSP graphs, reverb zones, waveform editing, audio streaming banks,
middleware integration, or platform-specific compression pipelines.
- Continuous spatial blend is represented authoritatively and implemented without claiming Bevy
supports a native blend control; the runtime adapter owns the mapping/mix behavior.
- A future mixer UI may expose additional buses and sends, but it must preserve the stable bus IDs and
parent graph established here.
@@ -0,0 +1,115 @@
# Blacksite Editor Production Readiness Program
Working milestone plan for the production expansion tracked by Gitea epic
[`#1`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/1).
The existing Jackdaw-inspired M0-M5 roadmap remains the authoring/tool foundation. This plan adds
the reliability and shipping gates required for daily indie game production.
## Definition Of Production Ready
Blacksite is production ready only when the evidence matrix in Gitea
[`#50`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/50)
is signed off. Feature presence alone is insufficient. Recovery, validation, packaging,
performance, soak, regression, and first-hour workflows must pass against a representative project.
## Immediate Sequence
1. Completed: hierarchy/prefab boundary hardening `#40`, transactional recovery `#39`, stable
sessions/diagnostics `#41`, and Project Browser/startup boundaries `#3`.
2. Completed: stable scene tabs and composed subscene ownership/validation in `#42`.
3. Completed: nested prefabs, variants, and structural overrides passed production acceptance in
`#43`; M6 implementation is complete.
4. Completed: authoritative content validation `#45` and the validation-gated packaging/Build
workflow `#44`.
5. Completed: audio `#47`, animation `#46`, and navigation `#48` passed production acceptance.
Source-control safety `#49` has complete implementation and source/headless acceptance; live
visual acceptance remains before the readiness gate `#50`.
## Implemented Slice - Collaborative Authored-File Safety
- Exact BLAKE3 baselines for scene tabs, staged Material/Material Instance documents, and Project
Settings.
- One guarded atomic publication path for scene save/export, prefab source Apply/history, and
editable materials, including missing-file and immediate pre-rename race protection.
- Non-destructive background Git porcelain scanning with optional off-thread ownership providers;
Git/provider absence is quiet.
- Compact active-scene and selected-asset state plus Reload, metadata comparison, Save As, and
Cancel conflict recovery. No force-overwrite action exists.
- Focused race, read-only, provider-lock, parser, non-repository, modal-render, scene, and material
tests pass. Live debug-editor visual acceptance remains pending for a desktop-capable QA session;
packaged acceptance remains owner-deferred.
## M6 - Reliability, Recovery, And Project Workflow
**Exit:** A normal or interrupted editor session cannot silently lose or corrupt authored work, and
projects/scenes/prefabs have stable daily workflows.
| Issue | Capability | Priority |
|-------|------------|----------|
| #3 | Project launcher, templates, recent projects, resume | P0 |
| #39 | Transactional saves, autosave, crash recovery | P0 |
| #40 | Hierarchy, parenting, prefab structure hardening | P0 |
| #41 | Session persistence and crash diagnostics | P0 |
| #42 | Multi-scene tabs, subscenes, level composition | P1 |
| #43 | Nested prefabs, variants, structural overrides | P1 |
## M7 - Content Production And Shipping
**Exit:** A clean checkout can validate, build, package, and run a representative project with the
minimum animation, audio, and navigation authoring loops required by the game.
| Issue | Capability | Priority |
|-------|------------|----------|
| #44 | Build/package profiles and Build panel | P0 |
| #45 | Dependency manifest and content release gate | P0 |
| #46 | Skeletal animation import/preview/authoring | P1 |
| #47 | Audio sources/listeners/buses/spatial preview | P1 |
| #48 | Navigation authoring/bake/path preview | P1 |
| #49 | Source-control status and collaborative file safety | P2 |
| #50 | Production-readiness acceptance matrix | P0 |
## Cross-Cutting Gates
- Authored IDs, scene schema, hydration stripping, and extension boundaries remain authoritative.
- Every mutation supports meaningful undo/redo; modal tools also support cancel without dirty state.
- Editor-only helpers, recovery files, and caches never enter scenes or game packages.
- Interactive and headless validation use the same rules and produce equivalent blocking results.
- Large asset, terrain, navigation, and geometry work is debounced or dirty-region based.
- Visible behavior updates root controls and `docs/editor/`; hard-to-reverse decisions get ADRs.
- Production signoff requires a second-person first-hour QA pass and no open P0 blocker.
## Completed Slice - UI Identity And Structural Dragging
- Near-black Blacksite shell with compact tool identity rather than a Unity clone.
- Pointer-following asset drag preview, viewport reticle, boundary, and corner brackets.
- Full-width hierarchy attach targets plus explicit root/reorder/invalid feedback.
- World-transform-preserving reparent/unparent with grouped history.
- Cycle rejection, subtree-safe multi-drag, parent expansion, and focused regression coverage.
## Completed Slice - Multi-Scene Production Workflow
- Independent scene tabs integrated into the right end of the existing main toolbar.
- Stable `SceneComposition` resources with project-relative references and no runtime entity IDs.
- Recursive missing/cycle/duplicate/path-escape validation shared by editor and CI.
- Runtime-only composed ownership, load/lock/focus controls, and owner-save exclusion.
- Per-saved-tab recovery, composition undo/redo, PIE-active composition consistency, and fixtures.
## Completed Slice - Validation-Gated Build And Packaging
- Shared owner-attributed project validation and runtime-packageability policy in editor, CI, and
packaging; unknown schemas, missing LFS objects, excluded references, and unsafe traversal block.
- Versioned development/QA/release profiles with Cargo-reported artifacts, rendering/default-scene
application, Windows QA symbols, supported-target enforcement, and deterministic metadata.
- OS-locked authenticated staging, interrupted-build recovery, complete pre-publish hashing, safe
replacement, and unchanged-output reuse.
- Non-blocking editor Build/Run/Cancel/Reveal workflow with dirty-tab guard and process-tree cleanup.
- Gitea #44 and #45 closed after headless, focused regression, repeated-build, and live packaged
development-runtime acceptance.
## Completed Slice - Audio Authoring And Spatial Preview
The stable authoring/runtime contract is recorded in
[ADR 0030](../../docs/adr/0030-audio-authoring-and-bus-schema.md), with controls, runtime behavior,
validation, and the committed sample fixture documented in
[Audio Authoring](../../docs/editor/audio-authoring.md). Gitea #47 closed after automated,
headless, live editor/PIE, and packaged-runtime acceptance.
@@ -0,0 +1,31 @@
# Collider Authoring Diagnostics - 2026-07-12
Issue: Gitea #26 (`BS-JD-305`)
## Outcome
Collider authoring exposes one consistent health result to the inspector, Collider viewport,
Diagnostics panel, and physics placement preflight. Shape changes preserve useful dimensions and
remain one typed undo operation.
## Contract
- Authored box, sphere, and capsule overlays include actor world scale.
- Static mesh colliders show cooked runtime bounds when available.
- Green is ready, cyan is a trigger, gray is disabled, amber is warning/stale, and red is invalid
or missing.
- Invalid dimensions and mesh references block dependent workflows. Missing hydration and
colliders over 1,000 meters in world extent are warnings.
- Physics placement consumes the same collider-health checks instead of maintaining a separate
prerequisite definition.
## Work
- [x] Add shared authored/runtime collider diagnostics and focused fixtures.
- [x] Add shape/status-aware viewport overlays and selected-collider HUD state.
- [x] Add inspector health/repair feedback and dimension-preserving undoable shape switching.
- [x] Add scene-wide selectable collider findings to Diagnostics.
- [x] Reuse diagnostics in physics placement prerequisites.
- [x] Add a committed non-blocking showcase scene and update documentation.
- [x] Run source gates and live Wayland acceptance; packaged tests remain skipped by request.
- [x] Commit, push, attach native Gitea evidence, close #26, and close M3 when empty.
@@ -0,0 +1,94 @@
# Material Library And Targeted Viewport Drop
Working implementation plan for Gitea issues
[`#16`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/16) and
[`#18`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/18).
The shared Material/Material Instance and stable renderer-slot foundation from `#51` is already
present; this slice completes the production-facing catalog and drag/drop workflow.
## Status
Implemented on `codex/material-library-targeted-drop` after collaborative-safety `#49` was
published and integrated into `main`. Focused and full source-only verification plus live editor
acceptance are green; ticket evidence remains before `#16` / `#18` close.
## Resolved Gaps
- The dockable Material Library now provides cross-folder Material/Instance catalog, usage counts,
health, creation, thumbnails, drag sources, and the guarded existing details editors.
- Viewport Material/Texture drops resolve the surface under the pointer and never broaden to the
current selection or every renderer slot.
- `HydratedRendererMaterialBinding` identifies the exact static/skinned renderer slot; primitives
and stable brush-face IDs use their authored component paths.
- Unsupported, locked, linked, missing, and payload-incompatible targets reject with an explicit
reason and no scene mutation.
- Hover previews are reversible, target changes restore the prior snapshot, and release records one
typed operator/history transaction.
- Viewport pointer tracking remains active while another egui widget owns the drag, so exact target
resolution cannot stall at the viewport boundary.
- Visibility hierarchy setup now precedes generated hydration content, preventing Bevy parent/child
visibility warnings when brush draws are created after scene load.
## Material Library
1. Add a dockable `Material Library` panel, opened from Window and placed in the existing bottom dock
without adding another permanent toolbar.
2. Present project Materials and Material Instances with search, Material/Instance filter, thumbnail
grid/list modes, base/dependency health, and source-control status.
3. Add a scene-usage section that counts renderer-slot, primitive, and brush-face references and can
select/locate users. Do not revive ambiguous hidden scene-local material clones.
4. Reuse the existing guarded Material/Instance drafts for Apply, Revert, Create Instance, and
texture-parameter editing. Shared-file edits remain explicit; scene assignment changes use
history.
5. Material and Instance cells are first-class drag sources and preserve the current pointer-following
visual identity.
## Targeted Drop Contract
Introduce a frame-updated `ViewportAssetDropTarget` resolved by the existing mesh-picking path:
- A hydrated static/skinned draw maps through `HydratedRendererMaterialBinding` to the authored actor
and exact stable slot ID.
- A primitive maps to its authored actor-level `MaterialDesc`.
- A brush performs authored face intersection and identifies the stable face ID.
- An authored but unsupported target remains a visible invalid target with a specific reason.
- Empty space remains placement-only for placeable assets and invalid for Material/Texture payloads.
Payload matrix:
| Payload | Renderer slot | Primitive | Brush face |
|---------|---------------|-----------|------------|
| Material / Material Instance | Assign exact hit slot; one-slot actors may assign directly | Replace actor material reference/values | Replace the hit face material reference |
| Texture | Reject with guidance to create/edit a Material Instance | Set base-color texture | Set hit-face base-color texture/material binding |
An explicit `Apply All Slots` command remains available from the renderer inspector/library usage
menu; a viewport hit never silently broadens from one slot to all slots.
## Preview, Commit, And Cancel
1. Start a persistent drop-preview session when a supported Material/Texture payload enters the
viewport. Snapshot only the target's affected authored state.
2. Apply a transient visual preview without pushing history or marking the scene dirty.
3. When the pointer changes target, restore the previous snapshot before previewing the new target.
4. On release, restore the transient state first, then commit exactly one typed history/operator
transaction to the identified slot, primitive, or face.
5. On Escape, drag cancellation, leaving the viewport, invalid target, or missing source, restore the
exact snapshot and remove every preview/helper marker.
6. The drag card and target outline name the payload, actor, slot/face, action, and invalid reason.
## Verification
- Focused tests cover exact multi-slot assignment/undo, brush-face-only preview/restore, primitive
Material/Texture resolution, renderer Texture rejection, Material Library filtering, and scene
usage counts.
- Source checks include editor all-target check, focused tests, and strict editor Clippy.
- Live acceptance covered the docked catalog, search/type/usage filters, grid/list views, resolved
Material Instance thumbnails, exact primitive preview, green actor/surface feedback, one-step
commit/undo, and Escape rollback. The same relaunch produced no hydration hierarchy warnings.
- Static/skinned exact-slot, brush-face, locked/linked, incompatible Texture, and non-dirty preview
contracts remain covered by focused automated tests; shared-asset file creation was deliberately
not invoked during live QA to avoid adding throwaway authored files.
- Full verification passed: workspace all-target check, strict workspace Clippy, all workspace tests,
strict editor Clippy with both `dev` and `hot-reload`, level validation with zero blockers, and
navigation artifact freshness. Packaged testing remains deferred until the project owner requests
it again.
@@ -0,0 +1,73 @@
# Navigation Mesh Authoring, Bake Diagnostics, And Path Preview
Working implementation plan for Gitea issue
[`#48`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/48).
This is the navigation production loop required by the M7 content-production milestone.
## Status
Architecture, dependency compatibility, composed-source resolution, persisted path samples,
corrective source-level QA, and live debug-editor acceptance are complete. Packaged/release
acceptance remains explicitly deferred until the project owner requests another packaged pass.
## Outcome
A level designer can author navigation bounds, obstacles, areas, links, and agent profiles; bake a
deterministic versioned artifact; inspect stale or invalid data; preview a path in the viewport; and
use the same artifact through a game-owned runtime query API and headless release validation.
## Architecture
- Shared reflected components own bounds, obstacles, area volumes, links, and scene bake settings.
- The scene crate owns deterministic composed-source resolution, source fingerprinting, bake
artifact IO, the engine-independent query core, and validation.
- Rerecast performs the 3D walkable-surface bake without coupling navigation to a Bevy plugin
release. Polyanya performs proven any-angle runtime and editor-preview path queries.
- Overlapping primitive and additive-brush triangles enter the deterministic bake source; distant
geometry and navigation authoring are excluded from each bounds fingerprint. No synthetic bounds
floor is added.
- The game crate adapts the shared query core to Bevy types and exposes renderer-free artifact
validation. Editor preview and project validation do not implement separate pathfinders.
- Generated artifacts live under `assets/navigation/generated/`, are project-relative runtime
dependencies, and never serialize viewport helpers into authored scenes.
## Implementation Sequence
1. Add reflected authoring schema, versioned bake artifact, source fingerprint, validation, and
exact agent-profile settings.
2. Add deterministic Rerecast bake input extraction for authored bounds/obstacles and headless bake
command coverage.
3. Add game-owned artifact loading and Polyanya path-query API, including authored off-mesh links.
4. Add typed inspectors, create commands, bake/stale status, viewport overlay, and start/end path
preview.
5. Add owner-attributed project validation for invalid links, missing/stale artifacts, unreachable
preview samples, and bake failures.
6. Commit a small sample scene/artifact and run automated, headless, and live debug-editor
acceptance. PIE and packaged runtime acceptance remain deferred by project-owner direction.
## Acceptance Gates
- A designer can create bounds and obstacles, bake, view the resulting mesh, and preview a valid
start-to-end path.
- Agent radius, height, climb, and slope settings deterministically affect the bake fingerprint.
- Relevant geometry or navigation-authoring changes mark the artifact stale; unrelated scene
metadata does not.
- Invalid or dangling links, samples outside the mesh, isolated regions, and bake failures identify
the owning actor or setting and provide a repair action.
- Runtime path queries and editor preview use the same game-owned API and versioned artifact.
- Helper meshes, lines, endpoints, and bake state are transient and never serialize.
- Headless bake and project validation pass for the committed sample fixture, and package dependency
collection includes the current artifact.
- Visible subscenes and nested prefab contributors resolve identically from editor snapshots and
headless tooling; unsupported structural overrides block with an apply/unpack repair action.
## Deliberate Boundaries
- V1 supports static baked navigation plus explicit links. Dynamic crowd avoidance and runtime tile
carving are separate work.
- Full partial-tile regeneration waits for upstream Rerecast tiling support. V1 records affected
source bounds and debounces a deterministic full bake while reporting the dirty region.
- Area costs are authored and validated in V1; path-cost weighting beyond walkable/blocked areas is
deferred until the runtime exposes per-polygon cost callbacks.
- Imported static meshes remain obstacle-authored in V1 because their normalized manifests do not
yet expose deterministic collision triangles to the headless scene crate.
@@ -0,0 +1,36 @@
# Non-Blocking Native Dialogs
Working implementation plan for the production-readiness defect discovered during live acceptance
of collaborative file safety. Opening an `rfd` picker synchronously from an egui/Bevy system stops
window event processing long enough for Hyprland to report Blacksite as unresponsive.
## Scope
1. Add one project-level native-dialog broker with a typed intent, one active dialog, background
native work, and a main-thread result queue.
2. Convert scene open/save-as, asset import/export, prefab save/source selection, subscene selection,
conflict Save As, diagnostics export, and project-launcher folder selection to the broker.
3. Keep destructive or stateful application logic on the Bevy main thread after a path result is
received. Background work may only own the native dialog and its returned paths.
4. Show a stable pending state and reject duplicate dialog requests while a picker is active.
5. Replace blocking native dirty-scene confirmation dialogs with an editor-owned modal when the
scene-transition state machine can preserve the original action exactly.
## Contract
- The editor continues rendering and processing compositor pings while a native dialog is open.
- Cancel returns a typed empty result and does not mutate editor state.
- A result is applied once to the intent that created it; stale or duplicate results cannot run.
- Paths are validated at the same ownership boundary as before. The dialog broker does not read,
write, import, save, or canonicalize project content.
- Existing collaborative revision guards remain authoritative after Save As selection.
- Project-launcher dialogs use the same broker before the full editor plugin group is active.
## Verification
- Focused tests cover request exclusivity, cancel, one-shot result delivery, and typed intent
preservation.
- Source-only workspace formatting, check, strict Clippy, and tests run; packaged acceptance remains
deferred by project-owner direction.
- Native Wayland QA opens representative file, folder, and Save As dialogs under Hyprland and
confirms the Blacksite window remains responsive without an unresponsive-application prompt.
@@ -0,0 +1,36 @@
# Physics Placement Tool - 2026-07-12
Issue: Gitea #25 (`BS-JD-304`)
## Outcome
Selected authored props can be released into deterministic Avian gravity, preview their
settled transforms in the Scene viewport, and either commit the result as one undoable
transform operation or cancel back to the exact pre-placement state.
## Contract
- Physics is paused during normal Edit mode and while Play mode is paused.
- Placement runs only in Edit mode and owns a transactional physics session.
- Selected mutable level objects must have active rigid-body and non-trigger collider
authoring. Invalid selections produce a precise, non-destructive diagnostic.
- Selected bodies are temporarily dynamic with clean motion state.
- Other movable bodies are temporarily static so they remain collision surfaces without
advancing unrelated authored state.
- Commit restores all temporary runtime overrides and records only changed local transforms
as one grouped history command.
- Cancel restores transforms and runtime physics state exactly and creates no history entry.
- Escape cancels. Enter commits once the session has reached rest. A bounded timeout keeps
unstable scenes controllable.
## Work
- [x] Establish Edit/Play ownership of `Time<Physics>` and preserve paused single-step PIE.
- [x] Implement placement validation, runtime snapshots, deterministic stepping, settling,
timeout, commit, and cancel.
- [x] Add the placement action and session controls to the existing horizontal viewport
toolbar plus a compact status HUD.
- [x] Add unit/integration coverage for prerequisites, settling, cancel, commit, and history.
- [x] Update editor workflow documentation and implementation checklist.
- [x] Run source gates and live Wayland acceptance; packaged tests remain skipped by request.
- [x] Commit, push, attach native Gitea evidence, and close #25.
@@ -0,0 +1,38 @@
# Production-Readiness Acceptance Gate
Working plan for Gitea issue
[`#50`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/50).
This gate is broader than the M7 feature list: it proves the complete daily authoring, content,
recovery, performance, and release workflow against one exact release-candidate commit.
## Status
Audit in progress. The versioned acceptance matrix exists, but no release candidate is nominated and
the gate is not signed off. Packaged/release testing remains explicitly deferred until the project
owner requests it again.
## Sequence
1. Keep one evidence matrix under `docs/editor/evaluations/production-readiness/`; historical H1-H6
notes remain context only.
2. Close implementation blockers before nominating a candidate: the deformed Solari geometry
boundary in `#51`, terrain `#22`-`#24`, physics placement/diagnostics `#25`-`#26`, and their
regression fixtures. Collaborative safety `#49`, Material Library/targeted drops `#16`/`#18`,
and native-dialog responsiveness `#52` are accepted and integrated.
3. Complete the representative regression project, mutation-invariant coverage, performance budgets,
and first-hour workflow tracked by `#32`-`#36`.
4. Nominate one exact commit, validate it from a clean checkout, and record source/headless results.
5. When packaged testing is re-enabled, run the candidate's package/build and packaged-runtime
matrix without substituting older artifacts.
6. Run the eight-hour soak and measured performance protocol, consolidate limitations by severity
and workaround, and obtain independent first-hour/recovery sign-off.
7. Post the signed Gitea milestone comment linking the exact commit and immutable evidence. Close
`#50` only when every required row passes and no P0 blocker remains.
## Gate Rules
- Feature presence is not acceptance evidence.
- A local dirty worktree is not a release candidate.
- Results from another commit or an old package do not transfer to the candidate.
- Deferred, missing, partial, and implementer-only evidence are not passes.
- Every failure records an owner ticket or a concrete rerun condition.
@@ -0,0 +1,25 @@
# Renderer Foundation Acceptance Split - 2026-07-12
Issue: Gitea #51 (`BS-JD-207`)
## Outcome
Accept the shipped renderer/material/Surface foundation without claiming two independent future
systems. Preserve the existing safe raster/Forward behavior and track each remaining boundary with
its own implementation and acceptance contract.
## Decisions
- #51 owns stable static/skinned slots, shared Material/Instance assets, Surface ABI parity for
eligible geometry, transactional migration, and the honest exclusion of deformed Solari meshes.
- #53 owns actual runtime Material Property Block application and promote-to-instance UX. The
existing component schema/persistence exclusion is not represented as runtime completion.
- #54 owns dynamic post-morph/post-skin buffers and instance BLAS updates. It is a documented P2
Solari enhancement, not a raster/Forward production blocker.
## Work
- [x] Audit #51 scope and repository evidence against current runtime behavior.
- [x] Create focused Gitea follow-ups with independent acceptance criteria.
- [x] Correct ADR, material guide, README checklist, evaluation, and production matrix claims.
- [x] Run documentation/diff gates, commit, push, and close #51 with exact follow-up links.
@@ -0,0 +1,43 @@
# Renderer, material, and component foundation
## Goal
Separate static and skinned renderer ownership, restore deterministic skinned edit poses, add shared
material/material-instance slots, and make authoring components registry-driven and composable.
## Component foundation milestone
- Give authoring components immutable IDs distinct from Rust type paths.
- Split persisted active state from inspector ordering with legacy-state migration.
- Route presence, persistence, add/remove/reset/copy/paste, and component history through Bevy
reflection and atomic transactions.
- Treat `ActorKind` as a derived compatibility/display hint; validate component data and explicit
requirements/conflicts.
- Provide one statically linked extension registration helper and reflection round-trip fixture.
- Verify registry integrity, transaction undo/redo, scene save inclusion, composition, and legacy
enable-state preservation.
## Related renderer/material milestone
- Keep `StaticMeshRenderer` and `SkinnedMeshRenderer` as separate authoring and hydration paths.
- Give both renderer types stable imported-source/explicit Material slots and preserve orphaned
assignments by ID across source changes.
- Add versioned Material and direct-base Material Instance assets, sparse editor overrides, shared
handle live refresh, and runtime-only property blocks.
- Capture and restore imported Transform/MorphWeights baselines; sample only the explicitly chosen
default edit clip and never reload a rig for a material-only change.
- Compose one validated Surface evaluator into raster and Solari, including normal/emissive/unlit
fields and exact cutout candidate acceptance. Safely omit skinned/morph geometry from Solari until
instance-owned deformed vertices and dynamic BLAS updates exist.
- Upgrade scenes/materials explicitly to schema v4 with dry-run, staged writes, backup, rollback,
stable slot normalization, and active-state separation.
## Acceptance
- Shared, scene, game, game-hot, editor, Surface, and maintained Solari-fork tests pass.
- `cargo --locked validate-levels` reports zero blocking findings.
- A second project-upgrade dry run reports no changes after apply.
- Editor evidence shows the stable component cards, static/skinned material slots, Material Instance
workflow, deterministic animated actor pose, and Surface/Solari diagnostics.
- Gitea implementation issue and related roadmap issues link the documentation and screenshot
evidence without claiming unsupported dynamic deformed BLAS behavior.
@@ -0,0 +1,58 @@
# Source-Control Status And Collaborative File Safety
Working implementation plan for Gitea issue
[`#49`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/49).
This is the final M7 implementation slice before the production-readiness acceptance gate.
## Status
Implementation, focused source tests, full editor tests, strict editor clippy, and headless checks
are complete. Live debug-editor visual acceptance remains pending for a desktop-capable QA session.
Packaged/release acceptance is explicitly deferred until the project owner requests another
packaged pass.
## Outcome
External edits cannot be silently overwritten by the editor, common Git/read-only/ownership states
are visible without dominating the shell, and projects without Git or an ownership provider behave
normally.
## Implementation Sequence
1. Add exact file revisions, comparison metadata, guarded atomic replacement, and deterministic
pre-rename race coverage.
2. Capture baselines for scene tabs, material/material-instance drafts, and Project Settings;
protect prefab source Apply and exact-file undo/redo with the same guard.
3. Add a non-destructive asynchronous Git scanner and optional ownership-provider registry.
4. Add compact active-scene and selected-asset status plus a recovery modal with reload, compare
metadata, save-as, and cancel.
5. Cover missing/present/read-only/external-change races, porcelain parsing, provider absence, and
document-specific conflict recovery with focused source tests.
6. Run format, strict affected-crate clippy, source tests, headless validation, and live debug-editor
QA. Do not run packaged tests until requested by the project owner.
## Acceptance Gates
- A loaded authored file changed by another process is never replaced by Save, Apply to source, or
prefab source history.
- File creation is also conditional: a file that appears after a save-as baseline is captured is
not overwritten.
- Conflict and read-only UI identifies the path and recovery choices without a force-overwrite
escape hatch.
- Active-scene and selected-asset Git status remain compact and explain themselves on hover.
- Git absence, a non-repository project, and an empty provider registry are quiet normal states.
- Git commands are read-only and never alter index, worktree, commits, branches, or locks.
- Provider state can block an authored write without coupling core editor code to a vendor.
- Source tests simulate a writer changing the target immediately before rename and prove the old or
external content survives.
## Deliberate Boundaries
- Generated registries, imports, thumbnails, navigation bakes, recovery snapshots, and packages are
regenerative/system-owned and do not open authored-file recovery UI.
- V1 compares metadata rather than rendering a text diff; external diff-tool integration is future
work.
- V1 observes ownership/locks. Acquiring, releasing, or stealing locks belongs in a provider-specific
follow-up.
- Git status is project-local and advisory. The content revision guard remains authoritative even
when Git is absent or stale.
@@ -0,0 +1,46 @@
# Terrain Authoring Foundation
Working implementation plan for Gitea
[`#22`](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/22).
This establishes the persistent and hydrated terrain contract required by sculpting `#23`, layer
painting `#24`, physics placement `#25`, and the regression pack `#32`.
## Authored Contract
- Add reflected `TerrainDesc` authoring data with a version, square height-grid resolution, inline
finite heights, horizontal sample spacing, vertical scale, chunk quad size, optional shared
Material/Material Instance reference, collider generation, and shadow flags.
- V1 stores the compact height grid in the scene so save/recovery/history/prefab behavior is exact.
A later external heightmap asset migration must be explicit and versioned rather than silently
changing ownership.
- Validate resolution, exact sample count, finite values, positive scale, and chunk bounds before
hydration or publication.
## Hydration
- Partition the grid into deterministic non-overlapping quad chunks with shared boundary samples.
- Generate triangle-list meshes with normals, UVs, U32 indices, and tangents; each generated child
carries owner/chunk coordinates and remains runtime-only.
- Use the authored shared material when resolvable and an explicit terrain fallback otherwise.
- Optionally attach `ColliderConstructor::TrimeshFromMesh` per chunk.
- Rebuild only the owning terrain's generated chunks when descriptor/material/active state changes;
disabling/removing terrain cleans every generated child.
## Editor Integration
- Register Terrain as a stable authoring component and ActorKind with conflicts against primitive,
brush, static renderer, and skinned renderer geometry sources.
- Add an inspector for resolution, world scale, chunk size, collider/shadow state, material summary,
validation, and a guarded flat-grid resize action. All mutations are one typed history step.
- Include terrain bounds in selection framing and generated chunks in authored-parent picking.
- Expose Add Terrain through the existing component shelf; no new permanent toolbar is added.
## Verification
- Tests cover descriptor validation, deterministic chunk coverage/mesh topology, hydration and
cleanup, generated-child stripping, serialization, and history round-trip.
- Source-only workspace format/check/strict-Clippy/tests and level validation run. Packaged tests
remain deferred by project-owner direction.
- Live native-Wayland acceptance creates or loads a terrain actor, verifies chunk rendering and
selection/inspection, changes scale/chunking, exercises undo/redo, and inspects a saved scene to
confirm generated chunks are absent.
@@ -0,0 +1,28 @@
# Terrain Material Layers And Weight Painting (#24)
## Scope
- Persist up to four shared Material/Material Instance references on each `TerrainDesc`.
- Store normalized RGBA8 layer weights per height sample with an implicit channel-zero default.
- Blend layer albedo, normal, metallic, and roughness in the project-owned raster material path.
- Assign, clear, reorder, and tile layers from the Terrain inspector.
- Paint or erase one selected layer from the existing horizontal viewport toolbar.
- Preserve one reflected history transaction per completed pointer stroke and exact cancel restore.
## Implementation
1. Extend the backward-compatible terrain schema with four layer descriptors and compact weights.
2. Emit normalized weights as terrain chunk vertex colors and attach a runtime-only material binding.
3. Build a terrain-specific `ExtendedMaterial` in `blacksite_surface`; keep invalid references on the visible fallback path with diagnostics.
4. Add inspector layer controls and a mutually exclusive modal paint operator beside Sculpt.
5. Cover serialization, validation, blend transport, paint normalization, cancel, undo, and redo.
6. Update ADR 0040, terrain workflow docs, the implementation checklist, and live evidence.
## Acceptance
- Two or more project materials visibly blend on one terrain.
- Layer weights remain exactly normalized and survive scene save/load.
- Live paint preview follows the sampled terrain surface.
- Escape/right-click restores exact pre-stroke weights; release creates one undo entry.
- Missing or invalid material references remain visible as fallback and produce clear diagnostics.
- Formatting, workspace check/clippy/tests, level validation, and live native-Wayland QA pass.
@@ -0,0 +1,25 @@
# Terrain Sculpt Tools (#23)
## Scope
- Add a modal terrain sculpt operator for raise, lower, flatten, smooth, and deterministic noise.
- Keep activation and brush settings in the existing horizontal viewport toolbar.
- Track a terrain-local cursor hit and render a world-space brush footprint preview.
- Apply live stroke previews while preserving one history entry per completed stroke.
- Restore the exact pre-stroke height grid on Escape or right-click.
## Implementation
1. Add pure heightfield sampling, ray-hit, falloff, and brush-dab functions with focused tests.
2. Add editor-only terrain sculpt state and viewport input/preview systems.
3. Commit strokes through the reflected component transaction after restoring the pre-stroke snapshot.
4. Add compact terrain controls to the existing viewport toolbar and update operator hints.
5. Document controls and validation evidence in the terrain editor guide and root checklist.
## Acceptance
- All five modes visibly modify terrain.
- The brush ring follows the actual terrain surface.
- Escape and right-click cancel without dirtying history.
- Mouse release creates exactly one undoable transaction regardless of dab count.
- Formatting, editor/shared checks, focused tests, and live editor QA pass.
+16
View File
@@ -0,0 +1,16 @@
## Summary
-
## Validation
-
## Documentation
- [ ] I updated the root README for user controls, run commands, or troubleshooting changes.
- [ ] I updated `docs/editor/` for editor workflow or feature-design changes.
- [ ] I added or updated an ADR for architecture, policy, scene format, rendering path, PIE semantics, settings schema, or netcode decisions.
- [ ] I indexed new documentation in `docs/README.md`.
- [ ] If this is Jackdaw-inspired work, I identified it as design-inspired, API-inspired, or code-derived.
- [ ] If this includes copied or closely translated source, I included source URL, upstream commit/release, license compatibility notes, and required file-level notices.
+9 -21
View File
@@ -41,34 +41,22 @@ jobs:
run: rustup show run: rustup show
- name: Check formatting - name: Check formatting
run: cargo fmt --check run: cargo fmt --all --check
- name: Check workspace - name: Check workspace
run: cargo check --workspace run: cargo check --workspace --all-targets
- name: Clippy - name: Clippy workspace
run: cargo clippy --workspace run: cargo clippy --workspace --all-targets -- -D warnings
- name: Clippy foundation crates - name: Test workspace
run: cargo clippy -p game -p shared -- -D warnings run: cargo test --workspace
- name: Test foundation helpers
run: cargo test -p game --lib
- name: Test shared hydration and actor validation
run: cargo test -p shared
- name: Test sim crate
run: cargo test -p sim
- name: Validate level scenes - name: Validate level scenes
run: cargo run -p xtask --bin validate-levels run: cargo validate-levels
- name: Test scene schema crate - name: Clippy launch feature matrix
run: cargo test -p scene run: cargo clippy -p editor -p game --bins --features dev,hot-reload -- -D warnings
- name: Check editor (dev)
run: cargo check -p editor --features dev
- name: Build binaries - name: Build binaries
run: | run: |
+2
View File
@@ -1,5 +1,6 @@
# Rust build output # Rust build output
/target/ /target/
/dist/
# Local automation and assistant state # Local automation and assistant state
/.agents/ /.agents/
@@ -13,6 +14,7 @@
# Editor/runtime generated session state # Editor/runtime generated session state
/assets/levels/.pie_session.scn.ron /assets/levels/.pie_session.scn.ron
/assets/.trash/ /assets/.trash/
/.blacksite/backups/
# Backup, temporary, and log files # Backup, temporary, and log files
**/*.rs.bk **/*.rs.bk
+238 -35
View File
@@ -4,48 +4,251 @@
{ {
"type": "lldb", "type": "lldb",
"request": "launch", "request": "launch",
"name": "Debug editor", "name": "Editor: Debug",
"preLaunchTask": "build editor (dev fast-link)",
"program": "${workspaceFolder}/target/debug/editor",
"args": [],
"env": {
"BEVY_FPS_HDR": "0",
"WGPU_VALIDATION": "0",
"CARGO_TARGET_DIR": "${workspaceFolder}/target",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:LD_LIBRARY_PATH}"
},
"cwd": "${workspaceFolder}"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug game",
"preLaunchTask": "build game (dev fast-link)",
"program": "${workspaceFolder}/target/debug/game",
"args": [],
"env": {
"BEVY_FPS_HDR": "0",
"WGPU_VALIDATION": "0",
"CARGO_TARGET_DIR": "${workspaceFolder}/target",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:LD_LIBRARY_PATH}"
},
"cwd": "${workspaceFolder}"
},
{
"type": "lldb",
"request": "launch",
"name": "Run editor (release)",
"cargo": { "cargo": {
"args": ["build", "--release", "-p", "editor"], "args": ["build", "-p", "editor", "--bin", "editor", "--features", "dev"],
"filter": { "name": "editor", "kind": "bin" } "filter": { "name": "editor", "kind": "bin" },
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" },
"problemMatcher": "$rustc"
}, },
"args": [], "args": [],
"env": { "env": {
"RUST_BACKTRACE": "1",
"WGPU_VALIDATION": "0",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:LD_LIBRARY_PATH}"
},
"cwd": "${workspaceFolder}",
"terminal": "integrated",
"sourceLanguages": ["rust"],
"gracefulShutdown": "SIGINT"
},
{
"type": "lldb",
"request": "launch",
"name": "Editor: GPU validation",
"cargo": {
"args": ["build", "-p", "editor", "--bin", "editor", "--features", "dev"],
"filter": { "name": "editor", "kind": "bin" },
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" },
"problemMatcher": "$rustc"
},
"args": [],
"env": {
"RUST_BACKTRACE": "1",
"WGPU_VALIDATION": "1",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:LD_LIBRARY_PATH}"
},
"cwd": "${workspaceFolder}",
"terminal": "integrated",
"sourceLanguages": ["rust"],
"gracefulShutdown": "SIGINT"
},
{
"type": "lldb",
"request": "launch",
"name": "Editor: Hot reload",
"cargo": {
"args": [
"build",
"-p",
"editor",
"--bin",
"editor",
"--features",
"dev,hot-reload"
],
"filter": { "name": "editor", "kind": "bin" },
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" },
"problemMatcher": "$rustc"
},
"args": [],
"env": {
"RUST_BACKTRACE": "1",
"WGPU_VALIDATION": "0",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:LD_LIBRARY_PATH}"
},
"cwd": "${workspaceFolder}",
"terminal": "integrated",
"sourceLanguages": ["rust"],
"gracefulShutdown": "SIGINT"
},
{
"type": "lldb",
"request": "launch",
"name": "Editor: SDR fallback",
"cargo": {
"args": ["build", "-p", "editor", "--bin", "editor", "--features", "dev"],
"filter": { "name": "editor", "kind": "bin" },
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" },
"problemMatcher": "$rustc"
},
"args": [],
"env": {
"RUST_BACKTRACE": "1",
"BEVY_FPS_HDR": "0", "BEVY_FPS_HDR": "0",
"WGPU_VALIDATION": "0", "WGPU_VALIDATION": "0",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/release/deps:${env:LD_LIBRARY_PATH}" "LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:LD_LIBRARY_PATH}"
}, },
"cwd": "${workspaceFolder}" "cwd": "${workspaceFolder}",
"terminal": "integrated",
"sourceLanguages": ["rust"],
"gracefulShutdown": "SIGINT"
},
{
"type": "lldb",
"request": "launch",
"name": "Editor: Release",
"cargo": {
"args": ["build", "--release", "-p", "editor", "--bin", "editor"],
"filter": { "name": "editor", "kind": "bin" },
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" },
"problemMatcher": "$rustc"
},
"args": [],
"env": { "RUST_BACKTRACE": "1", "WGPU_VALIDATION": "0" },
"cwd": "${workspaceFolder}",
"terminal": "integrated",
"sourceLanguages": ["rust"],
"gracefulShutdown": "SIGINT"
},
{
"type": "lldb",
"request": "launch",
"name": "Editor: Project root...",
"cargo": {
"args": ["build", "-p", "editor", "--bin", "editor", "--features", "dev"],
"filter": { "name": "editor", "kind": "bin" },
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" },
"problemMatcher": "$rustc"
},
"args": ["--project", "${input:blacksiteProjectRoot}"],
"env": {
"RUST_BACKTRACE": "1",
"WGPU_VALIDATION": "0",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:LD_LIBRARY_PATH}"
},
"cwd": "${workspaceFolder}",
"terminal": "integrated",
"sourceLanguages": ["rust"],
"gracefulShutdown": "SIGINT"
},
{
"type": "lldb",
"request": "launch",
"name": "Game: Debug",
"cargo": {
"args": ["build", "-p", "game", "--bin", "game", "--features", "dev"],
"filter": { "name": "game", "kind": "bin" },
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" },
"problemMatcher": "$rustc"
},
"args": [],
"env": {
"RUST_BACKTRACE": "1",
"WGPU_VALIDATION": "0",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:LD_LIBRARY_PATH}"
},
"cwd": "${workspaceFolder}",
"terminal": "integrated",
"sourceLanguages": ["rust"],
"gracefulShutdown": "SIGINT"
},
{
"type": "lldb",
"request": "launch",
"name": "Game: GPU validation",
"cargo": {
"args": ["build", "-p", "game", "--bin", "game", "--features", "dev"],
"filter": { "name": "game", "kind": "bin" },
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" },
"problemMatcher": "$rustc"
},
"args": [],
"env": {
"RUST_BACKTRACE": "1",
"WGPU_VALIDATION": "1",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:LD_LIBRARY_PATH}"
},
"cwd": "${workspaceFolder}",
"terminal": "integrated",
"sourceLanguages": ["rust"],
"gracefulShutdown": "SIGINT"
},
{
"type": "lldb",
"request": "launch",
"name": "Game: Hot reload",
"cargo": {
"args": [
"build",
"-p",
"game",
"--bin",
"game",
"--features",
"dev,hot-reload"
],
"filter": { "name": "game", "kind": "bin" },
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" },
"problemMatcher": "$rustc"
},
"args": [],
"env": {
"RUST_BACKTRACE": "1",
"WGPU_VALIDATION": "0",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:LD_LIBRARY_PATH}"
},
"cwd": "${workspaceFolder}",
"terminal": "integrated",
"sourceLanguages": ["rust"],
"gracefulShutdown": "SIGINT"
},
{
"type": "lldb",
"request": "launch",
"name": "Game: SDR fallback",
"cargo": {
"args": ["build", "-p", "game", "--bin", "game", "--features", "dev"],
"filter": { "name": "game", "kind": "bin" },
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" },
"problemMatcher": "$rustc"
},
"args": [],
"env": {
"RUST_BACKTRACE": "1",
"BEVY_FPS_HDR": "0",
"WGPU_VALIDATION": "0",
"LD_LIBRARY_PATH": "${workspaceFolder}/target/debug/deps:${env:LD_LIBRARY_PATH}"
},
"cwd": "${workspaceFolder}",
"terminal": "integrated",
"sourceLanguages": ["rust"],
"gracefulShutdown": "SIGINT"
},
{
"type": "lldb",
"request": "launch",
"name": "Game: Release",
"cargo": {
"args": ["build", "--release", "-p", "game", "--bin", "game"],
"filter": { "name": "game", "kind": "bin" },
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" },
"problemMatcher": "$rustc"
},
"args": [],
"env": { "RUST_BACKTRACE": "1", "WGPU_VALIDATION": "0" },
"cwd": "${workspaceFolder}",
"terminal": "integrated",
"sourceLanguages": ["rust"],
"gracefulShutdown": "SIGINT"
}
],
"inputs": [
{
"id": "blacksiteProjectRoot",
"type": "promptString",
"description": "Absolute path to a Blacksite project root",
"default": "${workspaceFolder}"
} }
] ]
} }
+159 -55
View File
@@ -2,42 +2,61 @@
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "cargo fmt (check)", "label": "cargo fmt (workspace check)",
"type": "cargo", "type": "cargo",
"command": "fmt", "command": "fmt",
"args": ["--check"], "args": ["--all", "--check"],
"problemMatcher": [], "problemMatcher": [],
"group": "build" "group": "build"
}, },
{ {
"label": "cargo check (workspace)", "label": "cargo check (workspace all targets)",
"type": "cargo", "type": "cargo",
"command": "check", "command": "check",
"args": ["--workspace"], "args": ["--workspace", "--all-targets"],
"problemMatcher": ["$rustc"], "problemMatcher": ["$rustc"],
"group": "build" "group": "build"
}, },
{ {
"label": "cargo clippy (workspace)", "label": "cargo clippy (workspace strict)",
"type": "cargo", "type": "cargo",
"command": "clippy", "command": "clippy",
"args": ["--workspace"], "args": ["--workspace", "--all-targets", "--", "-D", "warnings"],
"problemMatcher": ["$rustc"], "problemMatcher": ["$rustc"],
"group": "build" "group": "build"
}, },
{ {
"label": "cargo clippy (foundation strict)", "label": "cargo test (workspace)",
"type": "cargo",
"command": "clippy",
"args": ["-p", "game", "-p", "shared", "--", "-D", "warnings"],
"problemMatcher": ["$rustc"],
"group": "build"
},
{
"label": "cargo test (foundation)",
"type": "cargo", "type": "cargo",
"command": "test", "command": "test",
"args": ["-p", "game", "--lib"], "args": ["--workspace"],
"problemMatcher": ["$rustc"],
"group": "test"
},
{
"label": "cargo clippy (launch feature matrix)",
"type": "cargo",
"command": "clippy",
"args": [
"-p",
"editor",
"-p",
"game",
"--bins",
"--features",
"dev,hot-reload",
"--",
"-D",
"warnings"
],
"problemMatcher": ["$rustc"],
"group": "build"
},
{
"label": "validate level scenes",
"type": "cargo",
"command": "validate-levels",
"args": [],
"problemMatcher": ["$rustc"], "problemMatcher": ["$rustc"],
"group": "test" "group": "test"
}, },
@@ -45,7 +64,7 @@
"label": "build game (debug)", "label": "build game (debug)",
"type": "cargo", "type": "cargo",
"command": "build", "command": "build",
"args": ["-p", "game"], "args": ["-p", "game", "--bin", "game"],
"problemMatcher": ["$rustc"], "problemMatcher": ["$rustc"],
"group": "build" "group": "build"
}, },
@@ -53,47 +72,50 @@
"label": "build editor (debug)", "label": "build editor (debug)",
"type": "cargo", "type": "cargo",
"command": "build", "command": "build",
"args": ["-p", "editor"], "args": ["-p", "editor", "--bin", "editor"],
"problemMatcher": ["$rustc"], "problemMatcher": ["$rustc"],
"group": { "kind": "build", "isDefault": true } "group": "build"
}, },
{ {
"label": "build editor (dev fast-link)", "label": "build editor (dev fast-link)",
"type": "cargo", "type": "cargo",
"command": "build", "command": "build",
"args": ["-p", "editor", "--features", "dev"], "args": ["-p", "editor", "--bin", "editor", "--features", "dev"],
"options": { "options": {
"env": { "cwd": "${workspaceFolder}",
"CARGO_TARGET_DIR": "${workspaceFolder}/target" "env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" }
}
}, },
"problemMatcher": ["$rustc"], "problemMatcher": ["$rustc"],
"group": "build" "group": { "kind": "build", "isDefault": true }
}, },
{ {
"label": "build game (dev fast-link)", "label": "build game (dev fast-link)",
"type": "cargo", "type": "cargo",
"command": "build", "command": "build",
"args": ["-p", "game", "--features", "dev"], "args": ["-p", "game", "--bin", "game", "--features", "dev"],
"options": { "options": {
"env": { "cwd": "${workspaceFolder}",
"CARGO_TARGET_DIR": "${workspaceFolder}/target" "env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" }
}
}, },
"problemMatcher": ["$rustc"], "problemMatcher": ["$rustc"],
"group": "build" "group": "build"
}, },
{ {
"label": "clean build editor (dev)", "label": "clean dev-link crates",
"type": "shell", "type": "cargo",
"command": "cargo clean -p editor && cargo build -p editor --features dev", "command": "clean",
"args": ["-p", "editor", "-p", "game", "-p", "game_hot", "-p", "shared"],
"options": { "options": {
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"env": { "env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" }
"CARGO_TARGET_DIR": "${workspaceFolder}/target"
}
}, },
"problemMatcher": ["$rustc"], "problemMatcher": []
},
{
"label": "clean build editor (dev)",
"dependsOrder": "sequence",
"dependsOn": ["clean dev-link crates", "build editor (dev fast-link)"],
"problemMatcher": [],
"group": "build" "group": "build"
}, },
{ {
@@ -102,9 +124,7 @@
"command": "cargo clean-target", "command": "cargo clean-target",
"options": { "options": {
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"env": { "env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" }
"CARGO_TARGET_DIR": "${workspaceFolder}/target"
}
}, },
"problemMatcher": [], "problemMatcher": [],
"group": "build" "group": "build"
@@ -115,9 +135,18 @@
"command": "cargo clean-target --apply", "command": "cargo clean-target --apply",
"options": { "options": {
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"env": { "env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" }
"CARGO_TARGET_DIR": "${workspaceFolder}/target" },
} "problemMatcher": [],
"group": "build"
},
{
"label": "target cleanup (deep stale, 3 days)",
"type": "shell",
"command": "cargo clean-target --include-artifacts --days 3 --apply",
"options": {
"cwd": "${workspaceFolder}",
"env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" }
}, },
"problemMatcher": [], "problemMatcher": [],
"group": "build" "group": "build"
@@ -126,10 +155,11 @@
"label": "run editor (dev fast-link)", "label": "run editor (dev fast-link)",
"type": "cargo", "type": "cargo",
"command": "run", "command": "run",
"args": ["-p", "editor", "--features", "dev"], "args": ["-p", "editor", "--bin", "editor", "--features", "dev"],
"options": { "options": {
"cwd": "${workspaceFolder}",
"env": { "env": {
"BEVY_FPS_HDR": "0", "RUST_BACKTRACE": "1",
"WGPU_VALIDATION": "0", "WGPU_VALIDATION": "0",
"CARGO_TARGET_DIR": "${workspaceFolder}/target" "CARGO_TARGET_DIR": "${workspaceFolder}/target"
} }
@@ -141,9 +171,83 @@
"label": "run game (dev fast-link)", "label": "run game (dev fast-link)",
"type": "cargo", "type": "cargo",
"command": "run", "command": "run",
"args": ["-p", "game", "--features", "dev"], "args": ["-p", "game", "--bin", "game", "--features", "dev"],
"options": { "options": {
"cwd": "${workspaceFolder}",
"env": { "env": {
"RUST_BACKTRACE": "1",
"WGPU_VALIDATION": "0",
"CARGO_TARGET_DIR": "${workspaceFolder}/target"
}
},
"problemMatcher": ["$rustc"],
"group": "build"
},
{
"label": "run editor (hot reload)",
"type": "cargo",
"command": "run",
"args": [
"-p",
"editor",
"--bin",
"editor",
"--features",
"dev,hot-reload"
],
"options": {
"cwd": "${workspaceFolder}",
"env": {
"RUST_BACKTRACE": "1",
"WGPU_VALIDATION": "0",
"CARGO_TARGET_DIR": "${workspaceFolder}/target"
}
},
"problemMatcher": ["$rustc"],
"group": "build"
},
{
"label": "run game (hot reload)",
"type": "cargo",
"command": "run",
"args": ["-p", "game", "--bin", "game", "--features", "dev,hot-reload"],
"options": {
"cwd": "${workspaceFolder}",
"env": {
"RUST_BACKTRACE": "1",
"WGPU_VALIDATION": "0",
"CARGO_TARGET_DIR": "${workspaceFolder}/target"
}
},
"problemMatcher": ["$rustc"],
"group": "build"
},
{
"label": "run editor (SDR fallback)",
"type": "cargo",
"command": "run",
"args": ["-p", "editor", "--bin", "editor", "--features", "dev"],
"options": {
"cwd": "${workspaceFolder}",
"env": {
"RUST_BACKTRACE": "1",
"BEVY_FPS_HDR": "0",
"WGPU_VALIDATION": "0",
"CARGO_TARGET_DIR": "${workspaceFolder}/target"
}
},
"problemMatcher": ["$rustc"],
"group": "build"
},
{
"label": "run game (SDR fallback)",
"type": "cargo",
"command": "run",
"args": ["-p", "game", "--bin", "game", "--features", "dev"],
"options": {
"cwd": "${workspaceFolder}",
"env": {
"RUST_BACKTRACE": "1",
"BEVY_FPS_HDR": "0", "BEVY_FPS_HDR": "0",
"WGPU_VALIDATION": "0", "WGPU_VALIDATION": "0",
"CARGO_TARGET_DIR": "${workspaceFolder}/target" "CARGO_TARGET_DIR": "${workspaceFolder}/target"
@@ -158,28 +262,28 @@
"command": "cargo watch -w crates/game_hot -w crates/sim -x \"build -p game_hot --features dylib\"", "command": "cargo watch -w crates/game_hot -w crates/sim -x \"build -p game_hot --features dylib\"",
"options": { "options": {
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"env": { "env": { "CARGO_TARGET_DIR": "${workspaceFolder}/target" }
"CARGO_TARGET_DIR": "${workspaceFolder}/target"
}
}, },
"problemMatcher": ["$rustc"], "problemMatcher": ["$rustc"],
"group": "build", "group": "build",
"isBackground": true "isBackground": true,
"detail": "Requires cargo-watch: cargo install cargo-watch --locked"
}, },
{ {
"label": "verify foundation", "label": "verify workspace",
"dependsOrder": "sequence", "dependsOrder": "sequence",
"dependsOn": [ "dependsOn": [
"cargo fmt (check)", "cargo fmt (workspace check)",
"cargo check (workspace)", "cargo check (workspace all targets)",
"cargo clippy (workspace)", "cargo clippy (workspace strict)",
"cargo clippy (foundation strict)", "cargo test (workspace)",
"cargo test (foundation)", "cargo clippy (launch feature matrix)",
"validate level scenes",
"build game (debug)", "build game (debug)",
"build editor (debug)" "build editor (debug)"
], ],
"problemMatcher": [], "problemMatcher": [],
"group": { "kind": "build", "isDefault": true } "group": "build"
} }
] ]
} }
Generated
+1674 -1314
View File
File diff suppressed because it is too large. Load diff
+53 -11
View File
@@ -1,5 +1,6 @@
[workspace] [workspace]
members = [ members = [
"crates/blacksite_surface",
"crates/game", "crates/game",
"crates/game_hot", "crates/game_hot",
"crates/shared", "crates/shared",
@@ -18,7 +19,7 @@ edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
[workspace.dependencies] [workspace.dependencies]
avian3d = { version = "0.6", default-features = false, features = [ avian3d = { version = "0.7", default-features = false, features = [
"3d", "3d",
"f32", "f32",
"parry-f32", "parry-f32",
@@ -26,16 +27,27 @@ avian3d = { version = "0.6", default-features = false, features = [
"collider-from-mesh", "collider-from-mesh",
"serialize", "serialize",
] } ] }
bevy = { version = "0.18", features = ["serialize"] } bevy = { version = "0.19", features = [
bevy_core_pipeline = "0.18" "serialize",
bevy_solari = "0.18" "jpeg",
bevy_ufbx = "0.18" "vorbis",
bevy_egui = "0.39" "wav",
bevy-inspector-egui = "0.36" "mp3",
egui_dock = { version = "0.18", features = ["serde"] } "flac",
egui_phosphor_icons = "0.2" ] }
bevy_core_pipeline = "0.19"
bevy_solari = "0.19"
blacksite_surface = { path = "crates/blacksite_surface" }
bevy_ufbx = "0.18.1-rc.1"
bevy_egui = "0.40"
bevy-inspector-egui = "0.37"
egui_dock = { version = "0.19.1", features = ["serde"] }
egui_phosphor_icons = { version = "0.3.1", default-features = false }
transform-gizmo-bevy = "0.9" transform-gizmo-bevy = "0.9"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
nav_glam = { package = "glam", version = "=0.30.10", features = ["serde"] }
polyanya = { version = "=0.16.1", default-features = false, features = ["recast", "serde"] }
rerecast = { version = "=0.3.2", default-features = false, features = ["std", "serialize"] }
shared = { path = "crates/shared" } shared = { path = "crates/shared" }
game = { path = "crates/game" } game = { path = "crates/game" }
game_hot = { path = "crates/game_hot" } game_hot = { path = "crates/game_hot" }
@@ -45,8 +57,12 @@ settings = { path = "crates/settings" }
scene = { path = "crates/scene" } scene = { path = "crates/scene" }
[patch.crates-io] [patch.crates-io]
# Linux surface acquire timeouts can be transient on Wayland/Xwayland drivers. # Blacksite Surface ABI and deformation-safety integration for Solari.
bevy_render = { path = "third_party/bevy_render" } bevy_solari = { path = "third_party/bevy_solari" }
# Local Bevy 0.19 compatibility patch until upstream publishes a matching FBX loader.
bevy_ufbx = { path = "third_party/bevy_ufbx" }
# Lossless RON editing fixes used by transactional prefab source edits.
ron-edit = { path = "third_party/ron-edit" }
# Atmosphere-aware mesh view bind groups (WYSIWYG editor + transform gizmos). # Atmosphere-aware mesh view bind groups (WYSIWYG editor + transform gizmos).
transform-gizmo-bevy = { path = "third_party/transform-gizmo-bevy" } transform-gizmo-bevy = { path = "third_party/transform-gizmo-bevy" }
@@ -59,7 +75,33 @@ rpath = true
[profile.dev.package."*"] [profile.dev.package."*"]
opt-level = 3 opt-level = 3
# Tests keep source line information without retaining full multi-gigabyte Bevy
# debug images or incremental caches. The dev profile remains fully debuggable.
[profile.test]
opt-level = 1
debug = "line-tables-only"
incremental = false
[profile.test.package."*"]
opt-level = 3
# A snappy release profile for shipping builds. # A snappy release profile for shipping builds.
[profile.release] [profile.release]
lto = "thin" lto = "thin"
codegen-units = 1 codegen-units = 1
strip = "symbols"
# Export profiles keep runtime optimization and compact binaries without forcing
# release LTO into normal editor iteration.
[profile.package-dev]
inherits = "release"
lto = false
codegen-units = 16
strip = "symbols"
[profile.package-qa]
inherits = "release"
lto = false
codegen-units = 8
debug = "line-tables-only"
strip = "none"
+228 -46
View File
@@ -1,7 +1,7 @@
# Bevy FPS Foundation # Bevy FPS Foundation
A modular first-person game foundation and in-process editor built on **Bevy 0.18** and A modular first-person game foundation and in-process editor built on **Bevy 0.19** and
**Avian 0.6** physics. **Avian 0.7** physics.
The runtime game provides a high-fidelity PBR stack (HDR, procedural atmosphere + image-based The runtime game provides a high-fidelity PBR stack (HDR, procedural atmosphere + image-based
lighting, cascaded shadows, SSAO, TAA, bloom, fog, ACES tonemapping) plus Hybrid Auto Solari lighting, cascaded shadows, SSAO, TAA, bloom, fog, ACES tonemapping) plus Hybrid Auto Solari
@@ -21,12 +21,18 @@ native Bevy scene save/load, and BRP support for external tooling.
```bash ```bash
# Check everything # Check everything
cargo fmt --check cargo fmt --all --check
cargo check --workspace cargo check --workspace --all-targets
cargo clippy --workspace cargo clippy --workspace --all-targets -- -D warnings
cargo clippy -p game -p shared -p protocol -p sim -- -D warnings cargo clippy -p editor -p game --bins --features dev,hot-reload -- -D warnings
cargo test -p game --lib cargo test --workspace
cargo test -p sim cargo validate-levels
cargo bake-navigation --project . --check
# Validate one artifact without opening a game window
cargo run -p game -- --validate-navigation assets/navigation/generated/navigation_showcase_humanoid.nav.ron
# Machine-readable project dependency and finding report
cargo validate-levels --json
cargo package-project --profile development
# Runtime game # Runtime game
cargo run -p game cargo run -p game
@@ -37,6 +43,22 @@ cargo run -p editor
cargo run -p editor --features dev cargo run -p editor --features dev
``` ```
The standalone `game` binary loads `default_level` from `assets/project.ron` as the initial authored
scene. That entrypoint must be a regular `.scn.ron` file under `assets/levels/` so validation audits
its complete runtime dependency graph. The in-process editor defers that bootstrap to its scene tabs
and `SceneIo`, so opening the editor never creates a competing runtime scene root.
Open a different validated Blacksite project before engine startup:
```bash
cargo run -p editor --features dev -- --project /path/to/project
cargo run -p editor --bin project_launcher --features dev
```
The installed **Blacksite Editor** desktop entry also exposes **Open Project Browser** from its
desktop action menu. In the editor, **File > Switch Project...** performs a clean shutdown and
opens the same browser; choosing a project starts a fresh editor process with that root.
### Hot reload (gameplay iteration) ### Hot reload (gameplay iteration)
`--features dev` turns on Bevy **dynamic linking** for faster rebuilds (recommended day-to-day). `--features dev` turns on Bevy **dynamic linking** for faster rebuilds (recommended day-to-day).
@@ -53,7 +75,7 @@ cargo watch -w crates/game_hot -w crates/sim -x "build -p game_hot --features dy
cargo run -p editor --features dev,hot-reload cargo run -p editor --features dev,hot-reload
``` ```
Or use the VS Code task **watch game_hot (hot reload)** alongside **run editor (dev fast-link)** (enable the `hot-reload` feature on the editor run task when using dylib iteration). Or use the VS Code task **watch game_hot (hot reload)** alongside **run editor (hot reload)**, or choose **Editor: Hot reload** in Run and Debug. The watcher task requires `cargo-watch` (`cargo install cargo-watch --locked`).
| Input | Action | | Input | Action |
|-------|--------| |-------|--------|
@@ -76,15 +98,22 @@ Cargo/Bevy debug artifacts can grow quickly. Use the workspace cleanup task befo
| `cargo clean-target --apply` | Safe cleanup: removes incremental and rust-analyzer flycheck cache. | | `cargo clean-target --apply` | Safe cleanup: removes incremental and rust-analyzer flycheck cache. |
| `cargo clean-target --include-artifacts --days 3 --apply` | Deeper cleanup: also removes stale hashed `deps`, `build`, `.fingerprint`, and example artifacts older than 3 days. Cargo will rebuild anything still needed. | | `cargo clean-target --include-artifacts --days 3 --apply` | Deeper cleanup: also removes stale hashed `deps`, `build`, `.fingerprint`, and example artifacts older than 3 days. Cargo will rebuild anything still needed. |
VS Code tasks: **target cleanup (dry run)** and **target cleanup (safe apply)**. Use the safe cleanup during normal iteration and the three-day deep cleanup after Bevy upgrades,
feature-matrix builds, or large test runs. The cutoff preserves recent artifacts and avoids the full
rebuild caused by `cargo clean`. The workspace test profile keeps line tables but disables full test
debuginfo and incremental test caches, so routine test binaries stay materially smaller without
reducing normal editor debugging fidelity. The cleanup binary deliberately excludes the scene/Bevy
validation dependency; `cargo clean-target` therefore stays cheap even from a cold target. Use
`cargo validate-levels` when level and prefab-graph validation is required. VS Code tasks expose dry-run, safe, and
deep-stale variants.
### Launch Troubleshooting ### Launch Troubleshooting
- The native game/editor windows force an opaque Wayland surface and opaque camera clears to avoid compositor alpha issues on mixed HDR/SDR desktops. - The native game/editor windows force an opaque Wayland surface and opaque camera clears to avoid compositor alpha issues on mixed HDR/SDR desktops.
- If the window maps but appears transparent on Hyprland or another Wayland compositor, launch with `BEVY_FPS_HDR=0` to force the SDR camera path while debugging monitor/compositor behavior. - If the window maps but appears transparent on Hyprland or another Wayland compositor, launch with `BEVY_FPS_HDR=0` to force the SDR camera path while debugging monitor/compositor behavior.
- The workspace patches `bevy_render` locally so transient Linux swapchain acquire timeouts skip one frame instead of panicking in `prepare_windows`. - Bevy 0.19 removed the prior local `bevy_render` swapchain-timeout patch; launch troubleshooting should start from current wgpu/driver/compositor logs.
- Debug launch configs and run tasks set `WGPU_VALIDATION=0` to quiet the known wgpu/Vulkan validation-layer warning `VUID-StandaloneSpirv-MemorySemantics-10871`. This only disables the Vulkan validation layer for those launches; Rust panics and application errors still surface normally. - Normal Debug and run configurations preserve project HDR and set `WGPU_VALIDATION=0` to suppress known Bevy/Solari Vulkan memory-model VUID noise on this stack. Use **GPU validation** when actively debugging renderer work; it forces `WGPU_VALIDATION=1` and may report those known upstream/driver messages. Use **SDR fallback** for compositor/HDR mapping failures; it additionally sets `BEVY_FPS_HDR=0`.
- If **CodeLLDB / mold** fails with hundreds of `undefined symbol` linker errors, the incremental `target/` cache is stale. Run the VS Code task **clean build editor (dev)** or `cargo clean -p editor && cargo build -p editor --features dev`, then launch **Debug editor** again. Use `cargo run -p editor --features dev` from the terminal if you need `libbevy_dylib` on `LD_LIBRARY_PATH` automatically. - If **CodeLLDB / mold** fails with hundreds of `undefined symbol` linker errors, the incremental `target/` cache is stale. Run the VS Code task **clean build editor (dev)** or `cargo clean -p editor -p game -p game_hot -p shared && cargo build -p editor --bin editor --features dev`, then launch **Editor: Debug** again. Use `cargo run -p editor --features dev` from the terminal if you need `libbevy_dylib` on `LD_LIBRARY_PATH` automatically.
## Editor Controls ## Editor Controls
@@ -97,7 +126,7 @@ VS Code tasks: **target cleanup (dry run)** and **target cleanup (safe apply)**.
| `Ctrl+G` | Toggle viewport grid | | `Ctrl+G` | Toggle viewport grid |
| `F` | Focus editor camera on selection | | `F` | Focus editor camera on selection |
| `Ctrl+Shift+1` / `Ctrl+Shift+2` | Save / recall viewport camera bookmark | | `Ctrl+Shift+1` / `Ctrl+Shift+2` | Save / recall viewport camera bookmark |
| RMB + mouse | Editor camera look | | RMB + mouse | Editor camera look; cursor hides while held |
| RMB + `W` `A` `S` `D` | Editor camera fly | | RMB + `W` `A` `S` `D` | Editor camera fly |
| RMB + `Q` / `E` | Editor camera down / up | | RMB + `Q` / `E` | Editor camera down / up |
| Mouse wheel | Dolly editor camera | | Mouse wheel | Dolly editor camera |
@@ -108,23 +137,48 @@ VS Code tasks: **target cleanup (dry run)** and **target cleanup (safe apply)**.
| `Ctrl+D` | Duplicate selection | | `Ctrl+D` | Duplicate selection |
| `Ctrl+Z` / `Ctrl+Shift+Z` / `Ctrl+Y` | Undo / redo | | `Ctrl+Z` / `Ctrl+Shift+Z` / `Ctrl+Y` | Undo / redo |
| `F2` in Hierarchy | Rename selection | | `F2` in Hierarchy | Rename selection |
| `W` / `E` / `R` | Translate / rotate / scale gizmo | | `W` / `E` / `R` | Translate / rotate / scale gizmo; multi-selection uses one grouped gizmo and undo step |
| `X` | Toggle world/local gizmo orientation | | `X` | Toggle world/local gizmo orientation |
| `B` | Enter Draw Brush mode |
| Draw Brush: LMB / `Enter` / mouse up-down / `Esc` / `Backspace` | Place floor points / enter height phase or create / set height / cancel / remove point or return to outline |
| Brush selected: `1` / `2` / `3` / `4` | Vertex / edge / face / clip edit modes |
| Brush edit mode: LMB / `Shift+LMB` / `W` / `E` / `R` / `Esc` | Select element / toggle element selection / move / rotate / scale selected brush elements / return to object mode |
| Viewport toolbar (sun / brush / box icons) | Shading: Lit, Unlit (albedo), Colliders (mesh off) | | Viewport toolbar (sun / brush / box icons) | Shading: Lit, Unlit (albedo), Colliders (mesh off) |
| Viewport eye/options | Toggle actor root icon categories, adjust icon/gizmo size, and control colliders, lights, spawns, prefab/model anchors, and runtime player/camera visualizers | | Collider viewport mode | Inspect world-scale box/sphere/capsule overlays and cooked mesh bounds; green/cyan/gray/amber/red identify ready/trigger/disabled/warning/invalid state, with selected health in the lower-left HUD |
| Viewport eye/options | Toggle actor root icon categories, adjust icon/gizmo size, and control colliders, lights, spawns, gameplay markers, volumes, prefab/model anchors, and runtime player/camera visualizers |
| `Tab` in viewport | Cycle selection through overlapping objects at last click | | `Tab` in viewport | Cycle selection through overlapping objects at last click |
| Viewport selection/orientation HUD | Identify the primary selection, multi-selection count, overlapping-pick position, camera axes, shading mode, and active render path |
| Click Player visualizer in Edit mode | Select or create the authored `PlayerSpawn` (`Player Start`) | | Click Player visualizer in Edit mode | Select or create the authored `PlayerSpawn` (`Player Start`) |
| Select Project Sun | Inspect project default lighting; create a scene sun override | | Select Project Sun | Inspect project default lighting; create a scene sun override |
| Asset Browser project/file views | Browse `assets/`, search/filter/sort, switch grid/list, expand model subassets with generated thumbnails, inspect staged import/material settings, drag assets/submeshes into the viewport | | Asset Browser project/file views | Browse `assets/`, search/filter/sort models, textures, materials, audio clips, levels, and prefabs; switch grid/list; expand model subassets; inspect file details; audition audio; drag supported assets/submeshes into the viewport |
| Drag audio clip into viewport | Create an authored audio source; when an audio source is selected, assign the clip instead |
| Asset Browser context/details actions | Apply textures/materials, regenerate thumbnails, reimport models, place assets/submeshes, or move file assets to `assets/.trash/` | | Asset Browser context/details actions | Apply textures/materials, regenerate thumbnails, reimport models, place assets/submeshes, or move file assets to `assets/.trash/` |
| `Ctrl+P` | Command palette (`scene.reset_lighting`, `selection.group`, `selection.focus`, play commands) | | Window → Material Library | Search/filter project Materials and Material Instances, inspect scene usage and dependency health, create/edit shared assets, and drag them into the viewport |
| Drag Material/Instance onto viewport surface | Preview and assign the exact renderer slot, primitive, or brush face under the pointer; release commits one undo step, while Escape/right-click/outside restores the preview |
| Drag Texture onto viewport surface | Set a primitive base-color texture or exact brush face; renderer slots reject loose textures and direct you to a Material Instance |
| Static/Skinned Mesh Renderer material slots | Assign a shared Material/Material Instance per slot; Browse/Select/Locate the reference, or Clear the override to restore the imported source material |
| `Ctrl+P` | Centered command palette; search human labels or stable command IDs, use arrow keys to select, Enter to run |
| `F7` | While paused in Play: advance one sim tick | | `F7` | While paused in Play: advance one sim tick |
| Shift/Ctrl + click (Hierarchy) | Additive selection | | Shift/Ctrl + click (Hierarchy) | Additive selection |
| Hierarchy context | Reparent to other selection / Unparent | | Drag actor row onto another actor (Hierarchy) | Attach/reparent while preserving world placement; multi-selection keeps existing subtrees and commits one undo step |
| File menu | New, Open, Save, Save As, Import Assets, Export Selection, Save Selection As Prefab, Recent Scenes | | Drag actor between rows / onto Scene Root (Hierarchy, Manual sort) | Reorder siblings / unparent to the root |
| Hierarchy lock | Excludes the actor from selection, gizmos, multi-drag, structural drops, and mutating context actions |
| Hierarchy context | Group selection, create authored local children below linked prefab roots, remove/reparent generated members through same-layer structural overrides, or unparent |
| File menu | New, non-blocking native Open/Save As, recovery restore/keep-copy/discard when available, Import Assets, Export Selection, Save Selection As Prefab (including linked-root variants), Recent Scenes |
| Status strip / Asset Details source-state chip | Inspect compact clean, modified, untracked, conflicted, read-only, and optional ownership status; hover for the source path and provider details |
| Authored File Not Saved dialog | Resolve an external edit, read-only target, or ownership lock with Reload, Compare Metadata, Save As, or Cancel; the editor never offers force overwrite |
| Main toolbar, right side | Switch or close independent scene tabs, create an untitled tab, and manage loaded/locked composed subscenes |
| Prefab Instance inspector | Inspect/recover source health, Apply/Revert overrides by scope, Apply overrides to source, create a variant, **Unpack Layer**, or recursively **Convert to Local** |
| Inspector component card | Collapse with caret, toggle active with status dot, or use triple-dot menu for reset/copy/paste/move/remove actions | | Inspector component card | Collapse with caret, toggle active with status dot, or use triple-dot menu for reset/copy/paste/move/remove actions |
| Inspector footer → Add Component | Pinned search/add control for registered authoring, rendering, physics, and gameplay components with undo | | Inspector footer → Add Component | Expands an inline search shelf for registered authoring, rendering, physics, gameplay, and volume components with descriptions, availability hints, and undo |
| Edit → Project Settings… | Edit `assets/project.ron` (rendering, physics, input) | | Inspector footer → Add Component → Terrain | Add a height-grid terrain actor; configure grid scale/chunking/collision in its component card and use Resize Flat only for deliberate grid replacement |
| Selected Terrain → viewport mountains tool | Sculpt Raise/Lower/Flatten/Smooth/Noise strokes with a terrain-following footprint; release commits one undo step, while Escape/right-click restores the pre-stroke grid |
| Terrain card → Material Layers; selected Terrain → viewport paint tool | Assign up to four shared materials, then Paint/Erase normalized layer weights with live blended preview; release commits one undo step and Escape/right-click restores the pre-stroke map |
| Selected physics props → viewport hand/down-arrow tool | Release the selection into real gravity/colliders; check commits one grouped transform edit, while Escape/X restores the exact starting state |
| Audio Source / Listener inspector | Assign and audition clips; edit gain, pitch, loop/autoplay, spatial blend, attenuation, bus, listener priority, and ear gap |
| Edit → Project Settings… | Edit `assets/project.ron` rendering, audio buses, physics, and input |
Viewport shortcut keys require the pointer to be in the viewport and are suspended while typing in egui text fields or actively using camera navigation. `Delete`, `Backspace`, duplicate, and undo/redo also defer to text-field focus.
### Play Mode ### Play Mode
@@ -162,7 +216,18 @@ VS Code tasks: **target cleanup (dry run)** and **target cleanup (safe apply)**.
## Scene Workflow ## Scene Workflow
- Levels are saved as native Bevy dynamic scenes under `assets/levels/`. - Levels are saved as native Bevy dynamic scenes under `assets/levels/`.
- Scene tabs live at the right end of the existing main toolbar. Open creates another tab; each tab
retains its own path and dirty state, and close prompts only for that document.
- The adjacent **Composition** menu adds validated project-relative subscenes, loads/unloads them,
applies read-only hierarchy locks, and focuses their actors. Recursive validation rejects missing
or cyclic references before replacing the active world. See
[multi-scene-composition.md](docs/editor/multi-scene-composition.md).
- Editable entities use reflectable authoring components from `crates/shared`. - Editable entities use reflectable authoring components from `crates/shared`.
- Linked prefabs keep source-generated actors out of owner-scene serialization through runtime
`HydratedPrefabMember` ownership. Generated actor properties/components and same-layer structural
changes use stable nested override paths; authored local children and nested linked instances can
live below an instance root. Saving that linked root and its local hierarchy as a prefab creates
the current variant representation. See [prefab-authoring.md](docs/editor/prefab-authoring.md).
- The editable player start is an authored `PlayerSpawn`; moving it with the transform gizmo changes - The editable player start is an authored `PlayerSpawn`; moving it with the transform gizmo changes
where Play mode boots the runtime player. where Play mode boots the runtime player.
- Project settings provide default ambient/sun lighting. A scene-authored directional `LightDesc` - Project settings provide default ambient/sun lighting. A scene-authored directional `LightDesc`
@@ -176,11 +241,43 @@ VS Code tasks: **target cleanup (dry run)** and **target cleanup (safe apply)**.
artifacts in `assets/meshes/generated/`. Renderer slots reference imported content-browser mesh artifacts in `assets/meshes/generated/`. Renderer slots reference imported content-browser mesh
and material assets, while generated collision is stored separately in `ColliderDesc` plus and material assets, while generated collision is stored separately in `ColliderDesc` plus
`RigidBodyDesc`. Switch a model asset's placement mode to **Scene Instance** in Asset Browser `RigidBodyDesc`. Switch a model asset's placement mode to **Scene Instance** in Asset Browser
details when you need full `SceneRoot` loading for animation/skinning/scene data. Expanding a details when you need full `WorldAssetRoot` scene data instead of normalized static slots.
model in the Asset Browser exposes normalized mesh/material/texture subassets; dragging a mesh Expanding a model in the Asset Browser exposes normalized mesh/material/texture plus generated
subasset places that part through the same static mesh renderer path. skeleton/animation-clip subassets. Dragging a mesh places that part through the static mesh path;
dragging a clip creates a dedicated skinned renderer or assigns an exact-rig-compatible state to
the selected skinned actor. **Default animation** in Model Import Settings optionally selects the
exact clip sampled and paused as the edit-rest pose; **Imported rest pose** never guesses a clip.
Preview stop and PIE exit restore imported transforms and morph weights before resampling that
explicit default. The Animation Controller inspector edits state IDs, clips,
range/loop/speed/default/crossfade and provides non-dirty play/pause/stop/scrub preview. See the
[animation authoring guide](docs/editor/animation-authoring.md) and [ADR 0031](docs/adr/0031-animation-authoring-runtime-contract.md).
- Navigation bounds, obstacles, areas, and links are created from **Scene > Navigation** or the path
icon in the existing horizontal toolbar. Bounds bake versioned Rerecast artifacts under
`assets/navigation/generated/`; overlapping primitive and additive-brush triangles participate
in the bake fingerprint while distant authoring is excluded. Visible composed subscenes and linked
prefab sources resolve through the same deterministic bake path used by CI. The Inspector reports
stale/current state, pins named validation paths, and provides a Polyanya-backed path test whose
mesh, links, and route render in the viewport. Use
`cargo bake-navigation --project . --check` in CI. See the
[navigation authoring guide](docs/editor/navigation-authoring.md) and [ADR 0032](docs/adr/0032-versioned-navigation-bake-and-runtime-query.md).
- Brush actors are persisted as `ActorKind::Brush + BrushDesc`; valid convex faces hydrate into
generated preview meshes. Vertex, edge, and face selections use the standard transform gizmo,
face material/UV fields are undoable, and clip/intersect/merge/subtract provide conservative
bounds-based blockout operations with preview-before-commit.
- Draw Brush mode (`B` or toolbar pencil) places snapped floor points; `Enter` locks the outline,
mouse up/down adjusts height, and `Enter` or left-click commits additive prism brushes. Simple
concave outlines decompose into convex brush parts, while self-intersections are blocked with
status text. The viewport shows quick brush key hints while drawing. `Esc` or right-click cancels
without changing the scene.
- Runtime-only handles/colliders are not serialized directly, keeping scenes stable and portable. - Runtime-only handles/colliders are not serialized directly, keeping scenes stable and portable.
- Editor-only cameras and helper roots are filtered from selection, hierarchy, and scene save. - Editor-only cameras and helper roots are filtered from selection, hierarchy, and scene save.
- Loaded scenes, prefab source Apply/history, Materials, Material Instances, and Project Settings
retain exact BLAKE3 disk revisions. Save verifies the revision again immediately before atomic
replacement; an external edit, create race, read-only target, or provider lock leaves the
existing file untouched and opens the collaborative recovery dialog. Git status is observational
and optional. See the
[collaborative file-safety guide](docs/editor/collaborative-file-safety.md) and
[ADR 0037](docs/adr/0037-collaborative-authored-file-safety.md).
- **PIE restores player sim only** (transform, velocity, jump state) when you stop Play; authored - **PIE restores player sim only** (transform, velocity, jump state) when you stop Play; authored
`LevelObject` edits made during PIE **remain** in the scene (the level may show as dirty). `LevelObject` edits made during PIE **remain** in the scene (the level may show as dirty).
- Play mode swaps the unified viewport between the player camera (possessed) and editor fly camera - Play mode swaps the unified viewport between the player camera (possessed) and editor fly camera
@@ -194,8 +291,8 @@ VS Code tasks: **target cleanup (dry run)** and **target cleanup (safe apply)**.
1. Check the **mode badge** (bottom-right of the viewport). **Collider** hides meshes — click the **sun** toolbar icon for **Lit** shading. 1. Check the **mode badge** (bottom-right of the viewport). **Collider** hides meshes — click the **sun** toolbar icon for **Lit** shading.
2. **Window → Rendering → Active Camera**: check **Runtime lights** (directional/point/spot counts), scene vs project sun status, and contributing post-process volumes. Scene directionals override the project sun; use **Scene → Lighting → Use project sun** to restore project defaults. 2. **Window → Rendering → Active Camera**: check **Runtime lights** (directional/point/spot counts), scene vs project sun status, and contributing post-process volumes. Scene directionals override the project sun; use **Scene → Lighting → Use project sun** to restore project defaults.
3. **Solari requested but not visually changing**: check **Window → Rendering → Active Camera** for requested/effective GI, fallback reason, tagged meshes, Solari-compatible mesh assets, render instances, bind-group readiness, and compatible lights. Effective Solari forces an HDR camera target because Bevy Solari writes through a storage texture; imported/custom meshes need TriangleList geometry, POSITION/NORMAL/UV_0/TANGENT attributes, and U32 indices for Bevy 0.18 Solari. 3. **Solari requested but not visually changing**: check **Window → Rendering → Active Camera** for requested/effective GI, fallback reason, tagged meshes, Solari-compatible mesh assets, render instances, bind-group readiness, and compatible lights. Effective Solari forces an HDR camera target because Bevy Solari writes through a storage texture; imported/custom meshes need TriangleList geometry, POSITION/NORMAL/UV_0/TANGENT attributes, and U32 indices for Bevy 0.19 Solari.
4. **Lighting changes do nothing in Solari**: Bevy 0.18 Solari samples directional lights and emissive meshes, not point/spot lights. Use Directional lights or emissive materials in Solari; switch to Forward PBR for point/spot light authoring. 4. **Lighting changes do nothing in Solari**: Bevy 0.19 Solari samples directional lights and emissive meshes, not point/spot lights. Use Directional lights or emissive materials in Solari; switch to Forward PBR for point/spot light authoring.
5. **GiMode Auto shows Forward**: Solari RT wgpu features are unavailable on this GPU. Dev RT override: `BEVY_FPS_FORCE_SOLARI=1`. 5. **GiMode Auto shows Forward**: Solari RT wgpu features are unavailable on this GPU. Dev RT override: `BEVY_FPS_FORCE_SOLARI=1`.
6. **Volume overrides ignored**: confirm camera is inside volume AABB; check priority in Rendering → Volumes tab. 6. **Volume overrides ignored**: confirm camera is inside volume AABB; check priority in Rendering → Volumes tab.
7. **Custom post FX**: RON under `assets/post_fx/`; assign path in volume inspector (see [docs/editor/rendering.md](docs/editor/rendering.md)). 7. **Custom post FX**: RON under `assets/post_fx/`; assign path in volume inspector (see [docs/editor/rendering.md](docs/editor/rendering.md)).
@@ -207,7 +304,51 @@ VS Code tasks: **target cleanup (dry run)** and **target cleanup (safe apply)**.
### Hierarchy scrolls during drag ### Hierarchy scrolls during drag
Scroll-to-drag is disabled while dragging actors. Release the mouse to finish or cancel the drag. Scroll-to-drag is disabled while dragging actors. The pointer card reports the pending action:
drop on a full actor row to attach, on the **Scene Root** zone to unparent, or between rows in
**Manual** sort to reorder. Amber means attach, cyan means reorder/root, and red blocks a hierarchy
cycle. Release away from a valid target to cancel.
### Scene recovery
Dirty saved scenes create a recovery snapshot every 120 seconds and retain the newest five
generations under `$XDG_STATE_HOME/blacksite-editor/recovery` or
`~/.local/state/blacksite-editor/recovery`. If a snapshot is newer than the authored scene, the
status strip shows `[recovery]` and recovery actions become available in **File**. **Restore
Recovery Snapshot** loads it into dirty editor state for inspection, **Save Recovery Copy As...**
writes a separate transactional scene copy without changing the active scene, and **Discard
Recovery Snapshot** retires all generations. Restore keeps the generation available until **Save**
commits the active scene or discard explicitly retires it. The **Diagnostics** window retains the
latest 32 scene I/O results, including exact recovery paths and failures, for the current session.
Unsaved new scenes are not yet covered by automatic recovery.
For recovery testing only, `BLACKSITE_RECOVERY_INTERVAL_SECS=<seconds>` overrides the interval for
the current process without changing preferences.
### Session recovery
Clean editor exits restore the last authored scene, panel visibility, and viewport bookmarks from
the versioned machine-local session document. After an abnormal exit, Blacksite opens the safe
startup scene and asks whether to **Resume Last Scene** or **Continue Safe**; modal tools and dirty
preview state are never restored. Session metadata lives under
`$XDG_STATE_HOME/blacksite-editor/session.ron` or `~/.local/state/blacksite-editor/session.ron` and
contains no scene contents or credentials. See [ADR 0024](docs/adr/0024-versioned-editor-session-state.md).
Open **Window → Diagnostics** and choose **Export Diagnostic Bundle** to write a transactional
support report under `$XDG_STATE_HOME/blacksite-editor/diagnostics` or
`~/.local/state/blacksite-editor/diagnostics`. The report includes build/platform and renderer
identity, project and active-scene paths, dirty flags, aggregate validation counts, prior-crash
state, and the bounded Scene I/O log. It excludes scene and asset contents, environment values,
host/user identity, credentials, access tokens, and modal tool state.
### External file changes and read-only assets
The active scene status strip and selected asset header show compact Git/read-only/ownership state
when available. If Save or Apply detects a different disk revision, Blacksite leaves that revision
untouched and opens **Authored File Not Saved**. Use **Compare Metadata** to inspect both revisions,
**Save As** to preserve the editor copy elsewhere, **Reload** to take the disk version, or **Cancel**
to keep the local draft unsaved. Git and ownership providers are optional; the status scanner never
stages, commits, resets, checks out, restores, or discards files. See
[collaborative-file-safety.md](docs/editor/collaborative-file-safety.md).
## Cursor / VSCode Setup ## Cursor / VSCode Setup
@@ -216,8 +357,8 @@ The `.vscode/` folder is preconfigured:
- `extensions.json` recommends rust-analyzer, Even Better TOML, CodeLLDB, crates, and Error Lens. - `extensions.json` recommends rust-analyzer, Even Better TOML, CodeLLDB, crates, and Error Lens.
- `settings.json` runs `clippy` on save, enables proc-macro/build-script support, formats on save, - `settings.json` runs `clippy` on save, enables proc-macro/build-script support, formats on save,
and excludes `target/` from search/watch. and excludes `target/` from search/watch.
- `tasks.json` provides workspace check/clippy plus game/editor build/run tasks. - `tasks.json` mirrors the full workspace formatting, all-target check, strict Clippy, test, level-validation, build/run, hot-reload, and target-cleanup workflows. **build editor (dev fast-link)** is the default build task.
- `launch.json` provides CodeLLDB launch configs for the editor and game. - `launch.json` uses CodeLLDB Cargo artifact filtering for editor/game Debug, GPU-validation, hot-reload, SDR fallback, and Release configurations. Normal launches keep HDR enabled while quieting known Vulkan validation noise; dynamic-link launches set the required `LD_LIBRARY_PATH` automatically.
- `.github/workflows/ci.yml` mirrors local formatting, check, clippy, test, and binary build verification. - `.github/workflows/ci.yml` mirrors local formatting, check, clippy, test, and binary build verification.
## Architecture Decisions ## Architecture Decisions
@@ -231,6 +372,8 @@ The `.vscode/` folder is preconfigured:
- [ADR 0014: Unified Viewport Model](docs/adr/0014-unified-viewport-model.md) - [ADR 0014: Unified Viewport Model](docs/adr/0014-unified-viewport-model.md)
- [ADR 0016: Unified Rendering Contract](docs/adr/0016-unified-rendering-contract.md) - [ADR 0016: Unified Rendering Contract](docs/adr/0016-unified-rendering-contract.md)
- [ADR 0017: Normalized Static Mesh Assets](docs/adr/0017-normalized-static-mesh-assets.md) - [ADR 0017: Normalized Static Mesh Assets](docs/adr/0017-normalized-static-mesh-assets.md)
- [ADR 0034: Registry-driven Authoring Components](docs/adr/0034-registry-driven-authoring-components.md)
- [ADR 0037: Collaborative Authored-File Safety](docs/adr/0037-collaborative-authored-file-safety.md)
## Project Layout ## Project Layout
@@ -260,6 +403,12 @@ crates/
- [x] Filtered hierarchy, inspector, viewport, toolbar, asset browser, and status panels - [x] Filtered hierarchy, inspector, viewport, toolbar, asset browser, and status panels
- [x] Delete, duplicate, rename, and structural/material undo-redo - [x] Delete, duplicate, rename, and structural/material undo-redo
- [x] Native Bevy scene New/Open/Save/Save As with dirty title tracking - [x] Native Bevy scene New/Open/Save/Save As with dirty title tracking
- [x] First-class height-grid Terrain actor with deterministic generated render/collider chunks, reflected history, validation, and a committed showcase fixture ([ADR 0039](docs/adr/0039-inline-height-grid-terrain-foundation.md), [terrain guide](docs/editor/terrain.md), [Gitea #22](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/22))
- [x] Modal terrain Raise/Lower/Flatten/Smooth/Noise sculpting with a terrain-following footprint, deterministic noise, safe cancel restore, and one undo transaction per stroke ([terrain guide](docs/editor/terrain.md), [Gitea #23](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/23))
- [x] Four shared terrain Material/Material Instance layers with compact normalized sample weights, blended raster hydration, drag/browse assignment, Paint/Erase preview, exact cancel, and one undo transaction per stroke ([ADR 0040](docs/adr/0040-terrain-material-layer-weights.md), [terrain guide](docs/editor/terrain.md), [Gitea #24](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/24))
- [x] Transactional physics placement with real Avian gravity/colliders, paused Edit-mode physics, prerequisite diagnostics, isolated non-selected bodies, exact cancel, and grouped transform undo ([ADR 0041](docs/adr/0041-transactional-editor-physics-placement.md), [workflow guide](docs/editor/physics-placement.md), [Gitea #25](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/25))
- [x] Collider authoring health shared by the inspector, Collider viewport, Diagnostics panel, and physics placement, with scaled shape overlays, cooked mesh bounds, missing/stale/invalid/oversized findings, and undoable dimension-preserving shape switching ([collider guide](docs/editor/collider-authoring.md), [Gitea #26](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/26))
- [x] Non-blocking native file/folder/confirmation broker across scene, asset, prefab, composition, collaboration, and Project Browser workflows ([ADR 0038](docs/adr/0038-non-blocking-native-dialog-broker.md), [workflow guide](docs/editor/native-dialogs.md), [Gitea #52](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/52))
- [x] Asset import, static mesh/prefab placement, texture assignment, and selection export - [x] Asset import, static mesh/prefab placement, texture assignment, and selection export
- [x] PIE player-only snapshot/restore (authored `LevelObject` edits persist on stop) - [x] PIE player-only snapshot/restore (authored `LevelObject` edits persist on stop)
- [x] Unified viewport render-to-texture target + Play session bootstrap - [x] Unified viewport render-to-texture target + Play session bootstrap
@@ -270,29 +419,49 @@ crates/
- [x] CI workflow for format, check, clippy, tests, and binary builds - [x] CI workflow for format, check, clippy, tests, and binary builds
- [x] ADRs for roadmap architecture and Bevy migration policy - [x] ADRs for roadmap architecture and Bevy migration policy
- [x] Determinism harness: same inputs over same ticks produce the same state summary/hash - [x] Determinism harness: same inputs over same ticks produce the same state summary/hash
- [x] Reusable editor operator harness for commit/cancel/block, helper cleanup, dirty state, grouped undo, and undo/redo round trips
- [x] Verify: `cargo fmt --check` / `cargo check --workspace` / `cargo clippy --workspace` / strict foundation clippy / `cargo test -p sim` - [x] Verify: `cargo fmt --check` / `cargo check --workspace` / `cargo clippy --workspace` / strict foundation clippy / `cargo test -p sim`
- [x] Stable asset registry with UUIDs + import settings in asset browser details - [x] Stable asset registry with UUIDs + import settings in asset browser details
- [x] Asset Browser expandable model subasset shelves, independent mesh/material/texture thumbnails, staged import/material details with shader-schema parameters, context actions, and trash-first file removal - [x] Asset Browser expandable model subasset shelves, independent mesh/material/texture thumbnails, staged import/material details with shader-schema parameters, context actions, and trash-first file removal
- [x] Audio clip catalog/import foundation for Ogg, WAV, MP3, and FLAC with dedicated filtering, file details, and stable runtime-resolvable asset references
- [x] Audio source/listener authoring, non-dirty spatial audition, viewport icons/range gizmos, stable buses, PIE/runtime parity, device diagnostics, and shared release validation ([ADR 0030](docs/adr/0030-audio-authoring-and-bus-schema.md); production acceptance completed in [Gitea #47](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/47))
- [x] glTF/GLB skeletal animation manifests, stable controller states, non-dirty preview, PIE/runtime hydration, and exact-signature compatibility validation ([ADR 0031](docs/adr/0031-animation-authoring-runtime-contract.md); production acceptance completed in [Gitea #46](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/46))
- [x] Navigation bounds/obstacles/areas/links, persisted validation samples, composed-source resolution, deterministic stale-checked bake artifacts, viewport path preview, headless bake, and shared game/runtime query API ([ADR 0032](docs/adr/0032-versioned-navigation-bake-and-runtime-query.md); [evaluation](docs/editor/evaluations/navigation-authoring/); [Gitea #48](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/48))
- [x] Exact authored-file revision guards for scenes, prefab source Apply/history, Materials, Material Instances, and Project Settings; compact observational Git/read-only/ownership state; and explicit Reload/Compare Metadata/Save As/Cancel recovery without force overwrite ([ADR 0037](docs/adr/0037-collaborative-authored-file-safety.md), [collaboration guide](docs/editor/collaborative-file-safety.md), [Gitea #49](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/49))
- [x] Prefab instances (`PrefabInstance`) + save-as-prefab + unpack - [x] Prefab instances (`PrefabInstance`) + save-as-prefab + unpack
- [x] Unsaved-scene confirm on New/Open/Recent - [x] Independent dirty-tab close confirmation and all-tab save guard when switching projects
- [x] Transactional scene writes + bounded user-local recovery snapshots ([ADR 0023](docs/adr/0023-transactional-scene-persistence-and-recovery.md))
- [x] Versioned clean/crash session resume + privacy-bounded diagnostic bundle ([ADR 0024](docs/adr/0024-versioned-editor-session-state.md))
- [x] Hierarchy multi-select, reparent undo, multi-entity gizmo transform - [x] Hierarchy multi-select, reparent undo, multi-entity gizmo transform
- [x] Typed inspector undo (light, rigid body, collider, primitive, material, static mesh renderer) + registry-driven Add Component footer - [x] Typed inspector undo (light, rigid body, collider, primitive, material, static mesh renderer) + registry-driven Add Component footer; skinned renderer sources are asset-owned and inspectable
- [x] Gameplay authoring markers + visualizers (`WeaponSpawn`, `TriggerVolume`, etc.) - [x] Gameplay authoring markers + visualizers (`WeaponSpawn`, `TriggerVolume`, etc.)
- [x] Command palette execution; PIE sim step (F7); `xtask validate-levels` - [x] Command palette execution; PIE sim step (F7); `xtask validate-levels`
- [x] ADRs 0005–0012 (prefab/registry, scene schema, EditorPlugin, editor structure, authoring/hydration, ActorKind, sun policy, zero-debt) - [x] ADRs 0005–0012 (prefab/registry, scene schema, EditorPlugin, editor structure, authoring/hydration, ActorKind, sun policy, zero-debt)
- [x] `ActorInspectorSection` registry + game demo section (`game::editor_ext`) - [x] `ActorInspectorSection` registry + game demo section (`game::editor_ext`)
- [x] Command palette: reset lighting, group selection, focus selection - [x] Command palette: reset lighting, group selection, focus selection
- [x] CI: `cargo test -p shared`, scene authoring-only check on repo level, `cargo check -p editor --features dev` - [x] CI: `cargo test -p shared`, scene authoring-only check on repo level, `cargo check -p editor --features dev`
- [x] `scene` crate schema stamp/migrate/validate on save/load + CI `validate-levels` - [x] `scene` crate schema stamp/migrate/validate on save/load + CI `validate-levels` for levels and prefab graphs
- [x] Project Settings draft + Apply (HDR/swapchain safe); File → Project New/Open - [x] Project Settings draft + Apply (HDR/swapchain safe)
- [x] Project Browser UI, strict manifest validation, `--project` startup activation, recent filtering, sandbox scaffolding, clean process handoff, and desktop launcher action ([ADR 0025](docs/adr/0025-project-root-is-a-startup-boundary.md))
- [x] Independent scene tabs + stable subscene composition, recursive validation, ownership locks, active-world PIE consistency, and per-saved-tab recovery ([ADR 0026](docs/adr/0026-stable-scene-composition-and-active-document.md))
- [x] Editor lib/bin split + `EditorPluginGroup`; game EditorPlugin dogfood panel - [x] Editor lib/bin split + `EditorPluginGroup`; game EditorPlugin dogfood panel
- [x] FBX/glTF model import + normalized `StaticMeshRenderer` placement; explicit scene-instance load via `bevy_ufbx` / `ModelRef` - [x] FBX/glTF model import + normalized static/skinned renderer routing; explicit generic scene-instance load via `bevy_ufbx` / `ModelRef`
- [x] Asset browser model thumbnails (unified `assets/thumbnails/` pipeline; `ThumbnailState` cache; FBX via `FbxThumbnailSource`) - [x] Asset browser model thumbnails (unified `assets/thumbnails/` pipeline; `ThumbnailState` cache; FBX via `FbxThumbnailSource`)
- [x] Material assets (`assets/materials/*.ron`, inspector picker, drag-drop to selection) - [x] Shared Material/Material Instance assets, stable static/skinned renderer material slots, imported-source fallback, orphan preservation, and a persistence-excluded property-block schema; runtime block application/promotion remains tracked in [Gitea #53](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/53) ([ADR 0035](docs/adr/0035-shared-material-assets-and-renderer-slots.md), [material-system guide](docs/editor/material-system.md))
- [x] Prefab instance overrides v2 (transform/material/child visibility apply-revert groups) - [x] Docked Material Library with cross-folder type/usage filters, resolved Material Instance thumbnails, shared guarded editors, and exact reversible viewport Material/Texture drops for renderer slots, primitives, and brush faces ([material-system guide](docs/editor/material-system.md); [Gitea #16](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/16), [Gitea #18](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/18))
- [x] Prefab v2 core: shared stable nested override paths, property/component/structural scopes, recursive graph validation, linked-root variants, conflict recovery, transactional source Apply, and undoable unpack/convert ([ADR 0027](docs/adr/0027-stable-prefab-ownership-and-variants.md))
- [x] Prefab v2 production acceptance: committed base/nested/variant fixtures pass workspace tests, recursive headless validation, packaged release startup, and live editor placement/inspection regression coverage ([Gitea #43](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/43))
- [x] Shared project validation: editor Diagnostics and `cargo validate-levels --json` use one owner-attributed dependency/finding report across project settings, registry/import artifacts, materials, shaders, scenes, prefabs, brushes, and colliders; valid/missing/cyclic/incompatible fixtures fail on blocking content errors ([ADR 0028](docs/adr/0028-authoritative-project-content-validation.md), [Gitea #45](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/45))
- [x] Validation-gated package foundation: versioned development/QA/release profiles, deterministic runtime exclusions, stable input snapshots, transactional staged publication, Cargo-reported artifacts, BLAKE3 metadata, authored default-scene startup, and a non-blocking editor Build panel with live logs/cancel/run/reveal ([ADR 0029](docs/adr/0029-validation-gated-build-profiles-and-packaging.md), [build guide](docs/editor/build-and-package.md), [Gitea #44](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/44))
- [x] Advanced rendering: `GiMode`, post-process volumes, Rendering panel, requested/effective render stack, Solari integration, emissive materials, post FX assets ([ADR 0013](docs/adr/0013-rendering-tiers-and-post-process-volumes.md), [ADR 0016](docs/adr/0016-unified-rendering-contract.md), [rendering guide](docs/editor/rendering.md)) - [x] Advanced rendering: `GiMode`, post-process volumes, Rendering panel, requested/effective render stack, Solari integration, emissive materials, post FX assets ([ADR 0013](docs/adr/0013-rendering-tiers-and-post-process-volumes.md), [ADR 0016](docs/adr/0016-unified-rendering-contract.md), [rendering guide](docs/editor/rendering.md))
- [x] Surface ABI v1 with shared raster/Solari evaluator dispatch, packed typed parameters/textures, exact cutout ray-candidate evaluation, last-good shader fallback, and explicit exclusion of skinned/morph-deformed Solari geometry ([ADR 0036](docs/adr/0036-surface-abi-and-solari-parity.md), [material-system guide](docs/editor/material-system.md))
- [x] Static mesh renderer component, generated normalized mesh artifacts, source/one-actor hierarchy placement, and inspector renderer slots ([ADR 0017](docs/adr/0017-normalized-static-mesh-assets.md)) - [x] Static mesh renderer component, generated normalized mesh artifacts, source/one-actor hierarchy placement, and inspector renderer slots ([ADR 0017](docs/adr/0017-normalized-static-mesh-assets.md))
- [x] Componentized actor inspector, unified component cards, thumbnail static mesh slots, imported asset Browse/Locate/Clear refs with inherited source defaults, collider split, shader-aware material data, and per-actor material overrides ([ADR 0018](docs/adr/0018-componentized-actor-inspector-and-materials.md)) - [x] Dedicated `SkinnedMeshRenderer`/`SkinnedMesh` actor path, skinned-part exclusion from static slots, dedicated runtime hierarchy hydration, and v2-to-v3 animated-scene migration ([ADR 0033](docs/adr/0033-dedicated-skinned-mesh-renderer.md))
- [x] Componentized actor inspector, unified component cards, thumbnail static mesh slots, imported asset Browse/Locate/Clear refs with inherited source defaults, collider split, shader-aware actor material data, and texture picker/drop refs ([ADR 0018](docs/adr/0018-componentized-actor-inspector-and-materials.md))
- [x] Stable authoring component IDs, registry-built save filtering, reflected atomic add/remove/reset/copy/paste history, independent active state, static extension registration, and derived composable `ActorKind` hints ([ADR 0034](docs/adr/0034-registry-driven-authoring-components.md), [extensibility guide](docs/editor/extensibility.md))
- [x] Brush authoring schema MVP with `ActorKind::Brush`, cube `BrushDesc`, generated mesh hydration, scene migration, and inspector Add Component support ([ADR 0021](docs/adr/0021-brush-authoring-schema.md))
- [x] Brush draw, vertex/edge/face gizmo editing, face material/UV authoring, clip, and bounds-based CSG preview/commit workflow ([brush guide](docs/editor/brushes.md))
- [x] Searchable command palette with human labels/stable IDs and a status bar that exposes scene I/O, tool, history, mode, and selection feedback
## Notes / Future Work ## Notes / Future Work
@@ -302,14 +471,27 @@ crates/
untextured models), material sphere thumbnails, search/filter/sort controls, expandable model untextured models), material sphere thumbnails, search/filter/sort controls, expandable model
subasset shelves, and a staged details pane. **File → Import Assets** subasset shelves, and a staged details pane. **File → Import Assets**
accepts glTF/GLB and **FBX** (binary; copies sibling `.fbm` texture folders when present). accepts glTF/GLB and **FBX** (binary; copies sibling `.fbm` texture folders when present).
Model assets generate normalized static mesh manifests under `assets/meshes/generated/`; drag/drop Model assets generate normalized model manifests under `assets/meshes/generated/`; drag/drop uses
uses `StaticMeshRenderer` by default with imported asset refs and optional separate static mesh **Renderable Asset (Auto)**. Unrigged sources use `StaticMeshRenderer` with imported asset refs
collider components. Expanded mesh subassets generate independent thumbnails and can be placed independently. Asset details can switch and optional separate static mesh colliders. Skin-bound or animated sources and their subasset placement use
placement to **Scene Instance** for `ModelRef`/`SceneRoot` playback, shared material assets can be `SkinnedMeshRenderer`, preserve the source joint hierarchy, and never create static slots or
edited from the browser, and delete actions move files to `assets/.trash/`. Skeletal animation automatic triangle colliders. Expanded mesh subassets generate independent thumbnails. Asset details can switch
playback is not supported by the static mesh path yet. placement to **Scene Instance** for generic `ModelRef`/`WorldAssetRoot` scenes, shared material assets can be
- Prefab instances use stable asset IDs (`PrefabInstance` + registry) with serialized `PrefabOverrides` (transform, material, per-child visibility by name). Inspector **Apply/Revert** per field group; **Unpack** removes the instance link. edited from the browser, and delete actions move files to `assets/.trash/`. Animation authoring
- Material assets are RON files under `assets/materials/`; shader schemas live under `assets/shaders/`. `MaterialDesc` stores shader kind, typed parameters, texture bindings, and StandardMaterial fields. The Asset Browser material details editor can apply shader schemas, edit typed parameters/textures, and regenerate sphere thumbnails. Actor inspector edits create per-actor `MaterialOverride` data for static mesh slots instead of mutating shared material assets. supports glTF/GLB rig and clip manifests, stable controller refs, clip drag assignment/placement,
inspector preview, PIE/runtime playback, and headless compatibility diagnostics. Animated or
skinned FBX remains blocked until the loader can build hierarchy, Bevy skinned meshes, and clips.
See the [animation authoring guide](docs/editor/animation-authoring.md).
- Prefab instances use stable asset IDs and shared versioned override data keyed by nested
`PrefabActorPath` identity. Generated source members are excluded from owner save/export, while
property/component edits and same-layer remove/reparent operations persist as overrides. Revert
stays instance-local; explicit **Apply to source** validates and atomically patches the appropriate
source layer, with exact-file undo/redo guards against external edits. Source health exposes
changed, semantic-conflict, broken, and malformed states with keep/take/retry/relink recovery.
**Unpack Layer** preserves nested links; **Convert to Local** recursively removes them. Current
authoring UI coverage and production-acceptance gaps are tracked in
[prefab-authoring.md](docs/editor/prefab-authoring.md).
- Material and direct-base Material Instance assets live under `assets/materials/`; shader schemas live under `assets/shaders/`. **Window > Material Library** provides cross-folder creation, editing, usage filters, and drag sources. Viewport Material drops target one exact renderer slot, primitive, or brush face and use reversible preview plus one-step history; loose Textures target primitives/brush faces and are rejected on renderer slots. Shared edits propagate through live-updated handles without reloading skinned geometry. Custom Surface evaluators share one constrained ABI between raster and Solari-eligible non-deformed geometry. Runtime property-block application/promotion is tracked in [#53](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/53); dynamic skinned/morph Solari geometry is tracked in [#54](https://git.spacetrainclubhouse.com/Falling-Metal-Interactive/Blacksite/issues/54). See the [material-system guide](docs/editor/material-system.md).
- Per-field reflect undo for all components remains future work; typed `shared` inspectors cover the common authoring path. - Per-field reflect undo for all components remains future work; typed `shared` inspectors cover the common authoring path.
- The authoring/hydration layer is intentionally small so richer asset workflows (terrain, - The authoring/hydration layer is intentionally small so richer asset workflows (terrain,
material graphs, lighting profiles) can be added without changing the scene format foundation. material graphs, lighting profiles) can be added without changing the scene format foundation.
+420 -13
View File
@@ -1,4 +1,40 @@
[ [
(
id: ("c0a7d10e-53c1-4de0-b0dc-34a66f44ba77"),
path: "assets/audio/editor_audition_tone.ogg",
label: "editor_audition_tone",
kind_tag: "AudioClip",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("fe40db93-181f-4c79-86e6-26bd97464c4b"),
path: "assets/audio/Puzzle Lobby.mp3",
label: "Puzzle Lobby",
kind_tag: "AudioClip",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
( (
id: ("31963299-d4c1-45dc-8f67-2f469ca1ad6d"), id: ("31963299-d4c1-45dc-8f67-2f469ca1ad6d"),
path: "assets/post_fx/chromatic_aberration.ron", path: "assets/post_fx/chromatic_aberration.ron",
@@ -12,6 +48,8 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -28,6 +66,8 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -44,29 +84,46 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: Some("assets/meshes/generated/b98ef565-3500-49e7-9935-f685fa9b2594.static_mesh.ron"), static_mesh_manifest_path: Some("assets/meshes/generated/b98ef565-3500-49e7-9935-f685fa9b2594.static_mesh.ron"),
animation_manifest_path: Some("assets/animations/generated/b98ef565-3500-49e7-9935-f685fa9b2594.animation.ron"),
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
( (
id: ("71071fc3-7a7f-454d-b9ab-93ebf0feccbe"), id: ("113f74df-e39c-41d4-9b5b-e48efe541f7f"),
path: "assets/models/metal_stool_01_2k.gltf", path: "assets/models/RobotExpressive.glb",
label: "metal_stool_01_2k", label: "RobotExpressive",
kind_tag: "Model", kind_tag: "Model",
import_settings: ( import_settings: (
scale: 1.0, scale: 1.0,
generate_collider: true, generate_collider: true,
lod0_only: true, lod0_only: true,
placement_mode: SceneInstance, placement_mode: SceneInstance,
hierarchy_mode: SourceHierarchy,
material_policy: SourceMaterials,
static_mesh_manifest_path: Some("assets/meshes/generated/113f74df-e39c-41d4-9b5b-e48efe541f7f.static_mesh.ron"),
animation_manifest_path: Some("assets/animations/generated/113f74df-e39c-41d4-9b5b-e48efe541f7f.animation.ron"),
default_animation_clip_id: Some("animation:clip:8:standing"),
),
dependencies: [],
),
(
id: ("3f63f359-45eb-4cb2-8970-71921cbd7bd0"),
path: "assets/models/robot_expressive.glb",
label: "robot_expressive",
kind_tag: "Model",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: Some("assets/meshes/generated/71071fc3-7a7f-454d-b9ab-93ebf0feccbe.static_mesh.ron"), static_mesh_manifest_path: Some("assets/meshes/generated/3f63f359-45eb-4cb2-8970-71921cbd7bd0.static_mesh.ron"),
animation_manifest_path: Some("assets/animations/generated/3f63f359-45eb-4cb2-8970-71921cbd7bd0.animation.ron"),
default_animation_clip_id: Some("animation:clip:8:standing"),
), ),
dependencies: [ dependencies: [],
"assets/models/metal_stool_01.bin",
"assets/models/textures/metal_stool_01_arm_2k.jpg",
"assets/models/textures/metal_stool_01_diff_2k.jpg",
"assets/models/textures/metal_stool_01_nor_gl_2k.jpg",
],
), ),
( (
id: ("c4abe41c-ac88-4aec-8168-27e8a7c90583"), id: ("c4abe41c-ac88-4aec-8168-27e8a7c90583"),
@@ -81,6 +138,8 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -97,6 +156,8 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -113,6 +174,8 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -120,7 +183,7 @@
id: ("61802b85-fda9-4aff-94d9-fe5f0860c516"), id: ("61802b85-fda9-4aff-94d9-fe5f0860c516"),
path: "assets/levels/rendering_showcase.scn.ron", path: "assets/levels/rendering_showcase.scn.ron",
label: "rendering_showcase.scn", label: "rendering_showcase.scn",
kind_tag: "Prefab", kind_tag: "Level",
import_settings: ( import_settings: (
scale: 1.0, scale: 1.0,
generate_collider: true, generate_collider: true,
@@ -129,6 +192,44 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("78c6850b-5a76-4a4f-b48e-7fb00f6dd1ed"),
path: "assets/levels/physics_placement_showcase.scn.ron",
label: "physics_placement_showcase.scn",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("706e604e-1a63-4e97-b35d-eeb1d88fe3a9"),
path: "assets/levels/navigation_authoring_showcase.scn.ron",
label: "navigation_authoring_showcase.scn",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -136,7 +237,7 @@
id: ("48bcef13-e6a6-4260-bb1b-c29787bd8c70"), id: ("48bcef13-e6a6-4260-bb1b-c29787bd8c70"),
path: "assets/levels/editor_scene 3.scn.ron", path: "assets/levels/editor_scene 3.scn.ron",
label: "editor_scene 3.scn", label: "editor_scene 3.scn",
kind_tag: "Prefab", kind_tag: "Level",
import_settings: ( import_settings: (
scale: 1.0, scale: 1.0,
generate_collider: true, generate_collider: true,
@@ -145,6 +246,44 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("a7ef65b4-24d6-4c3a-b637-5bb52d8e9a26"),
path: "assets/levels/collider_diagnostics_showcase.scn.ron",
label: "collider_diagnostics_showcase.scn",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("f3dfcd11-aa5b-4fd4-872b-06832b865c99"),
path: "assets/levels/audio_authoring_showcase.scn.ron",
label: "audio_authoring_showcase.scn",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -152,7 +291,7 @@
id: ("5a2307d0-48e5-40d3-a5c9-527c0cfd30f4"), id: ("5a2307d0-48e5-40d3-a5c9-527c0cfd30f4"),
path: "assets/levels/editor_scene.scn.ron", path: "assets/levels/editor_scene.scn.ron",
label: "editor_scene.scn", label: "editor_scene.scn",
kind_tag: "Prefab", kind_tag: "Level",
import_settings: ( import_settings: (
scale: 1.0, scale: 1.0,
generate_collider: true, generate_collider: true,
@@ -161,6 +300,26 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("1b25d451-7b54-41d6-af00-d2e6950f502d"),
path: "assets/levels/terrain_authoring_showcase.scn.ron",
label: "terrain_authoring_showcase.scn",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -168,6 +327,24 @@
id: ("dc13ce01-c7ce-43c5-974c-0e659ae49ab9"), id: ("dc13ce01-c7ce-43c5-974c-0e659ae49ab9"),
path: "assets/levels/editor_scene 2.scn.ron", path: "assets/levels/editor_scene 2.scn.ron",
label: "editor_scene 2.scn", label: "editor_scene 2.scn",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("c14f6240-5654-4e80-9edb-2b4c44cf8d61"),
path: "assets/prefabs/example_variant.scn.ron",
label: "example_variant.scn",
kind_tag: "Prefab", kind_tag: "Prefab",
import_settings: ( import_settings: (
scale: 1.0, scale: 1.0,
@@ -177,6 +354,98 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("682191d6-59cd-46a1-9560-6cf7bc1583b2"),
path: "assets/prefabs/example_nested.scn.ron",
label: "example_nested.scn",
kind_tag: "Prefab",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("862530b2-8111-4ebb-9078-29723c002e08"),
path: "assets/prefabs/example_base.scn.ron",
label: "example_base.scn",
kind_tag: "Prefab",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("04a4e00e-4732-43db-8e99-9cd99b94667b"),
path: "assets/animations/generated/113f74df-e39c-41d4-9b5b-e48efe541f7f.animation.ron",
label: "113f74df-e39c-41d4-9b5b-e48efe541f7f.animation",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("4937e63f-923b-4270-bdfc-298d63bcb814"),
path: "assets/animations/generated/3f63f359-45eb-4cb2-8970-71921cbd7bd0.animation.ron",
label: "3f63f359-45eb-4cb2-8970-71921cbd7bd0.animation",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("28f1df44-6d24-4722-bf75-6969879995a4"),
path: "assets/animations/generated/b98ef565-3500-49e7-9935-f685fa9b2594.animation.ron",
label: "b98ef565-3500-49e7-9935-f685fa9b2594.animation",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -193,6 +462,8 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -209,6 +480,26 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("264e2010-0693-4d74-8440-99373c2cedb3"),
path: "assets/navigation/generated/navigation_showcase_humanoid.nav.ron",
label: "navigation_showcase_humanoid.nav",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -225,6 +516,26 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("cc2769da-c9a5-4cb3-866a-cc81d0688ee2"),
path: "assets/materials/surface_tint_instance.ron",
label: "surface_tint_instance",
kind_tag: "Material",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -241,6 +552,80 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("d6cb4151-7124-4237-aaf9-f7f8abd5fb76"),
path: "assets/materials/surface_tint.ron",
label: "surface_tint",
kind_tag: "Material",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("64fea29e-c123-4987-92dc-ca25f4dc7dea"),
path: "assets/build_profiles/qa.ron",
label: "qa",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("9213efe6-12c7-45a8-8b64-9e1699f76ba3"),
path: "assets/build_profiles/development.ron",
label: "development",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("de76f1c9-f05d-48d3-bb69-6b7ce05f29d8"),
path: "assets/build_profiles/release.ron",
label: "release",
kind_tag: "Level",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -257,6 +642,8 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -273,6 +660,26 @@
hierarchy_mode: SingleActor, hierarchy_mode: SingleActor,
material_policy: SourceMaterials, material_policy: SourceMaterials,
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
),
dependencies: [],
),
(
id: ("a72943d6-3e9d-4629-8887-5c02d99d4f92"),
path: "assets/shaders/surface_tint.shader.ron",
label: "surface_tint.shader",
kind_tag: "ShaderSchema",
import_settings: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
), ),
dependencies: [], dependencies: [],
), ),
@@ -0,0 +1,236 @@
(
schema_version: 3,
asset_id: "113f74df-e39c-41d4-9b5b-e48efe541f7f",
label: "RobotExpressive",
default_animation_clip_id: Some("animation:clip:8:standing"),
source: (
path: "assets/models/RobotExpressive.glb",
format: "glb",
fingerprint: (
byte_len: 463988,
modified_unix_secs: 1783799272,
content_hash: "5869cb813e6a6093eda7af2824a9c13a582750e0443e88ce7c991a1f83415521",
),
dependencies: [],
),
runtime_supported: true,
skeletons: [
(
id: "animation:skeleton:0:skeleton_0",
label: "Skeleton 0",
source_index: 0,
signature: ("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b"),
joint_paths: [
"RootNode/RobotArmature/Bone",
"RootNode/RobotArmature/Bone/Foot.L",
"RootNode/RobotArmature/Bone/Body",
"RootNode/RobotArmature/Bone/Body/Hips",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck/Head",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L/Middle1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L/Middle1.L/Middle2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Thumb.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Thumb.L/Thumb2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L/Index.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L/Index.L/Index2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L/Ring1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L/Ring1.L/Ring2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R/Middle1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R/Middle1.R/Middle2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Thumb.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Thumb.R/Thumb2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R/Index.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R/Index.R/Index2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R/Ring1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R/Ring1.R/Ring2.R",
"RootNode/RobotArmature/Bone/Body/UpperLeg.L",
"RootNode/RobotArmature/Bone/Body/UpperLeg.L/LowerLeg.L",
"RootNode/RobotArmature/Bone/Body/UpperLeg.R",
"RootNode/RobotArmature/Bone/Body/UpperLeg.R/LowerLeg.R",
"RootNode/RobotArmature/Bone/PoleTarget.L",
"RootNode/RobotArmature/Bone/Foot.R",
"RootNode/RobotArmature/Bone/PoleTarget.R",
],
),
(
id: "animation:skeleton:1:skeleton_1",
label: "Skeleton 1",
source_index: 1,
signature: ("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b"),
joint_paths: [
"RootNode/RobotArmature/Bone",
"RootNode/RobotArmature/Bone/Foot.L",
"RootNode/RobotArmature/Bone/Body",
"RootNode/RobotArmature/Bone/Body/Hips",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck/Head",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L/Middle1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L/Middle1.L/Middle2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Thumb.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Thumb.L/Thumb2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L/Index.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L/Index.L/Index2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L/Ring1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L/Ring1.L/Ring2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R/Middle1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R/Middle1.R/Middle2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Thumb.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Thumb.R/Thumb2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R/Index.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R/Index.R/Index2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R/Ring1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R/Ring1.R/Ring2.R",
"RootNode/RobotArmature/Bone/Body/UpperLeg.L",
"RootNode/RobotArmature/Bone/Body/UpperLeg.L/LowerLeg.L",
"RootNode/RobotArmature/Bone/Body/UpperLeg.R",
"RootNode/RobotArmature/Bone/Body/UpperLeg.R/LowerLeg.R",
"RootNode/RobotArmature/Bone/PoleTarget.L",
"RootNode/RobotArmature/Bone/Foot.R",
"RootNode/RobotArmature/Bone/PoleTarget.R",
],
),
],
clips: [
(
id: "animation:clip:0:dance",
label: "Dance",
source_index: 0,
duration_seconds: 3.3333333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:1:death",
label: "Death",
source_index: 1,
duration_seconds: 0.9583333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:2:idle",
label: "Idle",
source_index: 2,
duration_seconds: 3.3333333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:3:jump",
label: "Jump",
source_index: 3,
duration_seconds: 0.7083333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:4:no",
label: "No",
source_index: 4,
duration_seconds: 1.6666666,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:5:punch",
label: "Punch",
source_index: 5,
duration_seconds: 0.8333333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:6:running",
label: "Running",
source_index: 6,
duration_seconds: 0.9583333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:7:sitting",
label: "Sitting",
source_index: 7,
duration_seconds: 0.41666666,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:8:standing",
label: "Standing",
source_index: 8,
duration_seconds: 0.41666666,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:9:thumbsup",
label: "ThumbsUp",
source_index: 9,
duration_seconds: 1.5833334,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:10:walking",
label: "Walking",
source_index: 10,
duration_seconds: 0.9583333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:11:walkjump",
label: "WalkJump",
source_index: 11,
duration_seconds: 0.8333333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:12:wave",
label: "Wave",
source_index: 12,
duration_seconds: 1.8333334,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:13:yes",
label: "Yes",
source_index: 13,
duration_seconds: 1.6666666,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
],
diagnostics: [],
)
@@ -0,0 +1,236 @@
(
schema_version: 3,
asset_id: "3f63f359-45eb-4cb2-8970-71921cbd7bd0",
label: "robot_expressive",
default_animation_clip_id: Some("animation:clip:8:standing"),
source: (
path: "assets/models/robot_expressive.glb",
format: "glb",
fingerprint: (
byte_len: 463988,
modified_unix_secs: 1783750957,
content_hash: "5869cb813e6a6093eda7af2824a9c13a582750e0443e88ce7c991a1f83415521",
),
dependencies: [],
),
runtime_supported: true,
skeletons: [
(
id: "animation:skeleton:0:skeleton_0",
label: "Skeleton 0",
source_index: 0,
signature: ("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b"),
joint_paths: [
"RootNode/RobotArmature/Bone",
"RootNode/RobotArmature/Bone/Foot.L",
"RootNode/RobotArmature/Bone/Body",
"RootNode/RobotArmature/Bone/Body/Hips",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck/Head",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L/Middle1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L/Middle1.L/Middle2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Thumb.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Thumb.L/Thumb2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L/Index.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L/Index.L/Index2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L/Ring1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L/Ring1.L/Ring2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R/Middle1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R/Middle1.R/Middle2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Thumb.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Thumb.R/Thumb2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R/Index.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R/Index.R/Index2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R/Ring1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R/Ring1.R/Ring2.R",
"RootNode/RobotArmature/Bone/Body/UpperLeg.L",
"RootNode/RobotArmature/Bone/Body/UpperLeg.L/LowerLeg.L",
"RootNode/RobotArmature/Bone/Body/UpperLeg.R",
"RootNode/RobotArmature/Bone/Body/UpperLeg.R/LowerLeg.R",
"RootNode/RobotArmature/Bone/PoleTarget.L",
"RootNode/RobotArmature/Bone/Foot.R",
"RootNode/RobotArmature/Bone/PoleTarget.R",
],
),
(
id: "animation:skeleton:1:skeleton_1",
label: "Skeleton 1",
source_index: 1,
signature: ("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b"),
joint_paths: [
"RootNode/RobotArmature/Bone",
"RootNode/RobotArmature/Bone/Foot.L",
"RootNode/RobotArmature/Bone/Body",
"RootNode/RobotArmature/Bone/Body/Hips",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck/Head",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L/Middle1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm2.L/Middle1.L/Middle2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Thumb.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Thumb.L/Thumb2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L/Index.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm1.L/Index.L/Index2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L/Ring1.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/LowerArm.L/Palm3.L/Ring1.L/Ring2.L",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R/Middle1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm2.R/Middle1.R/Middle2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Thumb.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Thumb.R/Thumb2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R/Index.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm1.R/Index.R/Index2.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R/Ring1.R",
"RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/LowerArm.R/Palm3.R/Ring1.R/Ring2.R",
"RootNode/RobotArmature/Bone/Body/UpperLeg.L",
"RootNode/RobotArmature/Bone/Body/UpperLeg.L/LowerLeg.L",
"RootNode/RobotArmature/Bone/Body/UpperLeg.R",
"RootNode/RobotArmature/Bone/Body/UpperLeg.R/LowerLeg.R",
"RootNode/RobotArmature/Bone/PoleTarget.L",
"RootNode/RobotArmature/Bone/Foot.R",
"RootNode/RobotArmature/Bone/PoleTarget.R",
],
),
],
clips: [
(
id: "animation:clip:0:dance",
label: "Dance",
source_index: 0,
duration_seconds: 3.3333333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:1:death",
label: "Death",
source_index: 1,
duration_seconds: 0.9583333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:2:idle",
label: "Idle",
source_index: 2,
duration_seconds: 3.3333333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:3:jump",
label: "Jump",
source_index: 3,
duration_seconds: 0.7083333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:4:no",
label: "No",
source_index: 4,
duration_seconds: 1.6666666,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:5:punch",
label: "Punch",
source_index: 5,
duration_seconds: 0.8333333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:6:running",
label: "Running",
source_index: 6,
duration_seconds: 0.9583333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:7:sitting",
label: "Sitting",
source_index: 7,
duration_seconds: 0.41666666,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:8:standing",
label: "Standing",
source_index: 8,
duration_seconds: 0.41666666,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:9:thumbsup",
label: "ThumbsUp",
source_index: 9,
duration_seconds: 1.5833334,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:10:walking",
label: "Walking",
source_index: 10,
duration_seconds: 0.9583333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:11:walkjump",
label: "WalkJump",
source_index: 11,
duration_seconds: 0.8333333,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:12:wave",
label: "Wave",
source_index: 12,
duration_seconds: 1.8333334,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
(
id: "animation:clip:13:yes",
label: "Yes",
source_index: 13,
duration_seconds: 1.6666666,
target_skeleton_signature: Some(("e9761f2a198d6a280afd0fc2aca6e8783dc6237bd85c90b8bc07a2e11271dc2b")),
events: [],
),
],
diagnostics: [],
)
@@ -0,0 +1,20 @@
(
schema_version: 3,
asset_id: "b98ef565-3500-49e7-9935-f685fa9b2594",
label: "painted_wooden_chair_02_2k",
default_animation_clip_id: None,
source: (
path: "assets/models/painted_wooden_chair_02_2k.fbx",
format: "fbx",
fingerprint: (
byte_len: 59964,
modified_unix_secs: 1780713434,
content_hash: "b12973a62dcb44589e380ea833eade726ae98a86c81084c842ee3801866d6a46",
),
dependencies: [],
),
runtime_supported: false,
skeletons: [],
clips: [],
diagnostics: [],
)
Binary file not shown.
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
(
version: 1,
name: "Development",
cargo_profile: Development,
target: None,
features: [],
rendering_tier: "development",
default_scene: Some("assets/levels/editor_scene.scn.ron"),
output_dir: "dist/development",
)
+10
View File
@@ -0,0 +1,10 @@
(
version: 1,
name: "QA",
cargo_profile: Qa,
target: None,
features: [],
rendering_tier: "representative",
default_scene: Some("assets/levels/editor_scene.scn.ron"),
output_dir: "dist/qa",
)
+10
View File
@@ -0,0 +1,10 @@
(
version: 1,
name: "Release",
cargo_profile: Release,
target: None,
features: [],
rendering_tier: "shipping",
default_scene: Some("assets/levels/editor_scene.scn.ron"),
output_dir: "dist/release",
)
@@ -0,0 +1,52 @@
(schema_version: 4,resources: {
},
entities: {
4294969001: (components: {
"bevy_ecs::name::Name": "Audition Tone Source",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 1.5, -4.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("audio-showcase-source"),
"shared::components::ActorKind": AudioSource,
"shared::components::AudioSourceDesc": (
clip: Some((
asset_id: "c0a7d10e-53c1-4de0-b0dc-34a66f44ba77",
sub_asset_id: "audio:source",
label: "Editor Audition Tone",
source_path: Some("assets/audio/editor_audition_tone.ogg"),
)),
gain_db: -6.0,
pitch: 1.0,
looping: false,
autoplay: true,
spatial_blend: 1.0,
attenuation: (
min_distance: 1.0,
max_distance: 18.0,
rolloff: Inverse,
rolloff_factor: 1.0,
),
bus: "sfx",
),
"shared::components::LevelObject": (),
}),
4294969002: (components: {
"bevy_ecs::name::Name": "Showcase Listener",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 1.7, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("audio-showcase-listener"),
"shared::components::ActorKind": AudioListener,
"shared::components::AudioListenerDesc": (
enabled: true,
priority: 100,
ear_gap: 0.2,
),
"shared::components::LevelObject": (),
}),
},
)
@@ -0,0 +1,175 @@
(schema_version: 4, resources: {}, entities: {
1: (components: {
"bevy_ecs::name::Name": "Valid Box Collider",
"bevy_transform::components::transform::Transform": (
translation: (-4.5, 1.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("collider-showcase-box"),
"shared::components::ActorKind": StaticMesh,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (0),
"shared::components::LevelObject": (),
"shared::components::MaterialDesc": (
shader: (kind: StandardLit, schema_path: None, shader_path: None),
base_color: (r: 0.18, g: 0.62, b: 0.36, a: 1.0),
metallic: 0.05, roughness: 0.55,
emissive_color: (r: 1.0, g: 1.0, b: 1.0, a: 1.0), emissive_intensity: 0.0,
base_color_texture: None, emissive_texture: None, normal_map_texture: None,
metallic_roughness_texture: None, material_asset_path: None, parameters: [], textures: [],
),
"shared::components::Primitive": (shape: Box, size: (1.8, 2.0, 1.8)),
"shared::components::RigidBodyDesc": (body: Static),
"shared::components::ColliderDesc": (
enabled: true, is_trigger: false,
shape: Cuboid(x_length: 1.8, y_length: 2.0, z_length: 1.8),
),
}),
2: (components: {
"bevy_ecs::name::Name": "Valid Sphere Collider",
"bevy_transform::components::transform::Transform": (
translation: (-2.25, 1.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.35, 0.8),
),
"shared::components::ActorId": ("collider-showcase-sphere"),
"shared::components::ActorKind": StaticMesh,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (1),
"shared::components::LevelObject": (),
"shared::components::MaterialDesc": (
shader: (kind: StandardLit, schema_path: None, shader_path: None),
base_color: (r: 0.16, g: 0.52, b: 0.78, a: 1.0),
metallic: 0.08, roughness: 0.42,
emissive_color: (r: 1.0, g: 1.0, b: 1.0, a: 1.0), emissive_intensity: 0.0,
base_color_texture: None, emissive_texture: None, normal_map_texture: None,
metallic_roughness_texture: None, material_asset_path: None, parameters: [], textures: [],
),
"shared::components::Primitive": (shape: Sphere, size: (2.0, 2.0, 2.0)),
"shared::components::RigidBodyDesc": (body: Static),
"shared::components::ColliderDesc": (
enabled: true, is_trigger: false, shape: Sphere(radius: 1.0),
),
}),
3: (components: {
"bevy_ecs::name::Name": "Valid Capsule Collider",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 1.4, 0.0),
rotation: (0.0, 0.1950903, 0.0, 0.9807853),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("collider-showcase-capsule"),
"shared::components::ActorKind": StaticMesh,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (2),
"shared::components::LevelObject": (),
"shared::components::MaterialDesc": (
shader: (kind: StandardLit, schema_path: None, shader_path: None),
base_color: (r: 0.58, g: 0.34, b: 0.78, a: 1.0),
metallic: 0.06, roughness: 0.48,
emissive_color: (r: 1.0, g: 1.0, b: 1.0, a: 1.0), emissive_intensity: 0.0,
base_color_texture: None, emissive_texture: None, normal_map_texture: None,
metallic_roughness_texture: None, material_asset_path: None, parameters: [], textures: [],
),
"shared::components::Primitive": (shape: Box, size: (1.4, 2.8, 1.4)),
"shared::components::RigidBodyDesc": (body: Static),
"shared::components::ColliderDesc": (
enabled: true, is_trigger: false, shape: Capsule(radius: 0.7, height: 2.8),
),
}),
4: (components: {
"bevy_ecs::name::Name": "Trigger Collider",
"bevy_transform::components::transform::Transform": (
translation: (2.25, 1.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("collider-showcase-trigger"),
"shared::components::ActorKind": StaticMesh,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (3),
"shared::components::LevelObject": (),
"shared::components::MaterialDesc": (
shader: (kind: StandardLit, schema_path: None, shader_path: None),
base_color: (r: 0.12, g: 0.68, b: 0.82, a: 1.0),
metallic: 0.03, roughness: 0.4,
emissive_color: (r: 1.0, g: 1.0, b: 1.0, a: 1.0), emissive_intensity: 0.0,
base_color_texture: None, emissive_texture: None, normal_map_texture: None,
metallic_roughness_texture: None, material_asset_path: None, parameters: [], textures: [],
),
"shared::components::Primitive": (shape: Sphere, size: (2.0, 2.0, 2.0)),
"shared::components::RigidBodyDesc": (body: Static),
"shared::components::ColliderDesc": (
enabled: true, is_trigger: true, shape: Sphere(radius: 1.0),
),
}),
5: (components: {
"bevy_ecs::name::Name": "Disabled Collider",
"bevy_transform::components::transform::Transform": (
translation: (4.5, 1.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("collider-showcase-disabled"),
"shared::components::ActorKind": StaticMesh,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (4),
"shared::components::LevelObject": (),
"shared::components::MaterialDesc": (
shader: (kind: StandardLit, schema_path: None, shader_path: None),
base_color: (r: 0.38, g: 0.40, b: 0.46, a: 1.0),
metallic: 0.02, roughness: 0.68,
emissive_color: (r: 1.0, g: 1.0, b: 1.0, a: 1.0), emissive_intensity: 0.0,
base_color_texture: None, emissive_texture: None, normal_map_texture: None,
metallic_roughness_texture: None, material_asset_path: None, parameters: [], textures: [],
),
"shared::components::Primitive": (shape: Box, size: (1.8, 2.0, 1.8)),
"shared::components::RigidBodyDesc": (body: Static),
"shared::components::ColliderDesc": (
enabled: false, is_trigger: false,
shape: Cuboid(x_length: 1.8, y_length: 2.0, z_length: 1.8),
),
}),
6: (components: {
"bevy_ecs::name::Name": "Missing Collider",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 1.0, -3.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("collider-showcase-missing"),
"shared::components::ActorKind": StaticMesh,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (5),
"shared::components::LevelObject": (),
"shared::components::MaterialDesc": (
shader: (kind: StandardLit, schema_path: None, shader_path: None),
base_color: (r: 0.78, g: 0.16, b: 0.20, a: 1.0),
metallic: 0.02, roughness: 0.58,
emissive_color: (r: 1.0, g: 1.0, b: 1.0, a: 1.0), emissive_intensity: 0.0,
base_color_texture: None, emissive_texture: None, normal_map_texture: None,
metallic_roughness_texture: None, material_asset_path: None, parameters: [], textures: [],
),
"shared::components::Primitive": (shape: Box, size: (1.8, 2.0, 1.8)),
"shared::components::RigidBodyDesc": (body: Static),
}),
7: (components: {
"bevy_ecs::name::Name": "Collider Showcase Sun",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 8.0, 4.0),
rotation: (-0.3826834, 0.0, 0.0, 0.9238795),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("collider-showcase-sun"),
"shared::components::ActorKind": Light,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (6),
"shared::components::LevelObject": (),
"shared::components::LightDesc": (
kind: Directional, color: (r: 1.0, g: 0.95, b: 0.88, a: 1.0),
intensity: 100000.0, range: 0.0, shadows: true,
inner_angle_deg: 25.0, outer_angle_deg: 35.0,
),
}),
})
+60 -118
View File
@@ -1,8 +1,7 @@
(schema_version: 2, (schema_version: 4,resources: {
resources: {}, },
entities: { entities: {
4294967126: ( 4294967126: (components: {
components: {
"bevy_ecs::name::Name": "Pillar Copy", "bevy_ecs::name::Name": "Pillar Copy",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (3.7178926, 3.5, -11.932255), translation: (3.7178926, 3.5, -11.932255),
@@ -41,10 +40,8 @@
shape: Box, shape: Box,
size: (1.2, 7.0, 1.2), size: (1.2, 7.0, 1.2),
), ),
}, }),
), 4294967158: (components: {
4294967158: (
components: {
"bevy_ecs::name::Name": "Scene Sun", "bevy_ecs::name::Name": "Scene Sun",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (0.0, 5.316672, 0.0), translation: (0.0, 5.316672, 0.0),
@@ -71,10 +68,8 @@
inner_angle_deg: 25.0, inner_angle_deg: 25.0,
outer_angle_deg: 35.0, outer_angle_deg: 35.0,
), ),
}, }),
), 4294967159: (components: {
4294967159: (
components: {
"bevy_ecs::name::Name": "Ground", "bevy_ecs::name::Name": "Ground",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (0.0, -0.5, 0.0), translation: (0.0, -0.5, 0.0),
@@ -113,10 +108,8 @@
shape: Box, shape: Box,
size: (200.0, 1.0, 200.0), size: (200.0, 1.0, 200.0),
), ),
}, }),
), 8589934420: (components: {
8589934420: (
components: {
"bevy_ecs::name::Name": "Pillar Copy", "bevy_ecs::name::Name": "Pillar Copy",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-12.079595, 3.5, -13.098544), translation: (-12.079595, 3.5, -13.098544),
@@ -155,10 +148,8 @@
shape: Box, shape: Box,
size: (1.2, 7.0, 1.2), size: (1.2, 7.0, 1.2),
), ),
}, }),
), 8589934456: (components: {
8589934456: (
components: {
"bevy_ecs::name::Name": "Player Start", "bevy_ecs::name::Name": "Player Start",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (0.0, 0.9900649, 12.46175), translation: (0.0, 0.9900649, 12.46175),
@@ -172,10 +163,8 @@
"shared::components::HierarchySiblingIndex": (2), "shared::components::HierarchySiblingIndex": (2),
"shared::components::LevelObject": (), "shared::components::LevelObject": (),
"shared::components::PlayerSpawn": (), "shared::components::PlayerSpawn": (),
}, }),
), 8589934457: (components: {
8589934457: (
components: {
"bevy_ecs::name::Name": "ShowcaseSphere", "bevy_ecs::name::Name": "ShowcaseSphere",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-1.3999996, 0.6, 4.0), translation: (-1.3999996, 0.6, 4.0),
@@ -212,10 +201,8 @@
shape: Sphere, shape: Sphere,
size: (1.2, 1.2, 1.2), size: (1.2, 1.2, 1.2),
), ),
}, }),
), 8589934458: (components: {
8589934458: (
components: {
"bevy_ecs::name::Name": "ShowcaseSphere", "bevy_ecs::name::Name": "ShowcaseSphere",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-3.6, 0.6, 4.0), translation: (-3.6, 0.6, 4.0),
@@ -252,10 +239,8 @@
shape: Sphere, shape: Sphere,
size: (1.2, 1.2, 1.2), size: (1.2, 1.2, 1.2),
), ),
}, }),
), 8589934459: (components: {
8589934459: (
components: {
"bevy_ecs::name::Name": "ShowcaseSphere", "bevy_ecs::name::Name": "ShowcaseSphere",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-5.8, 0.6, 4.0), translation: (-5.8, 0.6, 4.0),
@@ -292,10 +277,8 @@
shape: Sphere, shape: Sphere,
size: (1.2, 1.2, 1.2), size: (1.2, 1.2, 1.2),
), ),
}, }),
), 8589934460: (components: {
8589934460: (
components: {
"bevy_ecs::name::Name": "ShowcaseSphere", "bevy_ecs::name::Name": "ShowcaseSphere",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-8.0, 0.6, 4.0), translation: (-8.0, 0.6, 4.0),
@@ -332,10 +315,8 @@
shape: Sphere, shape: Sphere,
size: (1.2, 1.2, 1.2), size: (1.2, 1.2, 1.2),
), ),
}, }),
), 8589934461: (components: {
8589934461: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.90000004, 9.5), translation: (12.0, 0.90000004, 9.5),
@@ -374,10 +355,8 @@
shape: Box, shape: Box,
size: (5.0, 1.8000001, 0.5), size: (5.0, 1.8000001, 0.5),
), ),
}, }),
), 8589934462: (components: {
8589934462: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.81000006, 10.0), translation: (12.0, 0.81000006, 10.0),
@@ -416,10 +395,8 @@
shape: Box, shape: Box,
size: (5.0, 1.6200001, 0.5), size: (5.0, 1.6200001, 0.5),
), ),
}, }),
), 8589934463: (components: {
8589934463: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.72, 10.5), translation: (12.0, 0.72, 10.5),
@@ -458,10 +435,8 @@
shape: Box, shape: Box,
size: (5.0, 1.44, 0.5), size: (5.0, 1.44, 0.5),
), ),
}, }),
), 8589934464: (components: {
8589934464: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.63, 11.0), translation: (12.0, 0.63, 11.0),
@@ -500,10 +475,8 @@
shape: Box, shape: Box,
size: (5.0, 1.26, 0.5), size: (5.0, 1.26, 0.5),
), ),
}, }),
), 8589934465: (components: {
8589934465: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.54, 11.5), translation: (12.0, 0.54, 11.5),
@@ -542,10 +515,8 @@
shape: Box, shape: Box,
size: (5.0, 1.08, 0.5), size: (5.0, 1.08, 0.5),
), ),
}, }),
), 8589934466: (components: {
8589934466: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.45000002, 12.0), translation: (12.0, 0.45000002, 12.0),
@@ -584,10 +555,8 @@
shape: Box, shape: Box,
size: (5.0, 0.90000004, 0.5), size: (5.0, 0.90000004, 0.5),
), ),
}, }),
), 8589934467: (components: {
8589934467: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.36, 12.5), translation: (12.0, 0.36, 12.5),
@@ -626,10 +595,8 @@
shape: Box, shape: Box,
size: (5.0, 0.72, 0.5), size: (5.0, 0.72, 0.5),
), ),
}, }),
), 8589934468: (components: {
8589934468: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.27, 13.0), translation: (12.0, 0.27, 13.0),
@@ -668,10 +635,8 @@
shape: Box, shape: Box,
size: (5.0, 0.54, 0.5), size: (5.0, 0.54, 0.5),
), ),
}, }),
), 8589934469: (components: {
8589934469: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.18, 13.5), translation: (12.0, 0.18, 13.5),
@@ -710,10 +675,8 @@
shape: Box, shape: Box,
size: (5.0, 0.36, 0.5), size: (5.0, 0.36, 0.5),
), ),
}, }),
), 8589934470: (components: {
8589934470: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.09, 14.0), translation: (12.0, 0.09, 14.0),
@@ -752,10 +715,8 @@
shape: Box, shape: Box,
size: (5.0, 0.18, 0.5), size: (5.0, 0.18, 0.5),
), ),
}, }),
), 8589934471: (components: {
8589934471: (
components: {
"bevy_ecs::name::Name": "Ramp", "bevy_ecs::name::Name": "Ramp",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-14.0, 1.6, 0.0), translation: (-14.0, 1.6, 0.0),
@@ -794,10 +755,8 @@
shape: Box, shape: Box,
size: (5.0, 0.4, 9.0), size: (5.0, 0.4, 9.0),
), ),
}, }),
), 8589934472: (components: {
8589934472: (
components: {
"bevy_ecs::name::Name": "Crate", "bevy_ecs::name::Name": "Crate",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (5.4, 0.5, 2.4), translation: (5.4, 0.5, 2.4),
@@ -836,10 +795,8 @@
shape: Box, shape: Box,
size: (1.0, 1.0, 1.0), size: (1.0, 1.0, 1.0),
), ),
}, }),
), 8589934473: (components: {
8589934473: (
components: {
"bevy_ecs::name::Name": "Crate", "bevy_ecs::name::Name": "Crate",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (4.0, 0.75, 2.0), translation: (4.0, 0.75, 2.0),
@@ -878,10 +835,8 @@
shape: Box, shape: Box,
size: (1.5, 1.5, 1.5), size: (1.5, 1.5, 1.5),
), ),
}, }),
), 8589934474: (components: {
8589934474: (
components: {
"bevy_ecs::name::Name": "Crate", "bevy_ecs::name::Name": "Crate",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-2.3, 0.5, -3.1), translation: (-2.3, 0.5, -3.1),
@@ -920,10 +875,8 @@
shape: Box, shape: Box,
size: (1.0, 1.0, 1.0), size: (1.0, 1.0, 1.0),
), ),
}, }),
), 8589934475: (components: {
8589934475: (
components: {
"bevy_ecs::name::Name": "Crate", "bevy_ecs::name::Name": "Crate",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-1.6, 0.5, -3.2), translation: (-1.6, 0.5, -3.2),
@@ -962,10 +915,8 @@
shape: Box, shape: Box,
size: (1.0, 1.0, 1.0), size: (1.0, 1.0, 1.0),
), ),
}, }),
), 8589934476: (components: {
8589934476: (
components: {
"bevy_ecs::name::Name": "Crate", "bevy_ecs::name::Name": "Crate",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-3.0, 0.5, -3.0), translation: (-3.0, 0.5, -3.0),
@@ -1004,10 +955,8 @@
shape: Box, shape: Box,
size: (1.0, 1.0, 1.0), size: (1.0, 1.0, 1.0),
), ),
}, }),
), 8589934477: (components: {
8589934477: (
components: {
"bevy_ecs::name::Name": "Pillar", "bevy_ecs::name::Name": "Pillar",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (8.0, 3.5, 6.0), translation: (8.0, 3.5, 6.0),
@@ -1046,10 +995,8 @@
shape: Box, shape: Box,
size: (1.2, 7.0, 1.2), size: (1.2, 7.0, 1.2),
), ),
}, }),
), 8589934478: (components: {
8589934478: (
components: {
"bevy_ecs::name::Name": "Pillar", "bevy_ecs::name::Name": "Pillar",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-8.0, 3.5, 6.0), translation: (-8.0, 3.5, 6.0),
@@ -1088,10 +1035,8 @@
shape: Box, shape: Box,
size: (1.2, 7.0, 1.2), size: (1.2, 7.0, 1.2),
), ),
}, }),
), 8589934479: (components: {
8589934479: (
components: {
"bevy_ecs::name::Name": "Pillar", "bevy_ecs::name::Name": "Pillar",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (8.0, 3.5, -6.0), translation: (8.0, 3.5, -6.0),
@@ -1130,10 +1075,8 @@
shape: Box, shape: Box,
size: (1.2, 7.0, 1.2), size: (1.2, 7.0, 1.2),
), ),
}, }),
), 8589934480: (components: {
8589934480: (
components: {
"bevy_ecs::name::Name": "Pillar", "bevy_ecs::name::Name": "Pillar",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-8.0, 3.5, -6.0), translation: (-8.0, 3.5, -6.0),
@@ -1172,7 +1115,6 @@
shape: Box, shape: Box,
size: (1.2, 7.0, 1.2), size: (1.2, 7.0, 1.2),
), ),
}, }),
),
}, },
) )
+66 -130
View File
@@ -1,8 +1,7 @@
(schema_version: 2, (schema_version: 4,resources: {
resources: {}, },
entities: { entities: {
4294967124: ( 4294967124: (components: {
components: {
"bevy_ecs::name::Name": "Cube", "bevy_ecs::name::Name": "Cube",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-14.0, 0.66941494, -1.9732417), translation: (-14.0, 0.66941494, -1.9732417),
@@ -49,10 +48,8 @@
shape: Box, shape: Box,
size: (1.0, 1.0, 1.0), size: (1.0, 1.0, 1.0),
), ),
}, }),
), 4294967126: (components: {
4294967126: (
components: {
"bevy_ecs::name::Name": "Cube", "bevy_ecs::name::Name": "Cube",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-13.0, 0.5, 2.0), translation: (-13.0, 0.5, 2.0),
@@ -99,10 +96,8 @@
shape: Box, shape: Box,
size: (1.0, 1.0, 1.0), size: (1.0, 1.0, 1.0),
), ),
}, }),
), 4294967128: (components: {
4294967128: (
components: {
"bevy_ecs::name::Name": "Point Light", "bevy_ecs::name::Name": "Point Light",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-10.83656, 1.680895, -1.0713063), translation: (-10.83656, 1.680895, -1.0713063),
@@ -129,10 +124,8 @@
inner_angle_deg: 25.0, inner_angle_deg: 25.0,
outer_angle_deg: 35.0, outer_angle_deg: 35.0,
), ),
}, }),
), 4294967158: (components: {
4294967158: (
components: {
"bevy_ecs::name::Name": "Scene Sun", "bevy_ecs::name::Name": "Scene Sun",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (0.0, 5.316672, 0.0), translation: (0.0, 5.316672, 0.0),
@@ -159,10 +152,8 @@
inner_angle_deg: 25.0, inner_angle_deg: 25.0,
outer_angle_deg: 35.0, outer_angle_deg: 35.0,
), ),
}, }),
), 4294967159: (components: {
4294967159: (
components: {
"bevy_ecs::name::Name": "Ground", "bevy_ecs::name::Name": "Ground",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (0.0, -0.5, 0.0), translation: (0.0, -0.5, 0.0),
@@ -209,10 +200,8 @@
shape: Box, shape: Box,
size: (200.0, 1.0, 200.0), size: (200.0, 1.0, 200.0),
), ),
}, }),
), 8589934417: (components: {
8589934417: (
components: {
"bevy_ecs::name::Name": "Spot Light", "bevy_ecs::name::Name": "Spot Light",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-13.387727, 0.9319196, -5.454666), translation: (-13.387727, 0.9319196, -5.454666),
@@ -239,10 +228,8 @@
inner_angle_deg: 25.0, inner_angle_deg: 25.0,
outer_angle_deg: 35.0, outer_angle_deg: 35.0,
), ),
}, }),
), 8589934456: (components: {
8589934456: (
components: {
"bevy_ecs::name::Name": "Player Start", "bevy_ecs::name::Name": "Player Start",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (0.0, 0.9900649, 12.46175), translation: (0.0, 0.9900649, 12.46175),
@@ -256,10 +243,8 @@
"shared::components::HierarchySiblingIndex": (2), "shared::components::HierarchySiblingIndex": (2),
"shared::components::LevelObject": (), "shared::components::LevelObject": (),
"shared::components::PlayerSpawn": (), "shared::components::PlayerSpawn": (),
}, }),
), 8589934457: (components: {
8589934457: (
components: {
"bevy_ecs::name::Name": "ShowcaseSphere", "bevy_ecs::name::Name": "ShowcaseSphere",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-1.3999996, 0.6, 4.0), translation: (-1.3999996, 0.6, 4.0),
@@ -304,10 +289,8 @@
shape: Sphere, shape: Sphere,
size: (1.2, 1.2, 1.2), size: (1.2, 1.2, 1.2),
), ),
}, }),
), 8589934458: (components: {
8589934458: (
components: {
"bevy_ecs::name::Name": "ShowcaseSphere", "bevy_ecs::name::Name": "ShowcaseSphere",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-3.6, 0.6, 4.0), translation: (-3.6, 0.6, 4.0),
@@ -352,10 +335,8 @@
shape: Sphere, shape: Sphere,
size: (1.2, 1.2, 1.2), size: (1.2, 1.2, 1.2),
), ),
}, }),
), 8589934459: (components: {
8589934459: (
components: {
"bevy_ecs::name::Name": "ShowcaseSphere", "bevy_ecs::name::Name": "ShowcaseSphere",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-5.8, 0.6, 4.0), translation: (-5.8, 0.6, 4.0),
@@ -400,10 +381,8 @@
shape: Sphere, shape: Sphere,
size: (1.2, 1.2, 1.2), size: (1.2, 1.2, 1.2),
), ),
}, }),
), 8589934460: (components: {
8589934460: (
components: {
"bevy_ecs::name::Name": "ShowcaseSphere", "bevy_ecs::name::Name": "ShowcaseSphere",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-8.0, 0.6, 4.0), translation: (-8.0, 0.6, 4.0),
@@ -448,10 +427,8 @@
shape: Sphere, shape: Sphere,
size: (1.2, 1.2, 1.2), size: (1.2, 1.2, 1.2),
), ),
}, }),
), 8589934461: (components: {
8589934461: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.90000004, 9.5), translation: (12.0, 0.90000004, 9.5),
@@ -498,10 +475,8 @@
shape: Box, shape: Box,
size: (5.0, 1.8000001, 0.5), size: (5.0, 1.8000001, 0.5),
), ),
}, }),
), 8589934462: (components: {
8589934462: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.81000006, 10.0), translation: (12.0, 0.81000006, 10.0),
@@ -548,10 +523,8 @@
shape: Box, shape: Box,
size: (5.0, 1.6200001, 0.5), size: (5.0, 1.6200001, 0.5),
), ),
}, }),
), 8589934463: (components: {
8589934463: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.72, 10.5), translation: (12.0, 0.72, 10.5),
@@ -598,10 +571,8 @@
shape: Box, shape: Box,
size: (5.0, 1.44, 0.5), size: (5.0, 1.44, 0.5),
), ),
}, }),
), 8589934464: (components: {
8589934464: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.63, 11.0), translation: (12.0, 0.63, 11.0),
@@ -648,10 +619,8 @@
shape: Box, shape: Box,
size: (5.0, 1.26, 0.5), size: (5.0, 1.26, 0.5),
), ),
}, }),
), 8589934465: (components: {
8589934465: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.54, 11.5), translation: (12.0, 0.54, 11.5),
@@ -698,10 +667,8 @@
shape: Box, shape: Box,
size: (5.0, 1.08, 0.5), size: (5.0, 1.08, 0.5),
), ),
}, }),
), 8589934466: (components: {
8589934466: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.45000002, 12.0), translation: (12.0, 0.45000002, 12.0),
@@ -748,10 +715,8 @@
shape: Box, shape: Box,
size: (5.0, 0.90000004, 0.5), size: (5.0, 0.90000004, 0.5),
), ),
}, }),
), 8589934467: (components: {
8589934467: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.36, 12.5), translation: (12.0, 0.36, 12.5),
@@ -798,10 +763,8 @@
shape: Box, shape: Box,
size: (5.0, 0.72, 0.5), size: (5.0, 0.72, 0.5),
), ),
}, }),
), 8589934468: (components: {
8589934468: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.27, 13.0), translation: (12.0, 0.27, 13.0),
@@ -848,10 +811,8 @@
shape: Box, shape: Box,
size: (5.0, 0.54, 0.5), size: (5.0, 0.54, 0.5),
), ),
}, }),
), 8589934469: (components: {
8589934469: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.18, 13.5), translation: (12.0, 0.18, 13.5),
@@ -898,10 +859,8 @@
shape: Box, shape: Box,
size: (5.0, 0.36, 0.5), size: (5.0, 0.36, 0.5),
), ),
}, }),
), 8589934470: (components: {
8589934470: (
components: {
"bevy_ecs::name::Name": "Stair", "bevy_ecs::name::Name": "Stair",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (12.0, 0.09, 14.0), translation: (12.0, 0.09, 14.0),
@@ -948,10 +907,8 @@
shape: Box, shape: Box,
size: (5.0, 0.18, 0.5), size: (5.0, 0.18, 0.5),
), ),
}, }),
), 8589934471: (components: {
8589934471: (
components: {
"bevy_ecs::name::Name": "Ramp", "bevy_ecs::name::Name": "Ramp",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-14.0, 2.292737, 0.0), translation: (-14.0, 2.292737, 0.0),
@@ -998,10 +955,8 @@
shape: Box, shape: Box,
size: (5.0, 0.4, 9.0), size: (5.0, 0.4, 9.0),
), ),
}, }),
), 8589934472: (components: {
8589934472: (
components: {
"bevy_ecs::name::Name": "Crate", "bevy_ecs::name::Name": "Crate",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (5.4, 0.5, 2.4), translation: (5.4, 0.5, 2.4),
@@ -1048,10 +1003,8 @@
shape: Box, shape: Box,
size: (1.0, 1.0, 1.0), size: (1.0, 1.0, 1.0),
), ),
}, }),
), 8589934473: (components: {
8589934473: (
components: {
"bevy_ecs::name::Name": "Crate", "bevy_ecs::name::Name": "Crate",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (4.0, 0.75, 2.0), translation: (4.0, 0.75, 2.0),
@@ -1098,10 +1051,8 @@
shape: Box, shape: Box,
size: (1.5, 1.5, 1.5), size: (1.5, 1.5, 1.5),
), ),
}, }),
), 8589934474: (components: {
8589934474: (
components: {
"bevy_ecs::name::Name": "Crate", "bevy_ecs::name::Name": "Crate",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-2.3, 0.5, -3.1), translation: (-2.3, 0.5, -3.1),
@@ -1148,10 +1099,8 @@
shape: Box, shape: Box,
size: (1.0, 1.0, 1.0), size: (1.0, 1.0, 1.0),
), ),
}, }),
), 8589934475: (components: {
8589934475: (
components: {
"bevy_ecs::name::Name": "Crate", "bevy_ecs::name::Name": "Crate",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-1.6, 0.5, -3.2), translation: (-1.6, 0.5, -3.2),
@@ -1198,10 +1147,8 @@
shape: Box, shape: Box,
size: (1.0, 1.0, 1.0), size: (1.0, 1.0, 1.0),
), ),
}, }),
), 8589934476: (components: {
8589934476: (
components: {
"bevy_ecs::name::Name": "Crate", "bevy_ecs::name::Name": "Crate",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-3.0, 0.5, -3.0), translation: (-3.0, 0.5, -3.0),
@@ -1248,10 +1195,8 @@
shape: Box, shape: Box,
size: (1.0, 1.0, 1.0), size: (1.0, 1.0, 1.0),
), ),
}, }),
), 8589934477: (components: {
8589934477: (
components: {
"bevy_ecs::name::Name": "Pillar", "bevy_ecs::name::Name": "Pillar",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (8.0, 3.5, 6.0), translation: (8.0, 3.5, 6.0),
@@ -1298,10 +1243,8 @@
shape: Box, shape: Box,
size: (1.2, 7.0, 1.2), size: (1.2, 7.0, 1.2),
), ),
}, }),
), 8589934478: (components: {
8589934478: (
components: {
"bevy_ecs::name::Name": "Pillar", "bevy_ecs::name::Name": "Pillar",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-8.0, 3.5, 6.0), translation: (-8.0, 3.5, 6.0),
@@ -1348,10 +1291,8 @@
shape: Box, shape: Box,
size: (1.2, 7.0, 1.2), size: (1.2, 7.0, 1.2),
), ),
}, }),
), 8589934479: (components: {
8589934479: (
components: {
"bevy_ecs::name::Name": "Pillar", "bevy_ecs::name::Name": "Pillar",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (8.0, 3.5, -6.0), translation: (8.0, 3.5, -6.0),
@@ -1398,10 +1339,8 @@
shape: Box, shape: Box,
size: (1.2, 7.0, 1.2), size: (1.2, 7.0, 1.2),
), ),
}, }),
), 8589934480: (components: {
8589934480: (
components: {
"bevy_ecs::name::Name": "Pillar", "bevy_ecs::name::Name": "Pillar",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-8.0, 3.5, -6.0), translation: (-8.0, 3.5, -6.0),
@@ -1448,10 +1387,8 @@
shape: Box, shape: Box,
size: (1.2, 7.0, 1.2), size: (1.2, 7.0, 1.2),
), ),
}, }),
), 12884901711: (components: {
12884901711: (
components: {
"bevy_ecs::name::Name": "Cube", "bevy_ecs::name::Name": "Cube",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-13.391208, 0.5, -6.673126), translation: (-13.391208, 0.5, -6.673126),
@@ -1498,7 +1435,6 @@
shape: Box, shape: Box,
size: (1.0, 1.0, 1.0), size: (1.0, 1.0, 1.0),
), ),
}, }),
),
}, },
) )
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,73 @@
(schema_version: 4,resources: {
},
entities: {
1: (components: {
"bevy_ecs::name::Name": "Navigation Bounds",
"bevy_transform::components::transform::Transform": (translation: (0.0, 0.0, 0.0), rotation: (0.0, 0.0, 0.0, 1.0), scale: (1.0, 1.0, 1.0)),
"shared::components::ActorId": ("navigation-bounds-main"),
"shared::components::ActorKind": Navigation,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (0),
"shared::components::LevelObject": (),
"shared::navigation::NavigationBounds": (
half_extents: (8.0, 2.0, 8.0),
agent: (
id: "humanoid",
radius: 0.35,
height: 1.8,
max_climb: 0.45,
max_slope_deg: 45.0,
cell_size_fraction: 3.0,
cell_height_fraction: 6.0,
min_region_size: 1,
merge_region_size: 2,
),
artifact_path: "assets/navigation/generated/navigation_showcase_humanoid.nav.ron",
auto_bake: false,
validation_samples: [
(id: "around-center-obstacle", start: (-6.0, 0.0, -5.0), end: (6.0, 0.0, -5.0), enabled: true),
],
),
}),
2: (components: {
"bevy_ecs::name::Name": "Center Obstacle",
"bevy_transform::components::transform::Transform": (translation: (0.0, 0.5, 0.0), rotation: (0.0, 0.0, 0.0, 1.0), scale: (1.0, 1.0, 1.0)),
"shared::components::ActorId": ("navigation-obstacle-center"),
"shared::components::ActorKind": Navigation,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (1),
"shared::components::LevelObject": (),
"shared::navigation::NavigationObstacle": (half_extents: (1.0, 1.0, 2.5), dynamic: false),
}),
3: (components: {
"bevy_ecs::name::Name": "Slow Area",
"bevy_transform::components::transform::Transform": (translation: (-4.0, 0.5, -4.0), rotation: (0.0, 0.0, 0.0, 1.0), scale: (1.0, 1.0, 1.0)),
"shared::components::ActorId": ("navigation-area-slow"),
"shared::components::ActorKind": Navigation,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (2),
"shared::components::LevelObject": (),
"shared::navigation::NavigationArea": (id: "slow", half_extents: (1.5, 1.0, 1.5), cost: 1.5, walkable: true),
}),
4: (components: {
"bevy_ecs::name::Name": "Obstacle Link",
"bevy_transform::components::transform::Transform": (translation: (0.0, 0.0, 0.0), rotation: (0.0, 0.0, 0.0, 1.0), scale: (1.0, 1.0, 1.0)),
"shared::components::ActorId": ("navigation-link-center"),
"shared::components::ActorKind": Navigation,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (3),
"shared::components::LevelObject": (),
"shared::navigation::NavigationLink": (start: (-1.5, 0.0, 0.0), end: (1.5, 0.0, 0.0), bidirectional: true, cost: 1.2, enabled: true),
}),
5: (components: {
"bevy_ecs::name::Name": "Walkable Floor Geometry",
"bevy_transform::components::transform::Transform": (translation: (0.0, -0.25, 0.0), rotation: (0.0, 0.0, 0.0, 1.0), scale: (1.0, 1.0, 1.0)),
"shared::components::ActorId": ("navigation-floor-geometry"),
"shared::components::ActorKind": StaticMesh,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (4),
"shared::components::LevelObject": (),
"shared::components::Primitive": (shape: Box, size: (16.0, 0.5, 16.0)),
}),
},
)
@@ -0,0 +1,164 @@
(schema_version: 4, resources: {}, entities: {
1: (components: {
"bevy_ecs::name::Name": "Placement Floor",
"bevy_transform::components::transform::Transform": (
translation: (0.0, -0.25, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("physics-placement-floor"),
"shared::components::ActorKind": StaticMesh,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (0),
"shared::components::LevelObject": (),
"shared::components::MaterialDesc": (
shader: (kind: StandardLit, schema_path: None, shader_path: None),
base_color: (r: 0.12, g: 0.14, b: 0.16, a: 1.0),
metallic: 0.05,
roughness: 0.72,
emissive_color: (r: 1.0, g: 1.0, b: 1.0, a: 1.0),
emissive_intensity: 0.0,
base_color_texture: None,
emissive_texture: None,
normal_map_texture: None,
metallic_roughness_texture: None,
material_asset_path: None,
parameters: [],
textures: [],
),
"shared::components::Primitive": (shape: Box, size: (14.0, 0.5, 10.0)),
"shared::components::RigidBodyDesc": (body: Static),
"shared::components::ColliderDesc": (
enabled: true,
is_trigger: false,
shape: Cuboid(x_length: 14.0, y_length: 0.5, z_length: 10.0),
),
}),
2: (components: {
"bevy_ecs::name::Name": "Placement Prop A",
"bevy_transform::components::transform::Transform": (
translation: (-2.0, 3.0, 0.0),
rotation: (0.1305262, 0.0, 0.0, 0.9914449),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("physics-placement-prop-a"),
"shared::components::ActorKind": StaticMesh,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (1),
"shared::components::LevelObject": (),
"shared::components::MaterialDesc": (
shader: (kind: StandardLit, schema_path: None, shader_path: None),
base_color: (r: 0.88, g: 0.48, b: 0.12, a: 1.0),
metallic: 0.1,
roughness: 0.42,
emissive_color: (r: 1.0, g: 1.0, b: 1.0, a: 1.0),
emissive_intensity: 0.0,
base_color_texture: None,
emissive_texture: None,
normal_map_texture: None,
metallic_roughness_texture: None,
material_asset_path: None,
parameters: [],
textures: [],
),
"shared::components::Primitive": (shape: Box, size: (1.2, 1.2, 1.2)),
"shared::components::RigidBodyDesc": (body: Static),
"shared::components::ColliderDesc": (
enabled: true,
is_trigger: false,
shape: Cuboid(x_length: 1.2, y_length: 1.2, z_length: 1.2),
),
}),
3: (components: {
"bevy_ecs::name::Name": "Placement Prop B",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 5.0, 0.0),
rotation: (0.0, 0.2164396, 0.0, 0.976296),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("physics-placement-prop-b"),
"shared::components::ActorKind": StaticMesh,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (2),
"shared::components::LevelObject": (),
"shared::components::MaterialDesc": (
shader: (kind: StandardLit, schema_path: None, shader_path: None),
base_color: (r: 0.10, g: 0.58, b: 0.72, a: 1.0),
metallic: 0.15,
roughness: 0.35,
emissive_color: (r: 1.0, g: 1.0, b: 1.0, a: 1.0),
emissive_intensity: 0.0,
base_color_texture: None,
emissive_texture: None,
normal_map_texture: None,
metallic_roughness_texture: None,
material_asset_path: None,
parameters: [],
textures: [],
),
"shared::components::Primitive": (shape: Box, size: (1.0, 1.6, 1.0)),
"shared::components::RigidBodyDesc": (body: Static),
"shared::components::ColliderDesc": (
enabled: true,
is_trigger: false,
shape: Cuboid(x_length: 1.0, y_length: 1.6, z_length: 1.0),
),
}),
4: (components: {
"bevy_ecs::name::Name": "Placement Prop C",
"bevy_transform::components::transform::Transform": (
translation: (2.0, 7.0, 0.0),
rotation: (0.092296, 0.092296, -0.008077, 0.991405),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("physics-placement-prop-c"),
"shared::components::ActorKind": StaticMesh,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (3),
"shared::components::LevelObject": (),
"shared::components::MaterialDesc": (
shader: (kind: StandardLit, schema_path: None, shader_path: None),
base_color: (r: 0.62, g: 0.24, b: 0.56, a: 1.0),
metallic: 0.08,
roughness: 0.5,
emissive_color: (r: 1.0, g: 1.0, b: 1.0, a: 1.0),
emissive_intensity: 0.0,
base_color_texture: None,
emissive_texture: None,
normal_map_texture: None,
metallic_roughness_texture: None,
material_asset_path: None,
parameters: [],
textures: [],
),
"shared::components::Primitive": (shape: Box, size: (1.4, 0.8, 1.0)),
"shared::components::RigidBodyDesc": (body: Static),
"shared::components::ColliderDesc": (
enabled: true,
is_trigger: false,
shape: Cuboid(x_length: 1.4, y_length: 0.8, z_length: 1.0),
),
}),
5: (components: {
"bevy_ecs::name::Name": "Placement Sun",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 8.0, 2.0),
rotation: (-0.3826834, 0.0, 0.0, 0.9238795),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("physics-placement-sun"),
"shared::components::ActorKind": Light,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (4),
"shared::components::LevelObject": (),
"shared::components::LightDesc": (
kind: Directional,
color: (r: 1.0, g: 0.95, b: 0.85, a: 1.0),
intensity: 100000.0,
range: 0.0,
shadows: true,
inner_angle_deg: 25.0,
outer_angle_deg: 35.0,
),
}),
})
+11 -17
View File
@@ -1,16 +1,15 @@
(schema_version: 2, (schema_version: 4,resources: {
resources: {}, },
entities: { entities: {
4294968001: ( 4294968001: (components: {
components: {
"bevy_ecs::name::Name": "Fog Volume", "bevy_ecs::name::Name": "Fog Volume",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (0.0, 2.0, 0.0), translation: (0.0, 2.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0), rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0), scale: (1.0, 1.0, 1.0),
), ),
"shared::components::LevelObject": (),
"shared::components::ActorKind": PostProcessVolume, "shared::components::ActorKind": PostProcessVolume,
"shared::components::LevelObject": (),
"shared::components::PostProcessVolumeDesc": ( "shared::components::PostProcessVolumeDesc": (
half_extents: (6.0, 3.0, 6.0), half_extents: (6.0, 3.0, 6.0),
priority: 0, priority: 0,
@@ -23,18 +22,16 @@
profile: None, profile: None,
label: Some("Foggy courtyard"), label: Some("Foggy courtyard"),
), ),
}, }),
), 4294968002: (components: {
4294968002: (
components: {
"bevy_ecs::name::Name": "Dark Exposure Volume", "bevy_ecs::name::Name": "Dark Exposure Volume",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (14.0, 2.0, 0.0), translation: (14.0, 2.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0), rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0), scale: (1.0, 1.0, 1.0),
), ),
"shared::components::LevelObject": (),
"shared::components::ActorKind": PostProcessVolume, "shared::components::ActorKind": PostProcessVolume,
"shared::components::LevelObject": (),
"shared::components::PostProcessVolumeDesc": ( "shared::components::PostProcessVolumeDesc": (
half_extents: (4.0, 2.5, 4.0), half_extents: (4.0, 2.5, 4.0),
priority: 5, priority: 5,
@@ -47,18 +44,16 @@
profile: Some("assets/rendering_profiles/cave_dark.ron"), profile: Some("assets/rendering_profiles/cave_dark.ron"),
label: Some("Cave mouth"), label: Some("Cave mouth"),
), ),
}, }),
), 4294968003: (components: {
4294968003: (
components: {
"bevy_ecs::name::Name": "Vignette FX Volume", "bevy_ecs::name::Name": "Vignette FX Volume",
"bevy_transform::components::transform::Transform": ( "bevy_transform::components::transform::Transform": (
translation: (-12.0, 2.0, 0.0), translation: (-12.0, 2.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0), rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0), scale: (1.0, 1.0, 1.0),
), ),
"shared::components::LevelObject": (),
"shared::components::ActorKind": PostProcessVolume, "shared::components::ActorKind": PostProcessVolume,
"shared::components::LevelObject": (),
"shared::components::PostProcessVolumeDesc": ( "shared::components::PostProcessVolumeDesc": (
half_extents: (5.0, 2.0, 5.0), half_extents: (5.0, 2.0, 5.0),
priority: 2, priority: 2,
@@ -68,7 +63,6 @@
profile: None, profile: None,
label: Some("Vignette demo"), label: Some("Vignette demo"),
), ),
}, }),
),
}, },
) )
@@ -0,0 +1,87 @@
(schema_version: 4, resources: {}, entities: {
1: (components: {
"bevy_ecs::name::Name": "Terrain Showcase",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 0.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("terrain-showcase-main"),
"shared::components::ActorKind": Terrain,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (0),
"shared::components::LevelObject": (),
"shared::components::TerrainDesc": (
schema_version: 1,
resolution: 5,
heights: [
0.00, 0.00, 0.05, 0.00, 0.00,
0.00, 0.15, 0.30, 0.10, 0.00,
0.05, 0.35, 0.80, 0.25, 0.05,
0.00, 0.20, 0.40, 0.15, 0.00,
0.00, 0.00, 0.05, 0.00, 0.00,
],
sample_spacing: 2.0,
height_scale: 3.0,
chunk_quads: 2,
base_material: Some((
asset_id: "cc2769da-c9a5-4cb3-866a-cc81d0688ee2",
sub_asset_id: "material:instance",
label: "surface_tint_instance",
source_path: Some("assets/materials/surface_tint_instance.ron"),
)),
material_layers: [
(
material: Some((
asset_id: "a57f2891-8536-47b8-b476-01c08b36ac43",
sub_asset_id: "material:source",
label: "Concrete",
source_path: Some("assets/materials/concrete.ron"),
)),
uv_scale: 6.0,
),
(
material: Some((
asset_id: "d6cb4151-7124-4237-aaf9-f7f8abd5fb76",
sub_asset_id: "material:source",
label: "Surface Tint",
source_path: Some("assets/materials/surface_tint.ron"),
)),
uv_scale: 10.0,
),
],
material_weights: [
(255, 0, 0, 0), (255, 0, 0, 0), (224, 31, 0, 0), (255, 0, 0, 0), (255, 0, 0, 0),
(255, 0, 0, 0), (192, 63, 0, 0), (128, 127, 0, 0), (192, 63, 0, 0), (255, 0, 0, 0),
(224, 31, 0, 0), (128, 127, 0, 0), (0, 255, 0, 0), (128, 127, 0, 0), (224, 31, 0, 0),
(255, 0, 0, 0), (192, 63, 0, 0), (128, 127, 0, 0), (192, 63, 0, 0), (255, 0, 0, 0),
(255, 0, 0, 0), (255, 0, 0, 0), (224, 31, 0, 0), (255, 0, 0, 0), (255, 0, 0, 0),
],
generate_colliders: true,
cast_shadows: true,
receive_shadows: true,
),
}),
2: (components: {
"bevy_ecs::name::Name": "Terrain Sun",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 8.0, 0.0),
rotation: (-0.3826834, 0.0, 0.0, 0.9238795),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("terrain-showcase-sun"),
"shared::components::ActorKind": Light,
"shared::components::EditorVisibility": (visible: true),
"shared::components::HierarchySiblingIndex": (1),
"shared::components::LevelObject": (),
"shared::components::LightDesc": (
kind: Directional,
color: (r: 1.0, g: 0.95, b: 0.85, a: 1.0),
intensity: 100000.0,
range: 0.0,
shadows: true,
inner_angle_deg: 25.0,
outer_angle_deg: 35.0,
),
}),
})
+29 -1
View File
@@ -1,12 +1,40 @@
( (
schema_version: 1,
label: "Concrete", label: "Concrete",
shader: None,
shader_ref: None,
render_state: (
alpha_mode: Opaque,
alpha_cutoff: 0.5,
double_sided: false,
),
material: ( material: (
base_color: (r: 0.55, g: 0.54, b: 0.52, a: 1.0), shader: (
kind: StandardLit,
schema_path: None,
shader_path: None,
),
base_color: (
r: 0.55,
g: 0.54,
b: 0.52,
a: 1.0,
),
metallic: 0.0, metallic: 0.0,
roughness: 0.85, roughness: 0.85,
emissive_color: (
r: 1.0,
g: 1.0,
b: 1.0,
a: 1.0,
),
emissive_intensity: 0.0,
base_color_texture: None, base_color_texture: None,
emissive_texture: None,
normal_map_texture: None, normal_map_texture: None,
metallic_roughness_texture: None, metallic_roughness_texture: None,
material_asset_path: None, material_asset_path: None,
parameters: [],
textures: [],
), ),
) )
+27 -2
View File
@@ -1,15 +1,40 @@
( (
schema_version: 1,
label: "Emissive Panel", label: "Emissive Panel",
shader: None,
shader_ref: None,
render_state: (
alpha_mode: Opaque,
alpha_cutoff: 0.5,
double_sided: false,
),
material: ( material: (
base_color: (r: 0.15, g: 0.22, b: 0.28, a: 1.0), shader: (
kind: StandardLit,
schema_path: None,
shader_path: None,
),
base_color: (
r: 0.15,
g: 0.22,
b: 0.28,
a: 1.0,
),
metallic: 0.0, metallic: 0.0,
roughness: 0.35, roughness: 0.35,
emissive_color: (r: 0.55, g: 0.85, b: 1.0, a: 1.0), emissive_color: (
r: 0.55,
g: 0.85,
b: 1.0,
a: 1.0,
),
emissive_intensity: 2500.0, emissive_intensity: 2500.0,
base_color_texture: None, base_color_texture: None,
emissive_texture: None, emissive_texture: None,
normal_map_texture: None, normal_map_texture: None,
metallic_roughness_texture: None, metallic_roughness_texture: None,
material_asset_path: None, material_asset_path: None,
parameters: [],
textures: [],
), ),
) )
+71
View File
@@ -0,0 +1,71 @@
(
schema_version: 1,
label: "Surface Tint",
shader: Some("assets/shaders/surface_tint.shader.ron"),
shader_ref: None,
render_state: (
alpha_mode: Opaque,
alpha_cutoff: 0.5,
double_sided: false,
),
material: (
shader: (
kind: Custom,
schema_path: Some("assets/shaders/surface_tint.shader.ron"),
shader_path: Some("assets/shaders/surface_tint.wgsl"),
),
base_color: (
r: 0.12,
g: 0.42,
b: 0.95,
a: 1.0,
),
metallic: 0.15,
roughness: 0.28,
emissive_color: (
r: 0.02,
g: 0.08,
b: 0.25,
a: 1.0,
),
emissive_intensity: 3.0,
base_color_texture: None,
emissive_texture: None,
normal_map_texture: None,
metallic_roughness_texture: None,
material_asset_path: None,
parameters: [
(
name: "tint",
value: Color((
r: 0.12,
g: 0.42,
b: 0.95,
a: 1.0,
)),
),
(
name: "roughness",
value: Float(0.28),
),
(
name: "metallic",
value: Float(0.15),
),
(
name: "emissive",
value: Color((
r: 0.02,
g: 0.08,
b: 0.25,
a: 1.0,
)),
),
(
name: "emissive_intensity",
value: Float(3.0),
),
],
textures: [],
),
)
@@ -0,0 +1,12 @@
(
schema_version: 1,
label: "surface_tint Instance",
base: ((
asset_id: "d6cb4151-7124-4237-aaf9-f7f8abd5fb76",
sub_asset_id: "material:source",
label: "surface_tint",
source_path: Some("assets/materials/surface_tint.ron"),
)),
parameters: [],
textures: [],
)
@@ -0,0 +1,360 @@
(
schema_version: 3,
asset_id: "113f74df-e39c-41d4-9b5b-e48efe541f7f",
label: "RobotExpressive",
source: (
path: "assets/models/RobotExpressive.glb",
format: "glb",
fingerprint: (
byte_len: 463988,
modified_unix_secs: 1783799272,
),
dependencies: [],
),
import: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: SceneInstance,
hierarchy_mode: SourceHierarchy,
material_policy: SourceMaterials,
),
metadata: (
mesh_count: 14,
material_count: 3,
node_count: 74,
animation_count: 14,
skin_count: 2,
light_count: 0,
camera_count: 0,
),
parts: [
(
id: "draw:scene0:node4:mesh0:primitive0",
name: "Foot.L / Primitive 0",
mesh_label: "Mesh0/Primitive0",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (0.62405795, 0.39766362, 0.19111444),
rotation: (0.7071068, 0.00000005228401, 0.000000015504241, -0.70710665),
scale: (100.0, 99.999985, 100.0),
),
source_node: Some("RootNode/RobotArmature/Bone/Foot.L/Foot.L"),
source_mesh: Some("Mesh0"),
source_material: Some("Grey"),
skinned: false,
),
(
id: "draw:scene0:node7:mesh1:primitive0",
name: "Torso / Primitive 0",
mesh_label: "Mesh1/Primitive0",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (-0.0027156367, 2.1737509, -0.019581214),
rotation: (0.70710677, 0.000000000000031351603, 0.000000000000055267226, -0.7071067),
scale: (100.0, 99.99998, 99.99998),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Torso"),
source_mesh: Some("Mesh1"),
source_material: Some("Grey"),
skinned: false,
),
(
id: "draw:scene0:node7:mesh1:primitive1",
name: "Torso / Primitive 1",
mesh_label: "Mesh1/Primitive1",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.0027156367, 2.1737509, -0.019581214),
rotation: (0.70710677, 0.000000000000031351603, 0.000000000000055267226, -0.7071067),
scale: (100.0, 99.99998, 99.99998),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Torso"),
source_mesh: Some("Mesh1"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node61:mesh10:primitive0",
name: "Leg.R / Primitive 0",
mesh_label: "Mesh10/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.6746981, 1.1586236, 0.046261936),
rotation: (0.7693698, 0.080835514, 0.110868365, -0.6238942),
scale: (99.99999, 99.99886, 100.00024),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/UpperLeg.R/Leg.R"),
source_mesh: Some("Mesh10"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node63:mesh11:primitive0",
name: "LowerLeg.R / Primitive 0",
mesh_label: "Mesh11/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.73626167, 0.34982973, 0.22594015),
rotation: (-0.65091395, -0.099058665, -0.09436109, 0.7467224),
scale: (99.99999, 99.998604, 100.00058),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/UpperLeg.R/LowerLeg.R/LowerLeg.R"),
source_mesh: Some("Mesh11"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node72:mesh12:primitive0",
name: "Hand.R / Primitive 0",
mesh_label: "Mesh12/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.002715637, 2.3702974, -0.020994147),
rotation: (0.70710677, 0.0, 0.0, -0.7071067),
scale: (100.0, 99.99999, 99.99999),
),
source_node: Some("RootNode/Hand.R"),
source_mesh: Some("Mesh12"),
source_material: Some("Main"),
skinned: true,
),
(
id: "draw:scene0:node72:mesh12:primitive1",
name: "Hand.R / Primitive 1",
mesh_label: "Mesh12/Primitive1",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (-0.002715637, 2.3702974, -0.020994147),
rotation: (0.70710677, 0.0, 0.0, -0.7071067),
scale: (100.0, 99.99999, 99.99999),
),
source_node: Some("RootNode/Hand.R"),
source_mesh: Some("Mesh12"),
source_material: Some("Grey"),
skinned: true,
),
(
id: "draw:scene0:node73:mesh13:primitive0",
name: "Hand.L / Primitive 0",
mesh_label: "Mesh13/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.002715637, 2.3702974, -0.020994147),
rotation: (0.70710677, 0.0, 0.0, -0.7071067),
scale: (100.0, 99.99999, 99.99999),
),
source_node: Some("RootNode/Hand.L"),
source_mesh: Some("Mesh13"),
source_material: Some("Main"),
skinned: true,
),
(
id: "draw:scene0:node73:mesh13:primitive1",
name: "Hand.L / Primitive 1",
mesh_label: "Mesh13/Primitive1",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (-0.002715637, 2.3702974, -0.020994147),
rotation: (0.70710677, 0.0, 0.0, -0.7071067),
scale: (100.0, 99.99999, 99.99999),
),
source_node: Some("RootNode/Hand.L"),
source_mesh: Some("Mesh13"),
source_material: Some("Grey"),
skinned: true,
),
(
id: "draw:scene0:node13:mesh2:primitive0",
name: "Head / Primitive 0",
mesh_label: "Mesh2/Primitive0",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (-0.05334633, 3.6175368, -0.0068152454),
rotation: (0.7249889, 0.0852804, 0.05460569, -0.6812757),
scale: (99.99997, 99.99996, 99.99997),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck/Head/Head"),
source_mesh: Some("Mesh2"),
source_material: Some("Grey"),
skinned: false,
),
(
id: "draw:scene0:node13:mesh2:primitive1",
name: "Head / Primitive 1",
mesh_label: "Mesh2/Primitive1",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.05334633, 3.6175368, -0.0068152454),
rotation: (0.7249889, 0.0852804, 0.05460569, -0.6812757),
scale: (99.99997, 99.99996, 99.99997),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck/Head/Head"),
source_mesh: Some("Mesh2"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node13:mesh2:primitive2",
name: "Head / Primitive 2",
mesh_label: "Mesh2/Primitive2",
material_id: Some("material:material2"),
material_slot_name: "Black",
material_label: Some("Material2"),
local_transform: (
translation: (-0.05334633, 3.6175368, -0.0068152454),
rotation: (0.7249889, 0.0852804, 0.05460569, -0.6812757),
scale: (99.99997, 99.99996, 99.99997),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck/Head/Head"),
source_mesh: Some("Mesh2"),
source_material: Some("Black"),
skinned: false,
),
(
id: "draw:scene0:node68:mesh3:primitive0",
name: "Foot.R / Primitive 0",
mesh_label: "Mesh3/Primitive0",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (-0.637997, 0.3976636, 0.19111452),
rotation: (0.70710677, 0.00000005201811, 0.000000015770217, -0.7071067),
scale: (100.0, 99.999985, 100.0),
),
source_node: Some("RootNode/RobotArmature/Bone/Foot.R/Foot.R"),
source_mesh: Some("Mesh3"),
source_material: Some("Grey"),
skinned: false,
),
(
id: "draw:scene0:node16:mesh4:primitive0",
name: "Shoulder.L / Primitive 0",
mesh_label: "Mesh4/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (0.58268076, 2.3724597, -0.020994142),
rotation: (-0.59886926, 0.37597278, -0.37597266, 0.59886944),
scale: (99.99996, 99.999954, 99.99997),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/Shoulder.L"),
source_mesh: Some("Mesh4"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node18:mesh5:primitive0",
name: "Arm.L / Primitive 0",
mesh_label: "Mesh5/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (0.26500192, 2.8489676, 0.13069445),
rotation: (-0.5164575, 0.4218856, -0.32294926, 0.67155623),
scale: (99.99994, 99.99994, 99.99999),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/Arm.L"),
source_mesh: Some("Mesh5"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node36:mesh6:primitive0",
name: "Shoulder.R / Primitive 0",
mesh_label: "Mesh6/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.6369861, 2.3718858, -0.020994166),
rotation: (0.6017577, 0.37133226, -0.37133226, -0.6017577),
scale: (99.999954, 99.99997, 99.99994),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/Shoulder.R"),
source_mesh: Some("Mesh6"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node38:mesh7:primitive0",
name: "Arm.R / Primitive 0",
mesh_label: "Mesh7/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.82568955, 1.9825263, 0.040243305),
rotation: (0.6276481, 0.35463694, -0.3873087, -0.5747021),
scale: (22.70405, 22.704054, 22.704046),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/Arm.R"),
source_mesh: Some("Mesh7"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node56:mesh8:primitive0",
name: "Leg.L / Primitive 0",
mesh_label: "Mesh8/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (0.6488191, 1.1620699, 0.057466835),
rotation: (0.76387787, -0.05410902, -0.070370995, -0.6392268),
scale: (99.99999, 100.00079, 100.00024),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/UpperLeg.L/Leg.L"),
source_mesh: Some("Mesh8"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node58:mesh9:primitive0",
name: "LowerLeg.L / Primitive 0",
mesh_label: "Mesh9/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (0.68805873, 0.3497491, 0.23465614),
rotation: (-0.6547612, 0.06408298, 0.061960325, 0.7505613),
scale: (100.000015, 100.0006, 100.000496),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/UpperLeg.L/LowerLeg.L/LowerLeg.L"),
source_mesh: Some("Mesh9"),
source_material: Some("Main"),
skinned: false,
),
],
warnings: [
"Animations are recorded as metadata; animated placement uses SkinnedMeshRenderer.",
"Skinned primitives are excluded from StaticMeshRenderer and use SkinnedMeshRenderer.",
],
)
@@ -0,0 +1,360 @@
(
schema_version: 3,
asset_id: "3f63f359-45eb-4cb2-8970-71921cbd7bd0",
label: "robot_expressive",
source: (
path: "assets/models/robot_expressive.glb",
format: "glb",
fingerprint: (
byte_len: 463988,
modified_unix_secs: 1783750957,
),
dependencies: [],
),
import: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: StaticAsset,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
),
metadata: (
mesh_count: 14,
material_count: 3,
node_count: 74,
animation_count: 14,
skin_count: 2,
light_count: 0,
camera_count: 0,
),
parts: [
(
id: "draw:scene0:node4:mesh0:primitive0",
name: "Foot.L / Primitive 0",
mesh_label: "Mesh0/Primitive0",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (0.62405795, 0.39766362, 0.19111444),
rotation: (0.7071068, 0.00000005228401, 0.000000015504241, -0.70710665),
scale: (100.0, 99.999985, 100.0),
),
source_node: Some("RootNode/RobotArmature/Bone/Foot.L/Foot.L"),
source_mesh: Some("Mesh0"),
source_material: Some("Grey"),
skinned: false,
),
(
id: "draw:scene0:node7:mesh1:primitive0",
name: "Torso / Primitive 0",
mesh_label: "Mesh1/Primitive0",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (-0.0027156367, 2.1737509, -0.019581214),
rotation: (0.70710677, 0.000000000000031351603, 0.000000000000055267226, -0.7071067),
scale: (100.0, 99.99998, 99.99998),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Torso"),
source_mesh: Some("Mesh1"),
source_material: Some("Grey"),
skinned: false,
),
(
id: "draw:scene0:node7:mesh1:primitive1",
name: "Torso / Primitive 1",
mesh_label: "Mesh1/Primitive1",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.0027156367, 2.1737509, -0.019581214),
rotation: (0.70710677, 0.000000000000031351603, 0.000000000000055267226, -0.7071067),
scale: (100.0, 99.99998, 99.99998),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Torso"),
source_mesh: Some("Mesh1"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node61:mesh10:primitive0",
name: "Leg.R / Primitive 0",
mesh_label: "Mesh10/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.6746981, 1.1586236, 0.046261936),
rotation: (0.7693698, 0.080835514, 0.110868365, -0.6238942),
scale: (99.99999, 99.99886, 100.00024),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/UpperLeg.R/Leg.R"),
source_mesh: Some("Mesh10"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node63:mesh11:primitive0",
name: "LowerLeg.R / Primitive 0",
mesh_label: "Mesh11/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.73626167, 0.34982973, 0.22594015),
rotation: (-0.65091395, -0.099058665, -0.09436109, 0.7467224),
scale: (99.99999, 99.998604, 100.00058),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/UpperLeg.R/LowerLeg.R/LowerLeg.R"),
source_mesh: Some("Mesh11"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node72:mesh12:primitive0",
name: "Hand.R / Primitive 0",
mesh_label: "Mesh12/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.002715637, 2.3702974, -0.020994147),
rotation: (0.70710677, 0.0, 0.0, -0.7071067),
scale: (100.0, 99.99999, 99.99999),
),
source_node: Some("RootNode/Hand.R"),
source_mesh: Some("Mesh12"),
source_material: Some("Main"),
skinned: true,
),
(
id: "draw:scene0:node72:mesh12:primitive1",
name: "Hand.R / Primitive 1",
mesh_label: "Mesh12/Primitive1",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (-0.002715637, 2.3702974, -0.020994147),
rotation: (0.70710677, 0.0, 0.0, -0.7071067),
scale: (100.0, 99.99999, 99.99999),
),
source_node: Some("RootNode/Hand.R"),
source_mesh: Some("Mesh12"),
source_material: Some("Grey"),
skinned: true,
),
(
id: "draw:scene0:node73:mesh13:primitive0",
name: "Hand.L / Primitive 0",
mesh_label: "Mesh13/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.002715637, 2.3702974, -0.020994147),
rotation: (0.70710677, 0.0, 0.0, -0.7071067),
scale: (100.0, 99.99999, 99.99999),
),
source_node: Some("RootNode/Hand.L"),
source_mesh: Some("Mesh13"),
source_material: Some("Main"),
skinned: true,
),
(
id: "draw:scene0:node73:mesh13:primitive1",
name: "Hand.L / Primitive 1",
mesh_label: "Mesh13/Primitive1",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (-0.002715637, 2.3702974, -0.020994147),
rotation: (0.70710677, 0.0, 0.0, -0.7071067),
scale: (100.0, 99.99999, 99.99999),
),
source_node: Some("RootNode/Hand.L"),
source_mesh: Some("Mesh13"),
source_material: Some("Grey"),
skinned: true,
),
(
id: "draw:scene0:node13:mesh2:primitive0",
name: "Head / Primitive 0",
mesh_label: "Mesh2/Primitive0",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (-0.05334633, 3.6175368, -0.0068152454),
rotation: (0.7249889, 0.0852804, 0.05460569, -0.6812757),
scale: (99.99997, 99.99996, 99.99997),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck/Head/Head"),
source_mesh: Some("Mesh2"),
source_material: Some("Grey"),
skinned: false,
),
(
id: "draw:scene0:node13:mesh2:primitive1",
name: "Head / Primitive 1",
mesh_label: "Mesh2/Primitive1",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.05334633, 3.6175368, -0.0068152454),
rotation: (0.7249889, 0.0852804, 0.05460569, -0.6812757),
scale: (99.99997, 99.99996, 99.99997),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck/Head/Head"),
source_mesh: Some("Mesh2"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node13:mesh2:primitive2",
name: "Head / Primitive 2",
mesh_label: "Mesh2/Primitive2",
material_id: Some("material:material2"),
material_slot_name: "Black",
material_label: Some("Material2"),
local_transform: (
translation: (-0.05334633, 3.6175368, -0.0068152454),
rotation: (0.7249889, 0.0852804, 0.05460569, -0.6812757),
scale: (99.99997, 99.99996, 99.99997),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Neck/Head/Head"),
source_mesh: Some("Mesh2"),
source_material: Some("Black"),
skinned: false,
),
(
id: "draw:scene0:node68:mesh3:primitive0",
name: "Foot.R / Primitive 0",
mesh_label: "Mesh3/Primitive0",
material_id: Some("material:material0"),
material_slot_name: "Grey",
material_label: Some("Material0"),
local_transform: (
translation: (-0.637997, 0.3976636, 0.19111452),
rotation: (0.70710677, 0.00000005201811, 0.000000015770217, -0.7071067),
scale: (100.0, 99.999985, 100.0),
),
source_node: Some("RootNode/RobotArmature/Bone/Foot.R/Foot.R"),
source_mesh: Some("Mesh3"),
source_material: Some("Grey"),
skinned: false,
),
(
id: "draw:scene0:node16:mesh4:primitive0",
name: "Shoulder.L / Primitive 0",
mesh_label: "Mesh4/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (0.58268076, 2.3724597, -0.020994142),
rotation: (-0.59886926, 0.37597278, -0.37597266, 0.59886944),
scale: (99.99996, 99.999954, 99.99997),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/Shoulder.L"),
source_mesh: Some("Mesh4"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node18:mesh5:primitive0",
name: "Arm.L / Primitive 0",
mesh_label: "Mesh5/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (0.26500192, 2.8489676, 0.13069445),
rotation: (-0.5164575, 0.4218856, -0.32294926, 0.67155623),
scale: (99.99994, 99.99994, 99.99999),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.L/UpperArm.L/Arm.L"),
source_mesh: Some("Mesh5"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node36:mesh6:primitive0",
name: "Shoulder.R / Primitive 0",
mesh_label: "Mesh6/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.6369861, 2.3718858, -0.020994166),
rotation: (0.6017577, 0.37133226, -0.37133226, -0.6017577),
scale: (99.999954, 99.99997, 99.99994),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/Shoulder.R"),
source_mesh: Some("Mesh6"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node38:mesh7:primitive0",
name: "Arm.R / Primitive 0",
mesh_label: "Mesh7/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (-0.82568955, 1.9825263, 0.040243305),
rotation: (0.6276481, 0.35463694, -0.3873087, -0.5747021),
scale: (22.70405, 22.704054, 22.704046),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/Hips/Abdomen/Torso/Shoulder.R/UpperArm.R/Arm.R"),
source_mesh: Some("Mesh7"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node56:mesh8:primitive0",
name: "Leg.L / Primitive 0",
mesh_label: "Mesh8/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (0.6488191, 1.1620699, 0.057466835),
rotation: (0.76387787, -0.05410902, -0.070370995, -0.6392268),
scale: (99.99999, 100.00079, 100.00024),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/UpperLeg.L/Leg.L"),
source_mesh: Some("Mesh8"),
source_material: Some("Main"),
skinned: false,
),
(
id: "draw:scene0:node58:mesh9:primitive0",
name: "LowerLeg.L / Primitive 0",
mesh_label: "Mesh9/Primitive0",
material_id: Some("material:material1"),
material_slot_name: "Main",
material_label: Some("Material1"),
local_transform: (
translation: (0.68805873, 0.3497491, 0.23465614),
rotation: (-0.6547612, 0.06408298, 0.061960325, 0.7505613),
scale: (100.000015, 100.0006, 100.000496),
),
source_node: Some("RootNode/RobotArmature/Bone/Body/UpperLeg.L/LowerLeg.L/LowerLeg.L"),
source_mesh: Some("Mesh9"),
source_material: Some("Main"),
skinned: false,
),
],
warnings: [
"Animations are recorded as metadata; animated placement uses SkinnedMeshRenderer.",
"Skinned primitives are excluded from StaticMeshRenderer and use SkinnedMeshRenderer.",
],
)
@@ -1,55 +0,0 @@
(
schema_version: 1,
asset_id: "71071fc3-7a7f-454d-b9ab-93ebf0feccbe",
label: "metal_stool_01_2k",
source: (
path: "assets/models/metal_stool_01_2k.gltf",
format: "gltf",
fingerprint: (
byte_len: 2790,
modified_unix_secs: 1780712587,
),
dependencies: [
"assets/models/metal_stool_01.bin",
"assets/models/textures/metal_stool_01_arm_2k.jpg",
"assets/models/textures/metal_stool_01_diff_2k.jpg",
"assets/models/textures/metal_stool_01_nor_gl_2k.jpg",
],
),
import: (
scale: 1.0,
generate_collider: true,
lod0_only: true,
placement_mode: SceneInstance,
hierarchy_mode: SingleActor,
material_policy: SourceMaterials,
),
metadata: (
mesh_count: 1,
material_count: 1,
node_count: 1,
animation_count: 0,
skin_count: 0,
light_count: 0,
camera_count: 0,
),
parts: [
(
id: "mesh:mesh0_primitive0",
name: "metal_stool_01 / Primitive 0",
mesh_label: "Mesh0/Primitive0",
material_id: Some("material:material0"),
material_slot_name: "metal_stool_01",
material_label: Some("Material0"),
local_transform: (
translation: (0.0, 0.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
source_node: Some("Node0"),
source_mesh: Some("Mesh0"),
source_material: Some("metal_stool_01"),
),
],
warnings: [],
)
@@ -1,5 +1,5 @@
( (
schema_version: 1, schema_version: 3,
asset_id: "b98ef565-3500-49e7-9935-f685fa9b2594", asset_id: "b98ef565-3500-49e7-9935-f685fa9b2594",
label: "painted_wooden_chair_02_2k", label: "painted_wooden_chair_02_2k",
source: ( source: (
@@ -30,7 +30,7 @@
), ),
parts: [ parts: [
( (
id: "mesh:mesh1000", id: "draw:scene0:node1:material0",
name: "painted_wooden_chair_02 / Material 0", name: "painted_wooden_chair_02 / Material 0",
mesh_label: "Mesh1000", mesh_label: "Mesh1000",
material_id: Some("material:material0"), material_id: Some("material:material0"),
@@ -44,6 +44,7 @@
source_node: Some("Node1"), source_node: Some("Node1"),
source_mesh: Some("Mesh1"), source_mesh: Some("Mesh1"),
source_material: Some("painted_wooden_chair_02"), source_material: Some("painted_wooden_chair_02"),
skinned: false,
), ),
], ],
warnings: [], warnings: [],
Binary file not shown.
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
# RobotExpressive License And Attribution
`robot_expressive.glb` is the RobotExpressive model from the Three.js example assets.
- Model: Tomas Laulhe (Quaternius)
- Modifications and glTF conversion: Don McCurdy
- License: CC0 1.0 Universal
- Source: https://github.com/mrdoob/three.js/tree/dev/examples/models/gltf/RobotExpressive
- Imported source SHA-256: `047f5e5fb3bb6d378bd1df16ca6137f2a596c99b3a1b5690b4020c05aaf6f319`
The upstream modifications add facial-expression morph targets, convert the source with FBX2GLTF,
remove duplicate materials, and reduce material metalness.
Binary file not shown.
@@ -0,0 +1,977 @@
(
schema_version: 2,
generator: "blacksite-nav-2/rerecast-0.3.2/polyanya-0.16.1/glam-0.30.10",
source_scene: "assets/levels/navigation_authoring_showcase.scn.ron",
source_fingerprint: "15649e3f7c8f22d642ea318ba1dafb5a3ada82e2713219cb60bbb518c5e45195",
payload_hash: "180b5a4698102e8185ae182bc30cf847466c4e9d65fe7834c315f6d1a03504c2",
bounds_actor_id: "navigation-bounds-main",
center: (0.0, 0.0, 0.0),
half_extents: (8.0, 2.0, 8.0),
agent: (
id: "humanoid",
radius: 0.35,
height: 1.8,
max_climb: 0.45,
max_slope_deg: 45.0,
cell_size_fraction: 3.0,
cell_height_fraction: 6.0,
min_region_size: 1,
merge_region_size: 2,
),
mesh: (
layers: [
(
vertices: [
(
coords: (-1.0, -2.516667),
polygons: [
0,
4294967295,
1,
3,
2,
],
is_corner: true,
),
(
coords: (-0.3000002, -2.516667),
polygons: [
4,
4294967295,
0,
],
is_corner: true,
),
(
coords: (-0.41666698, -7.3),
polygons: [
5,
4,
0,
2,
4294967295,
],
is_corner: true,
),
(
coords: (-7.3, -1.5833335),
polygons: [
3,
1,
10,
12,
4294967295,
],
is_corner: true,
),
(
coords: (-1.0, -1.5833335),
polygons: [
10,
1,
4294967295,
],
is_corner: true,
),
(
coords: (-1.0, -2.516667),
polygons: [
0,
4294967295,
1,
3,
2,
],
is_corner: true,
),
(
coords: (-1.0, -2.516667),
polygons: [
0,
4294967295,
1,
3,
2,
],
is_corner: true,
),
(
coords: (-0.41666698, -7.3),
polygons: [
5,
4,
0,
2,
4294967295,
],
is_corner: true,
),
(
coords: (-7.3, -7.3),
polygons: [
2,
3,
4294967295,
],
is_corner: true,
),
(
coords: (-7.3, -1.5833335),
polygons: [
3,
1,
10,
12,
4294967295,
],
is_corner: true,
),
(
coords: (-0.3000002, -2.516667),
polygons: [
4,
4294967295,
0,
],
is_corner: true,
),
(
coords: (0.2833333, -2.516667),
polygons: [
6,
4294967295,
4,
5,
],
is_corner: true,
),
(
coords: (0.39999962, -7.3),
polygons: [
8,
6,
5,
4294967295,
],
is_corner: true,
),
(
coords: (-0.41666698, -7.3),
polygons: [
5,
4,
0,
2,
4294967295,
],
is_corner: true,
),
(
coords: (0.39999962, -7.3),
polygons: [
8,
6,
5,
4294967295,
],
is_corner: true,
),
(
coords: (0.2833333, -2.516667),
polygons: [
6,
4294967295,
4,
5,
],
is_corner: true,
),
(
coords: (0.9833336, -2.516667),
polygons: [
8,
9,
7,
4294967295,
6,
],
is_corner: true,
),
(
coords: (0.9833336, -2.516667),
polygons: [
8,
9,
7,
4294967295,
6,
],
is_corner: true,
),
(
coords: (0.9833336, -1.5833335),
polygons: [
7,
13,
4294967295,
],
is_corner: true,
),
(
coords: (7.283333, -1.5833335),
polygons: [
15,
13,
7,
9,
4294967295,
],
is_corner: true,
),
(
coords: (0.9833336, -2.516667),
polygons: [
8,
9,
7,
4294967295,
6,
],
is_corner: true,
),
(
coords: (7.283333, -1.5833335),
polygons: [
15,
13,
7,
9,
4294967295,
],
is_corner: true,
),
(
coords: (7.283333, -7.3),
polygons: [
9,
8,
4294967295,
],
is_corner: true,
),
(
coords: (0.39999962, -7.3),
polygons: [
8,
6,
5,
4294967295,
],
is_corner: true,
),
(
coords: (-1.0, -0.0666666),
polygons: [
11,
12,
10,
4294967295,
],
is_corner: true,
),
(
coords: (-1.0, -1.5833335),
polygons: [
10,
1,
4294967295,
],
is_corner: true,
),
(
coords: (-7.3, -1.5833335),
polygons: [
3,
1,
10,
12,
4294967295,
],
is_corner: true,
),
(
coords: (-7.3, 1.5666666),
polygons: [
12,
11,
17,
19,
4294967295,
],
is_corner: true,
),
(
coords: (-1.0, 1.5666666),
polygons: [
17,
11,
4294967295,
],
is_corner: true,
),
(
coords: (-1.0, -0.0666666),
polygons: [
11,
12,
10,
4294967295,
],
is_corner: true,
),
(
coords: (-7.3, -1.5833335),
polygons: [
3,
1,
10,
12,
4294967295,
],
is_corner: true,
),
(
coords: (7.283333, -1.5833335),
polygons: [
15,
13,
7,
9,
4294967295,
],
is_corner: true,
),
(
coords: (0.9833336, -1.5833335),
polygons: [
7,
13,
4294967295,
],
is_corner: true,
),
(
coords: (0.9833336, -0.0666666),
polygons: [
13,
15,
14,
4294967295,
],
is_corner: true,
),
(
coords: (7.283333, 1.5666666),
polygons: [
23,
21,
14,
15,
4294967295,
],
is_corner: true,
),
(
coords: (7.283333, -1.5833335),
polygons: [
15,
13,
7,
9,
4294967295,
],
is_corner: true,
),
(
coords: (0.9833336, -0.0666666),
polygons: [
13,
15,
14,
4294967295,
],
is_corner: true,
),
(
coords: (0.9833336, 1.5666666),
polygons: [
14,
21,
4294967295,
],
is_corner: true,
),
(
coords: (-0.41666698, 7.283333),
polygons: [
24,
25,
4294967295,
18,
16,
],
is_corner: true,
),
(
coords: (-0.3000002, 2.5),
polygons: [
24,
16,
4294967295,
],
is_corner: true,
),
(
coords: (-1.0, 2.5),
polygons: [
16,
18,
19,
17,
4294967295,
],
is_corner: true,
),
(
coords: (-1.0, 2.5),
polygons: [
16,
18,
19,
17,
4294967295,
],
is_corner: true,
),
(
coords: (-1.0, 1.5666666),
polygons: [
17,
11,
4294967295,
],
is_corner: true,
),
(
coords: (-7.3, 1.5666666),
polygons: [
12,
11,
17,
19,
4294967295,
],
is_corner: true,
),
(
coords: (-7.3, 7.283333),
polygons: [
19,
18,
4294967295,
],
is_corner: true,
),
(
coords: (-0.41666698, 7.283333),
polygons: [
24,
25,
4294967295,
18,
16,
],
is_corner: true,
),
(
coords: (-1.0, 2.5),
polygons: [
16,
18,
19,
17,
4294967295,
],
is_corner: true,
),
(
coords: (-7.3, 1.5666666),
polygons: [
12,
11,
17,
19,
4294967295,
],
is_corner: true,
),
(
coords: (0.9833336, 2.5),
polygons: [
21,
23,
22,
20,
4294967295,
],
is_corner: true,
),
(
coords: (0.2833333, 2.5),
polygons: [
20,
25,
24,
4294967295,
],
is_corner: true,
),
(
coords: (0.39999962, 7.283333),
polygons: [
20,
22,
4294967295,
25,
],
is_corner: true,
),
(
coords: (7.283333, 1.5666666),
polygons: [
23,
21,
14,
15,
4294967295,
],
is_corner: true,
),
(
coords: (0.9833336, 1.5666666),
polygons: [
14,
21,
4294967295,
],
is_corner: true,
),
(
coords: (0.9833336, 2.5),
polygons: [
21,
23,
22,
20,
4294967295,
],
is_corner: true,
),
(
coords: (0.9833336, 2.5),
polygons: [
21,
23,
22,
20,
4294967295,
],
is_corner: true,
),
(
coords: (0.39999962, 7.283333),
polygons: [
20,
22,
4294967295,
25,
],
is_corner: true,
),
(
coords: (7.283333, 7.283333),
polygons: [
22,
23,
4294967295,
],
is_corner: true,
),
(
coords: (7.283333, 1.5666666),
polygons: [
23,
21,
14,
15,
4294967295,
],
is_corner: true,
),
(
coords: (-0.41666698, 7.283333),
polygons: [
24,
25,
4294967295,
18,
16,
],
is_corner: true,
),
(
coords: (0.39999962, 7.283333),
polygons: [
20,
22,
4294967295,
25,
],
is_corner: true,
),
(
coords: (0.2833333, 2.5),
polygons: [
20,
25,
24,
4294967295,
],
is_corner: true,
),
(
coords: (-0.3000002, 2.5),
polygons: [
24,
16,
4294967295,
],
is_corner: true,
),
],
polygons: [
(
vertices: [
2,
1,
0,
],
is_one_way: false,
),
(
vertices: [
4,
3,
5,
],
is_one_way: false,
),
(
vertices: [
6,
8,
7,
],
is_one_way: false,
),
(
vertices: [
6,
9,
8,
],
is_one_way: false,
),
(
vertices: [
13,
11,
10,
],
is_one_way: false,
),
(
vertices: [
13,
12,
11,
],
is_one_way: false,
),
(
vertices: [
15,
14,
16,
],
is_one_way: false,
),
(
vertices: [
18,
17,
19,
],
is_one_way: false,
),
(
vertices: [
22,
20,
23,
],
is_one_way: false,
),
(
vertices: [
22,
21,
20,
],
is_one_way: false,
),
(
vertices: [
25,
24,
26,
],
is_one_way: false,
),
(
vertices: [
27,
29,
28,
],
is_one_way: false,
),
(
vertices: [
27,
30,
29,
],
is_one_way: false,
),
(
vertices: [
32,
31,
33,
],
is_one_way: false,
),
(
vertices: [
36,
34,
37,
],
is_one_way: false,
),
(
vertices: [
36,
35,
34,
],
is_one_way: false,
),
(
vertices: [
40,
39,
38,
],
is_one_way: false,
),
(
vertices: [
42,
41,
43,
],
is_one_way: false,
),
(
vertices: [
44,
46,
45,
],
is_one_way: false,
),
(
vertices: [
44,
47,
46,
],
is_one_way: false,
),
(
vertices: [
49,
48,
50,
],
is_one_way: false,
),
(
vertices: [
52,
51,
53,
],
is_one_way: false,
),
(
vertices: [
54,
56,
55,
],
is_one_way: false,
),
(
vertices: [
54,
57,
56,
],
is_one_way: false,
),
(
vertices: [
60,
58,
61,
],
is_one_way: false,
),
(
vertices: [
60,
59,
58,
],
is_one_way: false,
),
],
offset: (0.0, 0.0),
baked_polygons: None,
islands: None,
height: [
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
0.10000008,
],
),
],
search_delta: 0.1,
search_steps: 2,
),
links: [
(
actor_id: "navigation-link-center",
start: (-1.5, 0.0, 0.0),
end: (1.5, 0.0, 0.0),
bidirectional: true,
cost: 1.2,
enabled: true,
),
],
areas: [
(
actor_id: "navigation-area-slow",
id: "slow",
center: (-4.0, 0.5, -4.0),
half_extents: (1.5, 1.0, 1.5),
cost: 1.5,
walkable: true,
),
],
samples: [
(
id: "around-center-obstacle",
start: (-6.0, 0.0, -5.0),
end: (6.0, 0.0, -5.0),
enabled: true,
),
],
diagnostics: (
polygon_count: 26,
island_count: 1,
effective_component_count: 1,
),
)
+10
View File
@@ -0,0 +1,10 @@
# Prefab fixtures
The `example_base` -> `example_nested` -> `example_variant` chain is the production-format
fixture for linked prefab ownership, nested stable actor paths, and variant override layering.
The variant hides `base-mesh` through an `EditorVisibility` component override targeted as
`nested-link / base-link / base-mesh` when the variant is placed in a scene.
Keep these files loadable by the editor and valid under `cargo validate-levels`. Broken-source,
cycle, and conflict fixtures belong in temporary test projects so the shipped asset tree remains
healthy.
+17
View File
@@ -0,0 +1,17 @@
(schema_version: 4,resources: {
},
entities: {
1: (components: {
"bevy_ecs::name::Name": "Example Base Mesh",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 0.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("base-mesh"),
"shared::components::ActorKind": Empty,
"shared::components::EditorVisibility": (visible: true),
"shared::components::LevelObject": (),
}),
},
)
+21
View File
@@ -0,0 +1,21 @@
(schema_version: 4,resources: {
},
entities: {
1: (components: {
"bevy_ecs::name::Name": "Example Base Link",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 0.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("base-link"),
"shared::components::ActorKind": PrefabAnchor,
"shared::components::LevelObject": (),
"shared::components::PrefabInstance": (
asset_id: "11111111-1111-4111-8111-111111111111",
source_path: "assets/prefabs/example_base.scn.ron",
overrides_ron: None,
),
}),
},
)
+21
View File
@@ -0,0 +1,21 @@
(schema_version: 4,resources: {
},
entities: {
1: (components: {
"bevy_ecs::name::Name": "Example Nested Variant Link",
"bevy_transform::components::transform::Transform": (
translation: (0.0, 0.0, 0.0),
rotation: (0.0, 0.0, 0.0, 1.0),
scale: (1.0, 1.0, 1.0),
),
"shared::components::ActorId": ("nested-link"),
"shared::components::ActorKind": PrefabAnchor,
"shared::components::LevelObject": (),
"shared::components::PrefabInstance": (
asset_id: "22222222-2222-4222-8222-222222222222",
source_path: "assets/prefabs/example_nested.scn.ron",
overrides_ron: Some("(format_version:2,source_revision:None,transform:None,material:None,child_visibility:{},properties:[],components:[(target:(instance_chain:[\"base-link\"],actor_id:\"base-mesh\"),component_type:\"shared::components::EditorVisibility\",base_component_ron:Some(\"(visible:true)\"),value_component_ron:Some(\"(visible:false)\"))],structural:[])"),
),
}),
},
)
+30
View File
@@ -1,8 +1,13 @@
( (
version: 1, version: 1,
project_id: "blacksite-foundation",
name: "Bevy FPS Foundation", name: "Bevy FPS Foundation",
project_kind: Game,
template_version: 1,
capabilities: ["editor", "gameplay", "rendering", "audio", "solari"],
default_level: "assets/levels/editor_scene.scn.ron", default_level: "assets/levels/editor_scene.scn.ron",
asset_roots: [ asset_roots: [
"assets/audio",
"assets/models", "assets/models",
"assets/textures", "assets/textures",
"assets/materials", "assets/materials",
@@ -29,6 +34,31 @@
shadow_first_cascade: 6.0, shadow_first_cascade: 6.0,
shadow_max_distance: 220.0, shadow_max_distance: 220.0,
), ),
audio: (
buses: [
(
id: "master",
label: "Master",
parent: None,
gain_db: 0.0,
muted: false,
),
(
id: "music",
label: "Music",
parent: Some("master"),
gain_db: 0.0,
muted: false,
),
(
id: "sfx",
label: "SFX",
parent: Some("master"),
gain_db: 0.0,
muted: false,
),
],
),
physics: ( physics: (
player_radius: 0.4, player_radius: 0.4,
player_length: 1.0, player_length: 1.0,
+42
View File
@@ -0,0 +1,42 @@
#import bevy_pbr::{
pbr_fragment::pbr_input_from_standard_material,
pbr_functions::alpha_discard,
}
#ifdef PREPASS_PIPELINE
#import bevy_pbr::{
prepass_io::{VertexOutput, FragmentOutput},
pbr_deferred_functions::deferred_output,
}
#else
#import bevy_pbr::{
forward_io::{VertexOutput, FragmentOutput},
pbr_functions::{apply_pbr_lighting, main_pass_post_lighting_processing},
}
#endif
struct SurfaceUniform {
shader_id: u32,
flags: u32,
alpha_cutoff: f32,
abi_version: u32,
params: array<vec4<f32>, 16>,
uv_transforms: array<vec4<f32>, 8>,
}
@group(#{MATERIAL_BIND_GROUP}) @binding(100) var<uniform> surface_uniform: SurfaceUniform;
@fragment
fn fragment(in: VertexOutput, @builtin(front_facing) is_front: bool) -> FragmentOutput {
var pbr_input = pbr_input_from_standard_material(in, is_front);
pbr_input.material.base_color = alpha_discard(pbr_input.material, pbr_input.material.base_color);
#ifdef PREPASS_PIPELINE
return deferred_output(in, pbr_input);
#else
var out: FragmentOutput;
out.color = apply_pbr_lighting(pbr_input);
out.color = main_pass_post_lighting_processing(pbr_input, out.color);
return out;
#endif
}
+64 -9
View File
@@ -1,17 +1,72 @@
( (
schema_version: 1,
label: "Standard Lit", label: "Standard Lit",
kind: StandardLit, kind: StandardLit,
wgsl_path: None, wgsl_path: None,
parameters: [ parameters: [
(name: "base_color", display_name: "Base Color", group: "Surface", property_type: Color), (
(name: "metallic", display_name: "Metallic", group: "Surface", property_type: Float(min: Some(0.0), max: Some(1.0))), name: "base_color",
(name: "roughness", display_name: "Roughness", group: "Surface", property_type: Float(min: Some(0.0), max: Some(1.0))), display_name: "Base Color",
(name: "emissive_color", display_name: "Emissive Color", group: "Emission", property_type: Color), group: "Surface",
(name: "emissive_intensity", display_name: "Emissive Nits", group: "Emission", property_type: Float(min: Some(0.0), max: Some(20000.0))), property_type: Color,
(name: "base_color_texture", display_name: "Base Color Texture", group: "Textures", property_type: Texture), ),
(name: "normal_map_texture", display_name: "Normal Map", group: "Textures", property_type: Texture), (
(name: "metallic_roughness_texture", display_name: "Metallic/Roughness Texture", group: "Textures", property_type: Texture), name: "metallic",
(name: "emissive_texture", display_name: "Emissive Texture", group: "Textures", property_type: Texture), display_name: "Metallic",
group: "Surface",
property_type: Float(
min: Some(0.0),
max: Some(1.0),
),
),
(
name: "roughness",
display_name: "Roughness",
group: "Surface",
property_type: Float(
min: Some(0.0),
max: Some(1.0),
),
),
(
name: "emissive_color",
display_name: "Emissive Color",
group: "Emission",
property_type: Color,
),
(
name: "emissive_intensity",
display_name: "Emissive Nits",
group: "Emission",
property_type: Float(
min: Some(0.0),
max: Some(20000.0),
),
),
(
name: "base_color_texture",
display_name: "Base Color Texture",
group: "Textures",
property_type: Texture,
),
(
name: "normal_map_texture",
display_name: "Normal Map",
group: "Textures",
property_type: Texture,
),
(
name: "metallic_roughness_texture",
display_name: "Metallic/Roughness Texture",
group: "Textures",
property_type: Texture,
),
(
name: "emissive_texture",
display_name: "Emissive Texture",
group: "Textures",
property_type: Texture,
),
], ],
default_values: [], default_values: [],
default_textures: [], default_textures: [],
+80
View File
@@ -0,0 +1,80 @@
(
schema_version: 1,
label: "Surface Tint",
kind: Custom,
wgsl_path: Some("assets/shaders/surface_tint.wgsl"),
parameters: [
(
name: "tint",
display_name: "Tint",
group: "Surface",
property_type: Color,
),
(
name: "roughness",
display_name: "Roughness",
group: "Surface",
property_type: Float(
min: Some(0.001),
max: Some(1.0),
),
),
(
name: "metallic",
display_name: "Metallic",
group: "Surface",
property_type: Float(
min: Some(0.0),
max: Some(1.0),
),
),
(
name: "emissive",
display_name: "Emissive",
group: "Emission",
property_type: Color,
),
(
name: "emissive_intensity",
display_name: "Emissive Nits",
group: "Emission",
property_type: Float(
min: Some(0.0),
max: Some(20000.0),
),
),
],
default_values: [
(
name: "tint",
value: Color((
r: 0.12,
g: 0.42,
b: 0.95,
a: 1.0,
)),
),
(
name: "roughness",
value: Float(0.28),
),
(
name: "metallic",
value: Float(0.15),
),
(
name: "emissive",
value: Color((
r: 0.02,
g: 0.08,
b: 0.25,
a: 1.0,
)),
),
(
name: "emissive_intensity",
value: Float(3.0),
),
],
default_textures: [],
)
+14
View File
@@ -0,0 +1,14 @@
fn evaluate(
input: SurfaceInput,
params: SurfaceParams,
samples: SurfaceSamples,
) -> Surface {
var surface = surface_default();
surface.base_color = params.lanes[0];
surface.perceptual_roughness = params.lanes[1].x;
surface.metallic = params.lanes[2].x;
surface.emissive = params.lanes[3].rgb * params.lanes[4].x;
surface.reflectance = 0.5;
surface.occlusion = 1.0;
return surface;
}
+116
View File
@@ -0,0 +1,116 @@
#import bevy_pbr::{
pbr_fragment::pbr_input_from_standard_material,
pbr_functions::{alpha_discard, calculate_tbn_mikktspace},
}
#ifdef PREPASS_PIPELINE
#import bevy_pbr::{
prepass_io::{VertexOutput, FragmentOutput},
pbr_deferred_functions::deferred_output,
}
#else
#import bevy_pbr::{
forward_io::{VertexOutput, FragmentOutput},
pbr_functions::{apply_pbr_lighting, main_pass_post_lighting_processing},
}
#endif
struct TerrainLayerUniform {
base_colors: array<vec4<f32>, 4>,
properties: array<vec4<f32>, 4>,
uv_scales: vec4<f32>,
base_texture_enabled: vec4<f32>,
}
@group(#{MATERIAL_BIND_GROUP}) @binding(100) var<uniform> terrain_layers: TerrainLayerUniform;
@group(#{MATERIAL_BIND_GROUP}) @binding(101) var base_color0: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(102) var base_sampler0: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(103) var normal0: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(104) var normal_sampler0: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(105) var base_color1: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(106) var base_sampler1: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(107) var normal1: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(108) var normal_sampler1: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(109) var base_color2: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(110) var base_sampler2: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(111) var normal2: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(112) var normal_sampler2: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(113) var base_color3: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(114) var base_sampler3: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(115) var normal3: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(116) var normal_sampler3: sampler;
fn layer_base(index: u32, uv: vec2<f32>) -> vec4<f32> {
if index == 0u { return textureSample(base_color0, base_sampler0, uv); }
if index == 1u { return textureSample(base_color1, base_sampler1, uv); }
if index == 2u { return textureSample(base_color2, base_sampler2, uv); }
return textureSample(base_color3, base_sampler3, uv);
}
fn layer_normal(index: u32, uv: vec2<f32>) -> vec3<f32> {
var sample = vec3<f32>(0.5, 0.5, 1.0);
if index == 0u { sample = textureSample(normal0, normal_sampler0, uv).xyz; }
if index == 1u { sample = textureSample(normal1, normal_sampler1, uv).xyz; }
if index == 2u { sample = textureSample(normal2, normal_sampler2, uv).xyz; }
if index == 3u { sample = textureSample(normal3, normal_sampler3, uv).xyz; }
return normalize(sample * 2.0 - 1.0);
}
@fragment
fn fragment(in: VertexOutput, @builtin(front_facing) is_front: bool) -> FragmentOutput {
var pbr_input = pbr_input_from_standard_material(in, is_front);
#ifdef VERTEX_UVS_A
let uv = in.uv;
#else
let uv = vec2<f32>(0.0);
#endif
#ifdef VERTEX_COLORS
var weights = max(in.color, vec4<f32>(0.0));
#else
var weights = vec4<f32>(1.0, 0.0, 0.0, 0.0);
#endif
let enabled = vec4<f32>(
terrain_layers.properties[0].w,
terrain_layers.properties[1].w,
terrain_layers.properties[2].w,
terrain_layers.properties[3].w,
);
weights *= enabled;
let total = dot(weights, vec4<f32>(1.0));
weights = select(vec4<f32>(1.0, 0.0, 0.0, 0.0), weights / total, total > 0.0001);
var color = vec4<f32>(0.0);
var normal_ts = vec3<f32>(0.0);
var metallic = 0.0;
var roughness = 0.0;
for (var index = 0u; index < 4u; index += 1u) {
let weight = weights[index];
let layer_uv = uv * terrain_layers.uv_scales[index];
let base_sample = mix(
vec4<f32>(1.0),
layer_base(index, layer_uv),
terrain_layers.base_texture_enabled[index],
);
color += base_sample * terrain_layers.base_colors[index] * weight;
let normal_enabled = terrain_layers.properties[index].z;
normal_ts += mix(vec3<f32>(0.0, 0.0, 1.0), layer_normal(index, layer_uv), normal_enabled) * weight;
metallic += terrain_layers.properties[index].x * weight;
roughness += terrain_layers.properties[index].y * weight;
}
pbr_input.material.base_color = alpha_discard(pbr_input.material, color);
pbr_input.material.metallic = clamp(metallic, 0.0, 1.0);
pbr_input.material.perceptual_roughness = clamp(roughness, 0.001, 1.0);
#ifdef VERTEX_TANGENTS
let tbn = calculate_tbn_mikktspace(pbr_input.world_normal, in.world_tangent);
let n = normalize(normal_ts);
pbr_input.N = normalize(n.x * tbn[0] + n.y * tbn[1] + n.z * tbn[2]);
#endif
#ifdef PREPASS_PIPELINE
return deferred_output(in, pbr_input);
#else
var out: FragmentOutput;
out.color = apply_pbr_lighting(pbr_input);
out.color = main_pass_post_lighting_processing(pbr_input, out.color);
return out;
#endif
}
+28 -4
View File
@@ -1,12 +1,36 @@
( (
schema_version: 1,
label: "Unlit", label: "Unlit",
kind: Unlit, kind: Unlit,
wgsl_path: None, wgsl_path: None,
parameters: [ parameters: [
(name: "base_color", display_name: "Base Color", group: "Surface", property_type: Color), (
(name: "base_color_texture", display_name: "Base Color Texture", group: "Textures", property_type: Texture), name: "base_color",
(name: "emissive_color", display_name: "Emissive Color", group: "Emission", property_type: Color), display_name: "Base Color",
(name: "emissive_intensity", display_name: "Emissive Nits", group: "Emission", property_type: Float(min: Some(0.0), max: Some(20000.0))), group: "Surface",
property_type: Color,
),
(
name: "base_color_texture",
display_name: "Base Color Texture",
group: "Textures",
property_type: Texture,
),
(
name: "emissive_color",
display_name: "Emissive Color",
group: "Emission",
property_type: Color,
),
(
name: "emissive_intensity",
display_name: "Emissive Nits",
group: "Emission",
property_type: Float(
min: Some(0.0),
max: Some(20000.0),
),
),
], ],
default_values: [], default_values: [],
default_textures: [], default_textures: [],
+13
View File
@@ -0,0 +1,13 @@
[package]
name = "blacksite_surface"
version.workspace = true
edition.workspace = true
license.workspace = true
description = "Blacksite raster and ray-tracing Surface ABI material runtime"
[dependencies]
bevy.workspace = true
naga = { version = "29", features = ["wgsl-in"] }
ron = "0.8"
shared.workspace = true
uuid = "1"
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,41 @@
@fragment
fn fragment(in: VertexOutput, @builtin(front_facing) is_front: bool) -> FragmentOutput {
var pbr_input = pbr_input_from_standard_material(in, is_front);
#ifdef VERTEX_UVS_A
let uv0 = in.uv;
#else
let uv0 = vec2<f32>(0.0);
#endif
let input = SurfaceInput(uv0, pbr_input.world_position.xyz, pbr_input.N);
let params = SurfaceParams(surface_uniform.params);
let surface = evaluate(input, params, surface_samples(uv0));
pbr_input.material.base_color = surface.base_color;
pbr_input.material.emissive = vec4<f32>(surface.emissive, 1.0);
pbr_input.material.metallic = clamp(surface.metallic, 0.0, 1.0);
pbr_input.material.perceptual_roughness = clamp(surface.perceptual_roughness, 0.001, 1.0);
pbr_input.material.reflectance = vec3<f32>(clamp(surface.reflectance, 0.0, 1.0));
pbr_input.diffuse_occlusion = vec3<f32>(clamp(surface.occlusion, 0.0, 1.0));
#ifdef VERTEX_TANGENTS
let surface_tbn = calculate_tbn_mikktspace(pbr_input.world_normal, in.world_tangent);
let surface_nt = normalize(surface.normal_ts);
pbr_input.N = normalize(
surface_nt.x * surface_tbn[0]
+ surface_nt.y * surface_tbn[1]
+ surface_nt.z * surface_tbn[2]
);
#endif
if surface.model == BLACKSITE_SURFACE_UNLIT {
pbr_input.material.flags |= STANDARD_MATERIAL_FLAGS_UNLIT_BIT;
} else {
pbr_input.material.flags &= ~STANDARD_MATERIAL_FLAGS_UNLIT_BIT;
}
pbr_input.material.base_color = alpha_discard(pbr_input.material, pbr_input.material.base_color);
#ifdef PREPASS_PIPELINE
return deferred_output(in, pbr_input);
#else
var out: FragmentOutput;
out.color = apply_pbr_lighting(pbr_input);
out.color = main_pass_post_lighting_processing(pbr_input, out.color);
return out;
#endif
}
@@ -0,0 +1,103 @@
#import bevy_pbr::{
pbr_fragment::pbr_input_from_standard_material,
pbr_functions::{alpha_discard, calculate_tbn_mikktspace},
}
#ifdef PREPASS_PIPELINE
#import bevy_pbr::{
prepass_io::{VertexOutput, FragmentOutput},
pbr_deferred_functions::deferred_output,
}
#else
#import bevy_pbr::{
forward_io::{VertexOutput, FragmentOutput},
pbr_functions::{apply_pbr_lighting, main_pass_post_lighting_processing},
}
#endif
const BLACKSITE_SURFACE_ABI_VERSION: u32 = 1u;
const BLACKSITE_SURFACE_UNLIT: u32 = 1u;
const STANDARD_MATERIAL_FLAGS_UNLIT_BIT: u32 = 1u << 5u;
struct SurfaceUniform {
shader_id: u32,
flags: u32,
alpha_cutoff: f32,
abi_version: u32,
params: array<vec4<f32>, 16>,
uv_transforms: array<vec4<f32>, 8>,
}
@group(#{MATERIAL_BIND_GROUP}) @binding(100) var<uniform> surface_uniform: SurfaceUniform;
@group(#{MATERIAL_BIND_GROUP}) @binding(101) var surface_texture0: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(102) var surface_sampler0: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(103) var surface_texture1: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(104) var surface_sampler1: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(105) var surface_texture2: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(106) var surface_sampler2: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(107) var surface_texture3: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(108) var surface_sampler3: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(109) var surface_texture4: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(110) var surface_sampler4: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(111) var surface_texture5: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(112) var surface_sampler5: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(113) var surface_texture6: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(114) var surface_sampler6: sampler;
@group(#{MATERIAL_BIND_GROUP}) @binding(115) var surface_texture7: texture_2d<f32>;
@group(#{MATERIAL_BIND_GROUP}) @binding(116) var surface_sampler7: sampler;
struct SurfaceInput {
uv0: vec2<f32>,
world_position: vec3<f32>,
world_normal: vec3<f32>,
}
struct SurfaceParams {
lanes: array<vec4<f32>, 16>,
}
struct SurfaceSamples {
values: array<vec4<f32>, 8>,
}
struct Surface {
base_color: vec4<f32>,
normal_ts: vec3<f32>,
emissive: vec3<f32>,
metallic: f32,
perceptual_roughness: f32,
reflectance: f32,
occlusion: f32,
model: u32,
}
fn surface_default() -> Surface {
var surface: Surface;
surface.base_color = vec4<f32>(1.0);
surface.normal_ts = vec3<f32>(0.0, 0.0, 1.0);
surface.emissive = vec3<f32>(0.0);
surface.metallic = 0.0;
surface.perceptual_roughness = 0.5;
surface.reflectance = 0.5;
surface.occlusion = 1.0;
surface.model = 0u;
return surface;
}
fn surface_uv(index: u32, uv: vec2<f32>) -> vec2<f32> {
let transform = surface_uniform.uv_transforms[index];
return uv * transform.xy + transform.zw;
}
fn surface_samples(uv: vec2<f32>) -> SurfaceSamples {
var samples: SurfaceSamples;
samples.values[0] = textureSample(surface_texture0, surface_sampler0, surface_uv(0u, uv));
samples.values[1] = textureSample(surface_texture1, surface_sampler1, surface_uv(1u, uv));
samples.values[2] = textureSample(surface_texture2, surface_sampler2, surface_uv(2u, uv));
samples.values[3] = textureSample(surface_texture3, surface_sampler3, surface_uv(3u, uv));
samples.values[4] = textureSample(surface_texture4, surface_sampler4, surface_uv(4u, uv));
samples.values[5] = textureSample(surface_texture5, surface_sampler5, surface_uv(5u, uv));
samples.values[6] = textureSample(surface_texture6, surface_sampler6, surface_uv(6u, uv));
samples.values[7] = textureSample(surface_texture7, surface_sampler7, surface_uv(7u, uv));
return samples;
}
+9 -1
View File
@@ -4,6 +4,7 @@ version.workspace = true
edition.workspace = true edition.workspace = true
license.workspace = true license.workspace = true
description = "In-process level editor for the Bevy FPS foundation" description = "In-process level editor for the Bevy FPS foundation"
default-run = "editor"
[lib] [lib]
name = "editor" name = "editor"
@@ -13,6 +14,10 @@ path = "src/lib.rs"
name = "editor" name = "editor"
path = "src/bin/main.rs" path = "src/bin/main.rs"
[[bin]]
name = "project_launcher"
path = "src/bin/project_launcher.rs"
[features] [features]
dev = ["bevy/dynamic_linking", "game/dev"] dev = ["bevy/dynamic_linking", "game/dev"]
hot-reload = ["game/hot-reload", "dep:hot-lib-reloader", "dep:notify"] hot-reload = ["game/hot-reload", "dep:hot-lib-reloader", "dep:notify"]
@@ -28,6 +33,7 @@ egui_phosphor_icons.workspace = true
bevy_ufbx.workspace = true bevy_ufbx.workspace = true
ufbx = "0.9" ufbx = "0.9"
game.workspace = true game.workspace = true
polyanya.workspace = true
game_hot.workspace = true game_hot.workspace = true
hot-lib-reloader = { version = "0.8.2", optional = true } hot-lib-reloader = { version = "0.8.2", optional = true }
notify = { version = "6.1", optional = true } notify = { version = "6.1", optional = true }
@@ -37,9 +43,11 @@ sim.workspace = true
settings.workspace = true settings.workspace = true
scene.workspace = true scene.workspace = true
serde.workspace = true serde.workspace = true
serde_json = "1"
transform-gizmo-bevy.workspace = true transform-gizmo-bevy.workspace = true
rfd = "0.17.2" rfd = "0.17.2"
ron = "0.8" ron = "0.8"
uuid = { version = "1", features = ["v4", "serde"] } uuid = { version = "1", features = ["v4", "serde"] }
walkdir = "2.5" walkdir = "2.5"
gltf = "1.4" gltf = { version = "1.4", features = ["extras"] }
blake3 = "1"
+896
View File
@@ -0,0 +1,896 @@
//! Generated animation artifacts for imported model sources.
use std::collections::BTreeSet;
use std::fs;
use std::path::Path;
use std::time::UNIX_EPOCH;
use serde::Deserialize;
use shared::{
animation_clip_sub_asset_id, animation_skeleton_sub_asset_id, AnimationClipRecord,
AnimationDiagnosticSeverity, AnimationEventDesc, AnimationImportDiagnostic, AnimationManifest,
AnimationManifestSource, AnimationSkeletonRecord, AnimationSkeletonSignature,
AnimationSourceFingerprint, ANIMATION_ARTIFACT_DIR, ANIMATION_MANIFEST_SCHEMA_VERSION,
};
use crate::asset_db::AssetRecord;
pub fn animation_manifest_path(asset_id: &str) -> String {
format!("{ANIMATION_ARTIFACT_DIR}/{asset_id}.animation.ron")
}
pub fn refresh_animation_artifact(record: &mut AssetRecord) -> Result<AnimationManifest, String> {
let mut manifest = build_animation_manifest(record)?;
manifest.source.dependencies.sort();
manifest.source.dependencies.dedup();
let path = animation_manifest_path(&record.id.as_string());
record.import_settings.animation_manifest_path = Some(path.clone());
record
.dependencies
.extend(manifest.source.dependencies.iter().cloned());
record.dependencies.sort();
record.dependencies.dedup();
let text = ron::ser::to_string_pretty(&manifest, ron::ser::PrettyConfig::default())
.map_err(|error| format!("could not serialize animation manifest: {error}"))?;
if let Some(parent) = Path::new(&path).parent() {
fs::create_dir_all(parent)
.map_err(|error| format!("could not create {}: {error}", parent.display()))?;
}
if fs::read_to_string(&path).ok().as_deref() != Some(text.as_str()) {
fs::write(&path, text)
.map_err(|error| format!("could not write animation manifest {path}: {error}"))?;
bevy::log::info!(
"Animation manifest refreshed: source={} artifact={} skeletons={} clips={} runtime_supported={}",
record.path,
path,
manifest.skeletons.len(),
manifest.clips.len(),
manifest.runtime_supported
);
}
Ok(manifest)
}
pub fn load_animation_manifest(path: &str) -> Result<AnimationManifest, String> {
let text =
fs::read_to_string(path).map_err(|error| format!("could not read {path}: {error}"))?;
ron::from_str(&text).map_err(|error| format!("could not parse {path}: {error}"))
}
pub fn build_animation_manifest(record: &AssetRecord) -> Result<AnimationManifest, String> {
let bytes = fs::read(&record.path)
.map_err(|error| format!("could not read {}: {error}", record.path))?;
let fingerprint = source_fingerprint(&record.path, &bytes)?;
let format = source_format(&record.path)?;
match format.as_str() {
"gltf" | "glb" => build_gltf_manifest(record, format, fingerprint, &bytes),
"fbx" => build_fbx_manifest(record, format, fingerprint, &bytes),
_ => Err(format!("unsupported animation source format `{format}`")),
}
}
#[derive(Debug, Clone)]
struct SkeletonCandidate {
compatible_nodes: BTreeSet<usize>,
signature: AnimationSkeletonSignature,
}
fn build_gltf_manifest(
record: &AssetRecord,
format: String,
fingerprint: AnimationSourceFingerprint,
bytes: &[u8],
) -> Result<AnimationManifest, String> {
let gltf = gltf::Gltf::from_slice(bytes)
.map_err(|error| format!("could not parse glTF {}: {error}", record.path))?;
let base = Path::new(&record.path).parent();
let buffers = gltf::import_buffers(&gltf.document, base, gltf.blob.clone())
.map_err(|error| format!("could not load glTF buffers for {}: {error}", record.path))?;
let mut dependencies = gltf
.document
.buffers()
.filter_map(|buffer| match buffer.source() {
gltf::buffer::Source::Uri(uri) if !uri.starts_with("data:") => {
Some(resolve_dependency(&record.path, uri))
}
_ => None,
})
.collect::<Vec<_>>();
dependencies.sort();
dependencies.dedup();
let node_identity_names = gltf
.document
.nodes()
.map(|node| bevy_node_segment(node.name(), node.index()))
.collect::<Vec<_>>();
let readable_node_names = gltf
.document
.nodes()
.map(|node| normalized_node_segment(node.name(), node.index()))
.collect::<Vec<_>>();
let mut parents = vec![None; node_identity_names.len()];
for node in gltf.document.nodes() {
for child in node.children() {
parents[child.index()] = Some(node.index());
}
}
let mut skeletons = Vec::new();
let mut candidates = Vec::new();
for skin in gltf.document.skins() {
let source_index = skin.index();
let label = skin
.name()
.filter(|name| !name.trim().is_empty())
.map(str::to_string)
.unwrap_or_else(|| format!("Skeleton {source_index}"));
let joint_indices = skin.joints().map(|joint| joint.index()).collect::<Vec<_>>();
let joint_identity_paths = joint_indices
.iter()
.map(|index| node_path_segments(*index, &node_identity_names, &parents))
.collect::<Vec<_>>();
let joint_paths = joint_indices
.iter()
.map(|index| node_path(*index, &readable_node_names, &parents))
.collect::<Vec<_>>();
let bind_poses = skin
.reader(|buffer| Some(buffers[buffer.index()].0.as_slice()))
.read_inverse_bind_matrices()
.map(|matrices| matrices.map(gltf_matrix_bytes).collect::<Vec<_>>())
.unwrap_or_else(|| vec![identity_matrix_bytes(); joint_paths.len()]);
let signature = skeleton_signature(&joint_identity_paths, &bind_poses);
let mut compatible_nodes = joint_indices.into_iter().collect::<BTreeSet<_>>();
if let Some(root) = skin.skeleton() {
compatible_nodes.insert(root.index());
}
candidates.push(SkeletonCandidate {
compatible_nodes,
signature: signature.clone(),
});
skeletons.push(AnimationSkeletonRecord {
id: animation_skeleton_sub_asset_id(source_index, &label),
label,
source_index,
signature,
joint_paths,
});
}
let mut diagnostics = Vec::new();
let mut clips = Vec::new();
let mut animation_roots = BTreeSet::new();
for animation in gltf.document.animations() {
let source_index = animation.index();
let label = animation
.name()
.filter(|name| !name.trim().is_empty())
.map(str::to_string)
.unwrap_or_else(|| format!("Animation {source_index}"));
let mut duration_seconds = 0.0_f32;
let mut target_nodes = BTreeSet::new();
for channel in animation.channels() {
let target_index = channel.target().node().index();
target_nodes.insert(target_index);
animation_roots.insert(top_level_node(target_index, &parents));
if let Some(inputs) = channel
.reader(|buffer| Some(buffers[buffer.index()].0.as_slice()))
.read_inputs()
{
for input in inputs {
if input.is_finite() {
duration_seconds = duration_seconds.max(input);
}
}
}
}
let target_skeleton_signature = matching_skeleton_signature(&target_nodes, &candidates);
if !candidates.is_empty() && target_skeleton_signature.is_none() {
diagnostics.push(AnimationImportDiagnostic {
severity: AnimationDiagnosticSeverity::Warning,
code: "animation.clip_skeleton_unresolved".into(),
message: format!(
"clip `{label}` does not target a uniquely identifiable imported skeleton"
),
repair: "Export the clip with channels targeting one skeleton, or split unrelated rigs into separate glTF assets.".into(),
});
}
let events = gltf_animation_events(&animation, duration_seconds, &label, &mut diagnostics);
clips.push(AnimationClipRecord {
id: animation_clip_sub_asset_id(source_index, &label),
label,
source_index,
duration_seconds,
target_skeleton_signature,
events,
});
}
let default_animation_clip_id = record.import_settings.default_animation_clip_id.clone();
validate_default_animation_clip(
default_animation_clip_id.as_deref(),
&clips,
&mut diagnostics,
);
let runtime_supported = animation_roots.len() <= 1;
if !runtime_supported {
let roots = animation_roots
.iter()
.map(|index| format!("`{}` (node {index})", node_identity_names[*index]))
.collect::<Vec<_>>()
.join(", ");
diagnostics.push(AnimationImportDiagnostic {
severity: AnimationDiagnosticSeverity::Error,
code: "animation.multiple_roots_unsupported".into(),
message: format!(
"animation channels target {} distinct top-level roots ({roots}); Bevy requires a separate AnimationPlayer for each root",
animation_roots.len()
),
repair: "Split the source into one animated rig per glTF asset, or export every clip under one common top-level root, then reimport.".into(),
});
}
Ok(AnimationManifest {
schema_version: ANIMATION_MANIFEST_SCHEMA_VERSION,
asset_id: record.id.as_string(),
label: record.label.clone(),
default_animation_clip_id,
source: AnimationManifestSource {
path: record.path.clone(),
format,
fingerprint,
dependencies,
},
runtime_supported,
skeletons,
clips,
diagnostics,
})
}
fn build_fbx_manifest(
record: &AssetRecord,
format: String,
fingerprint: AnimationSourceFingerprint,
bytes: &[u8],
) -> Result<AnimationManifest, String> {
let scene = ufbx::load_memory(
bytes,
ufbx::LoadOpts {
target_unit_meters: 1.0,
target_axes: ufbx::CoordinateAxes::right_handed_y_up(),
..Default::default()
},
)
.map_err(|error| format!("could not parse FBX {}: {error:?}", record.path))?;
let mut skeletons = Vec::new();
for (source_index, skin) in scene.skin_deformers.as_ref().iter().enumerate() {
let label = if skin.element.name.is_empty() {
format!("Skeleton {source_index}")
} else {
skin.element.name.to_string()
};
let mut joint_identity_paths = Vec::new();
let mut joint_paths = Vec::new();
let mut bind_poses = Vec::new();
for cluster in skin.clusters.as_ref() {
let Some(bone) = cluster.bone_node.as_ref() else {
continue;
};
let segments = fbx_node_path_segments(bone.as_ref());
joint_paths.push(segments.join("/"));
joint_identity_paths.push(segments);
bind_poses.push(fbx_matrix_bytes(&cluster.bind_to_world));
}
let signature = skeleton_signature(&joint_identity_paths, &bind_poses);
skeletons.push(AnimationSkeletonRecord {
id: animation_skeleton_sub_asset_id(source_index, &label),
label,
source_index,
signature,
joint_paths,
});
}
let fallback_signature = (skeletons.len() == 1).then(|| skeletons[0].signature.clone());
let clips = scene
.anim_stacks
.as_ref()
.iter()
.enumerate()
.map(|(source_index, stack)| {
let label = if stack.element.name.is_empty() {
format!("Animation {source_index}")
} else {
stack.element.name.to_string()
};
AnimationClipRecord {
id: animation_clip_sub_asset_id(source_index, &label),
label,
source_index,
duration_seconds: (stack.time_end - stack.time_begin).max(0.0) as f32,
target_skeleton_signature: fallback_signature.clone(),
events: Vec::new(),
}
})
.collect::<Vec<_>>();
let (runtime_supported, mut diagnostics) = fbx_runtime_support(
scene.anim_stacks.as_ref().len(),
scene.skin_deformers.as_ref().len(),
);
let default_animation_clip_id = record.import_settings.default_animation_clip_id.clone();
validate_default_animation_clip(
default_animation_clip_id.as_deref(),
&clips,
&mut diagnostics,
);
Ok(AnimationManifest {
schema_version: ANIMATION_MANIFEST_SCHEMA_VERSION,
asset_id: record.id.as_string(),
label: record.label.clone(),
default_animation_clip_id,
source: AnimationManifestSource {
path: record.path.clone(),
format,
fingerprint,
dependencies: Vec::new(),
},
runtime_supported,
skeletons,
clips,
diagnostics,
})
}
fn validate_default_animation_clip(
default_clip_id: Option<&str>,
clips: &[AnimationClipRecord],
diagnostics: &mut Vec<AnimationImportDiagnostic>,
) {
let Some(default_clip_id) = default_clip_id.filter(|id| !id.trim().is_empty()) else {
return;
};
if clips.iter().any(|clip| clip.id == default_clip_id) {
return;
}
diagnostics.push(AnimationImportDiagnostic {
severity: AnimationDiagnosticSeverity::Error,
code: "animation.default_clip_missing".into(),
message: format!(
"configured default animation clip `{default_clip_id}` no longer exists in the imported source"
),
repair: "Choose an existing Default animation in Model Import Settings, or select Imported rest pose, then reimport.".into(),
});
}
fn fbx_runtime_support(
animation_count: usize,
skin_count: usize,
) -> (bool, Vec<AnimationImportDiagnostic>) {
let mut diagnostics = Vec::new();
if animation_count > 0 || skin_count > 0 {
diagnostics.push(AnimationImportDiagnostic {
severity: AnimationDiagnosticSeverity::Error,
code: "animation.fbx_runtime_unsupported".into(),
message: format!(
"FBX contains {animation_count} animation stack(s) and {skin_count} skin deformer(s), but Blacksite's current FBX loader cannot build a runtime skeleton or clips"
),
repair: "Export the animated source as glTF 2.0 (.glb or .gltf). Keep FBX only for static mesh import until hierarchy, SkinnedMesh, and AnimationClip conversion are implemented.".into(),
});
}
(false, diagnostics)
}
#[derive(Debug, Default, Deserialize)]
struct GltfAnimationExtras {
#[serde(default)]
blacksite_events: Vec<GltfAnimationEvent>,
}
#[derive(Debug, Deserialize)]
struct GltfAnimationEvent {
id: String,
time_seconds: f32,
#[serde(default)]
payload: Option<String>,
}
fn gltf_animation_events(
animation: &gltf::Animation<'_>,
duration_seconds: f32,
clip_label: &str,
diagnostics: &mut Vec<AnimationImportDiagnostic>,
) -> Vec<AnimationEventDesc> {
let Some(raw) = animation.extras().as_ref() else {
return Vec::new();
};
let extras = match serde_json::from_str::<GltfAnimationExtras>(raw.get()) {
Ok(extras) => extras,
Err(error) => {
diagnostics.push(AnimationImportDiagnostic {
severity: AnimationDiagnosticSeverity::Warning,
code: "animation.events_invalid".into(),
message: format!("clip `{clip_label}` has invalid animation event metadata: {error}"),
repair: "Use an animation extras object with `blacksite_events` entries containing `id`, `time_seconds`, and optional string `payload`.".into(),
});
return Vec::new();
}
};
let mut events = Vec::new();
for event in extras.blacksite_events {
let valid_time = event.time_seconds.is_finite()
&& event.time_seconds >= 0.0
&& event.time_seconds <= duration_seconds;
if event.id.trim().is_empty() || !valid_time {
diagnostics.push(AnimationImportDiagnostic {
severity: AnimationDiagnosticSeverity::Warning,
code: "animation.event_out_of_range".into(),
message: format!(
"clip `{clip_label}` contains an event with an empty ID or time outside 0..={duration_seconds:.3}s"
),
repair: "Give every event a stable non-empty ID and place it within the imported clip duration.".into(),
});
continue;
}
events.push(AnimationEventDesc {
id: event.id,
time_seconds: event.time_seconds,
payload: event.payload,
});
}
events.sort_by(|left, right| {
left.time_seconds
.total_cmp(&right.time_seconds)
.then(left.id.cmp(&right.id))
.then(left.payload.cmp(&right.payload))
});
events
}
fn matching_skeleton_signature(
target_nodes: &BTreeSet<usize>,
candidates: &[SkeletonCandidate],
) -> Option<AnimationSkeletonSignature> {
let scored = candidates
.iter()
.map(|candidate| {
(
candidate
.compatible_nodes
.intersection(target_nodes)
.count(),
candidate,
)
})
.filter(|(score, _)| *score > 0)
.collect::<Vec<_>>();
let best_score = scored.iter().map(|(score, _)| *score).max()?;
let mut best = scored
.into_iter()
.filter(|(score, _)| *score == best_score)
.map(|(_, candidate)| candidate);
let candidate = best.next()?;
best.all(|other| other.signature == candidate.signature)
.then(|| candidate.signature.clone())
}
fn node_path(index: usize, names: &[String], parents: &[Option<usize>]) -> String {
node_path_segments(index, names, parents).join("/")
}
fn node_path_segments(index: usize, names: &[String], parents: &[Option<usize>]) -> Vec<String> {
let mut segments = Vec::new();
let mut current = Some(index);
while let Some(node_index) = current {
segments.push(names[node_index].clone());
current = parents[node_index];
}
segments.reverse();
segments
}
fn top_level_node(index: usize, parents: &[Option<usize>]) -> usize {
let mut current = index;
while let Some(parent) = parents[current] {
current = parent;
}
current
}
fn bevy_node_segment(name: Option<&str>, index: usize) -> String {
name.map(str::to_string)
.unwrap_or_else(|| format!("GltfNode{index}"))
}
fn normalized_node_segment(name: Option<&str>, index: usize) -> String {
name.map(str::trim)
.filter(|name| !name.is_empty())
.map(|name| name.replace(['/', '\\'], "_"))
.unwrap_or_else(|| format!("Node{index}"))
}
fn fbx_node_path_segments(node: &ufbx::Node) -> Vec<String> {
let mut segments = Vec::new();
let mut current = Some(node);
while let Some(node) = current {
segments.push(normalized_node_segment(
(!node.element.name.is_empty()).then(|| node.element.name.as_ref()),
node.element.element_id as usize,
));
current = node.parent.as_ref().map(|parent| parent.as_ref());
}
segments.reverse();
segments
}
fn skeleton_signature(
joint_path_segments: &[Vec<String>],
bind_pose_bytes: &[Vec<u8>],
) -> AnimationSkeletonSignature {
let mut hasher = blake3::Hasher::new();
hasher.update(b"blacksite-animation-skeleton-v2\0");
hasher.update(&(joint_path_segments.len() as u64).to_le_bytes());
for path in joint_path_segments {
hasher.update(&(path.len() as u64).to_le_bytes());
for segment in path {
let bytes = segment.as_bytes();
hasher.update(&(bytes.len() as u64).to_le_bytes());
hasher.update(bytes);
}
}
hasher.update(&(bind_pose_bytes.len() as u64).to_le_bytes());
for bytes in bind_pose_bytes {
hasher.update(&(bytes.len() as u64).to_le_bytes());
hasher.update(bytes);
}
AnimationSkeletonSignature::new(hasher.finalize().to_hex().to_string())
}
fn gltf_matrix_bytes(matrix: [[f32; 4]; 4]) -> Vec<u8> {
matrix
.into_iter()
.flatten()
.flat_map(f32::to_le_bytes)
.collect()
}
fn identity_matrix_bytes() -> Vec<u8> {
gltf_matrix_bytes([
[1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0],
])
}
fn fbx_matrix_bytes(matrix: &ufbx::Matrix) -> Vec<u8> {
[
matrix.m00, matrix.m10, matrix.m20, matrix.m01, matrix.m11, matrix.m21, matrix.m02,
matrix.m12, matrix.m22, matrix.m03, matrix.m13, matrix.m23,
]
.into_iter()
.flat_map(f64::to_le_bytes)
.collect()
}
fn source_fingerprint(path: &str, bytes: &[u8]) -> Result<AnimationSourceFingerprint, String> {
let metadata = fs::metadata(path).map_err(|error| format!("could not stat {path}: {error}"))?;
let modified_unix_secs = metadata
.modified()
.ok()
.and_then(|time| time.duration_since(UNIX_EPOCH).ok())
.map(|duration| duration.as_secs())
.unwrap_or_default();
Ok(AnimationSourceFingerprint {
byte_len: metadata.len(),
modified_unix_secs,
content_hash: blake3::hash(bytes).to_hex().to_string(),
})
}
fn source_format(path: &str) -> Result<String, String> {
Path::new(path)
.extension()
.and_then(|extension| extension.to_str())
.map(|extension| extension.to_ascii_lowercase())
.ok_or_else(|| format!("asset path `{path}` has no extension"))
}
fn resolve_dependency(source_path: &str, uri: &str) -> String {
Path::new(source_path)
.parent()
.unwrap_or_else(|| Path::new(""))
.join(uri)
.to_string_lossy()
.replace('\\', "/")
}
#[cfg(test)]
mod tests {
use super::*;
use crate::asset_db::{AssetId, ImportSettings};
use uuid::Uuid;
fn fixture_record(path: &Path) -> AssetRecord {
AssetRecord {
id: AssetId(Uuid::nil()),
path: path.to_string_lossy().replace('\\', "/"),
label: "Animated Hero".into(),
kind_tag: "Model".into(),
import_settings: ImportSettings::default(),
dependencies: Vec::new(),
}
}
fn write_animated_gltf(root: &Path) -> std::path::PathBuf {
fs::create_dir_all(root).unwrap();
let mut buffer = Vec::new();
for value in [0.0_f32, 1.25] {
buffer.extend_from_slice(&value.to_le_bytes());
}
for value in [0.0_f32, 0.0, 0.0, 1.0, 0.0, 0.38268343, 0.0, 0.9238795] {
buffer.extend_from_slice(&value.to_le_bytes());
}
fs::write(root.join("animated.bin"), buffer).unwrap();
let gltf = r#"{
"asset":{"version":"2.0"},
"scene":0,
"scenes":[{"nodes":[0]}],
"nodes":[{"name":"Armature","children":[1]},{"name":"Hip"}],
"skins":[{"name":"Hero Rig","skeleton":0,"joints":[1]}],
"buffers":[{"uri":"animated.bin","byteLength":40}],
"bufferViews":[
{"buffer":0,"byteOffset":0,"byteLength":8},
{"buffer":0,"byteOffset":8,"byteLength":32}
],
"accessors":[
{"bufferView":0,"componentType":5126,"count":2,"type":"SCALAR","min":[0.0],"max":[1.25]},
{"bufferView":1,"componentType":5126,"count":2,"type":"VEC4"}
],
"animations":[{
"name":"Idle Loop",
"samplers":[{"input":0,"output":1,"interpolation":"LINEAR"}],
"channels":[{"sampler":0,"target":{"node":1,"path":"rotation"}}],
"extras":{"blacksite_events":[{"id":"footstep.left","time_seconds":0.5,"payload":"stone"}]}
}]
}"#;
let path = root.join("animated.gltf");
fs::write(&path, gltf).unwrap();
path
}
fn write_multi_root_animated_gltf(root: &Path) -> std::path::PathBuf {
fs::create_dir_all(root).unwrap();
let mut buffer = Vec::new();
for value in [0.0_f32, 1.0] {
buffer.extend_from_slice(&value.to_le_bytes());
}
for value in [0.0_f32, 0.0, 0.0, 1.0, 0.0, 0.38268343, 0.0, 0.9238795] {
buffer.extend_from_slice(&value.to_le_bytes());
}
fs::write(root.join("multi-root.bin"), buffer).unwrap();
let gltf = r#"{
"asset":{"version":"2.0"},
"scene":0,
"scenes":[{"nodes":[0,2]}],
"nodes":[
{"name":"Character A","children":[1]},
{"name":"Joint A"},
{"name":"Character B","children":[3]},
{"name":"Joint B"}
],
"buffers":[{"uri":"multi-root.bin","byteLength":40}],
"bufferViews":[
{"buffer":0,"byteOffset":0,"byteLength":8},
{"buffer":0,"byteOffset":8,"byteLength":32}
],
"accessors":[
{"bufferView":0,"componentType":5126,"count":2,"type":"SCALAR","min":[0.0],"max":[1.0]},
{"bufferView":1,"componentType":5126,"count":2,"type":"VEC4"}
],
"animations":[{
"name":"Two Players Required",
"samplers":[
{"input":0,"output":1,"interpolation":"LINEAR"},
{"input":0,"output":1,"interpolation":"LINEAR"}
],
"channels":[
{"sampler":0,"target":{"node":1,"path":"rotation"}},
{"sampler":1,"target":{"node":3,"path":"rotation"}}
]
}]
}"#;
let path = root.join("multi-root.gltf");
fs::write(&path, gltf).unwrap();
path
}
#[test]
fn animation_manifest_path_uses_registry_uuid() {
assert_eq!(
animation_manifest_path("abc"),
"assets/animations/generated/abc.animation.ron"
);
}
#[test]
fn gltf_extraction_is_deterministic_and_preserves_duration_events_and_signature() {
let root = std::env::temp_dir().join(format!("blacksite-animation-{}", Uuid::new_v4()));
let path = write_animated_gltf(&root);
let record = fixture_record(&path);
let first = build_animation_manifest(&record).unwrap();
let second = build_animation_manifest(&record).unwrap();
assert_eq!(first, second);
assert_eq!(first.schema_version, ANIMATION_MANIFEST_SCHEMA_VERSION);
assert!(first.default_animation_clip_id.is_none());
assert!(first.runtime_supported);
assert_eq!(first.source.dependencies.len(), 1);
assert_eq!(first.skeletons.len(), 1);
assert_eq!(first.clips.len(), 1);
assert_eq!(first.skeletons[0].id, "animation:skeleton:0:hero_rig");
assert!(!first.skeletons[0].signature.is_empty());
assert_eq!(first.clips[0].id, "animation:clip:0:idle_loop");
assert_eq!(first.clips[0].duration_seconds, 1.25);
assert_eq!(
first.clips[0].target_skeleton_signature,
Some(first.skeletons[0].signature.clone())
);
assert_eq!(first.clips[0].events.len(), 1);
assert_eq!(first.clips[0].events[0].id, "footstep.left");
assert_eq!(first.clips[0].events[0].time_seconds, 0.5);
assert_eq!(first.diagnostics, Vec::new());
fs::remove_dir_all(root).unwrap();
}
#[test]
fn explicit_default_clip_is_stable_and_stale_ids_are_diagnostic() {
let root =
std::env::temp_dir().join(format!("blacksite-animation-default-{}", Uuid::new_v4()));
let path = write_animated_gltf(&root);
let mut record = fixture_record(&path);
record.import_settings.default_animation_clip_id =
Some("animation:clip:0:idle_loop".into());
let manifest = build_animation_manifest(&record).unwrap();
assert_eq!(
manifest.default_animation_clip_id.as_deref(),
Some("animation:clip:0:idle_loop")
);
assert!(manifest.diagnostics.is_empty());
record.import_settings.default_animation_clip_id = Some("animation:clip:99:removed".into());
let stale = build_animation_manifest(&record).unwrap();
assert!(stale.diagnostics.iter().any(|diagnostic| {
diagnostic.code == "animation.default_clip_missing"
&& diagnostic.severity == AnimationDiagnosticSeverity::Error
}));
fs::remove_dir_all(root).unwrap();
}
#[test]
fn exact_signature_changes_with_joint_path_or_bind_pose() {
let identity = identity_matrix_bytes();
let first = skeleton_signature(
&[vec!["Armature".into(), "Hip".into()]],
std::slice::from_ref(&identity),
);
let renamed = skeleton_signature(
&[vec!["Armature".into(), "Pelvis".into()]],
std::slice::from_ref(&identity),
);
let mut changed_pose = identity;
changed_pose[0] ^= 1;
let rebound = skeleton_signature(&[vec!["Armature".into(), "Hip".into()]], &[changed_pose]);
assert_ne!(first, renamed);
assert_ne!(first, rebound);
}
#[test]
fn exact_signature_preserves_bevy_node_bytes_and_segment_boundaries() {
let identity = identity_matrix_bytes();
let slash_in_name = vec![vec!["Armature".into(), "Hip/Joint".into()]];
let slash_as_boundary = vec![vec!["Armature/Hip".into(), "Joint".into()]];
assert_eq!(slash_in_name[0].join("/"), slash_as_boundary[0].join("/"));
assert_ne!(
skeleton_signature(&slash_in_name, std::slice::from_ref(&identity)),
skeleton_signature(&slash_as_boundary, std::slice::from_ref(&identity))
);
let backslash = vec![vec!["Armature".into(), "Hip\\Joint".into()]];
assert_eq!(
normalized_node_segment(Some("Hip/Joint"), 1),
normalized_node_segment(Some("Hip\\Joint"), 1)
);
assert_ne!(
skeleton_signature(&slash_in_name, std::slice::from_ref(&identity)),
skeleton_signature(&backslash, std::slice::from_ref(&identity))
);
assert_eq!(bevy_node_segment(Some(" /Joint "), 7), " /Joint ");
assert_eq!(bevy_node_segment(None, 7), "GltfNode7");
}
#[test]
fn gltf_with_multiple_animation_roots_is_runtime_unsupported() {
let root =
std::env::temp_dir().join(format!("blacksite-animation-multi-root-{}", Uuid::new_v4()));
let path = write_multi_root_animated_gltf(&root);
let manifest = build_animation_manifest(&fixture_record(&path)).unwrap();
assert!(!manifest.runtime_supported);
let diagnostic = manifest
.diagnostics
.iter()
.find(|diagnostic| diagnostic.code == "animation.multiple_roots_unsupported")
.expect("multi-root glTF should include an actionable blocking diagnostic");
assert_eq!(diagnostic.severity, AnimationDiagnosticSeverity::Error);
assert!(diagnostic.message.contains("2 distinct top-level roots"));
assert!(diagnostic.repair.contains("one common top-level root"));
fs::remove_dir_all(root).unwrap();
}
#[test]
fn animated_or_skinned_fbx_is_runtime_unsupported_with_repair_guidance() {
let (supported, diagnostics) = fbx_runtime_support(2, 1);
assert!(!supported);
assert_eq!(diagnostics.len(), 1);
assert_eq!(diagnostics[0].severity, AnimationDiagnosticSeverity::Error);
assert_eq!(diagnostics[0].code, "animation.fbx_runtime_unsupported");
assert!(diagnostics[0].repair.contains("glTF 2.0"));
let (supported, diagnostics) = fbx_runtime_support(0, 0);
assert!(!supported);
assert!(diagnostics.is_empty());
}
#[test]
fn committed_robot_fixture_exposes_a_skin_and_multiple_named_states() {
let path =
Path::new(env!("CARGO_MANIFEST_DIR")).join("../../assets/models/robot_expressive.glb");
let manifest = build_animation_manifest(&fixture_record(&path)).unwrap();
assert!(manifest.runtime_supported);
assert_eq!(manifest.skeletons.len(), 2);
assert_eq!(manifest.skeletons[0].id, "animation:skeleton:0:skeleton_0");
assert_eq!(manifest.skeletons[1].id, "animation:skeleton:1:skeleton_1");
assert!(manifest
.skeletons
.iter()
.all(|skeleton| skeleton.joint_paths.len() == 43));
let signature = &manifest.skeletons[0].signature;
assert!(manifest
.skeletons
.iter()
.all(|skeleton| &skeleton.signature == signature));
assert_eq!(manifest.clips.len(), 14);
for expected in ["Idle", "Walking", "Running", "Jump", "Wave"] {
assert!(
manifest.clips.iter().any(|clip| clip.label == expected),
"missing expected fixture clip {expected}"
);
}
assert!(manifest
.clips
.iter()
.all(|clip| clip.duration_seconds.is_finite() && clip.duration_seconds > 0.0));
assert!(manifest
.clips
.iter()
.all(|clip| { clip.target_skeleton_signature.as_ref() == Some(signature) }));
assert!(manifest.diagnostics.is_empty());
}
}
+190 -25
View File
@@ -2,7 +2,7 @@
use bevy::prelude::*; use bevy::prelude::*;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashMap; use std::collections::{HashMap, HashSet};
use uuid::Uuid; use uuid::Uuid;
/// Stable asset identity for dependency tracking and prefab references. /// Stable asset identity for dependency tracking and prefab references.
@@ -25,42 +25,31 @@ impl Default for AssetId {
} }
} }
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] #[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq, Eq)]
pub enum ModelPlacementMode { pub enum ModelPlacementMode {
/// Place renderable content through the appropriate normalized renderer. Imports containing
/// skins or animation route to `SkinnedMeshRenderer`; unrigged, non-animated content routes to
/// `StaticMeshRenderer`.
#[default]
StaticAsset, StaticAsset,
/// Instantiate the complete source scene as a generic imported model.
SceneInstance, SceneInstance,
} }
impl Default for ModelPlacementMode { #[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq, Eq)]
fn default() -> Self {
Self::StaticAsset
}
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
pub enum ModelHierarchyMode { pub enum ModelHierarchyMode {
#[default]
SingleActor, SingleActor,
SourceHierarchy, SourceHierarchy,
} }
impl Default for ModelHierarchyMode { #[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq, Eq)]
fn default() -> Self {
Self::SingleActor
}
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
pub enum MaterialImportPolicy { pub enum MaterialImportPolicy {
#[default]
SourceMaterials, SourceMaterials,
AuthoringOverride, AuthoringOverride,
} }
impl Default for MaterialImportPolicy {
fn default() -> Self {
Self::SourceMaterials
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ImportSettings { pub struct ImportSettings {
pub scale: f32, pub scale: f32,
@@ -74,6 +63,12 @@ pub struct ImportSettings {
pub material_policy: MaterialImportPolicy, pub material_policy: MaterialImportPolicy,
#[serde(default)] #[serde(default)]
pub static_mesh_manifest_path: Option<String>, pub static_mesh_manifest_path: Option<String>,
#[serde(default)]
pub animation_manifest_path: Option<String>,
/// Stable animation clip sub-asset ID used as this model's edit-mode rest presentation.
/// `None` preserves the imported node pose and never guesses a clip.
#[serde(default)]
pub default_animation_clip_id: Option<String>,
} }
impl Default for ImportSettings { impl Default for ImportSettings {
@@ -86,6 +81,8 @@ impl Default for ImportSettings {
hierarchy_mode: ModelHierarchyMode::default(), hierarchy_mode: ModelHierarchyMode::default(),
material_policy: MaterialImportPolicy::default(), material_policy: MaterialImportPolicy::default(),
static_mesh_manifest_path: None, static_mesh_manifest_path: None,
animation_manifest_path: None,
default_animation_clip_id: None,
} }
} }
} }
@@ -130,6 +127,11 @@ fn sync_registry_from_browser(
.drain(..) .drain(..)
.map(|record| (record.path.clone(), record)) .map(|record| (record.path.clone(), record))
.collect(); .collect();
let current_paths = assets
.assets
.iter()
.filter_map(|asset| asset.path.clone())
.collect::<HashSet<_>>();
let mut next_records = Vec::new(); let mut next_records = Vec::new();
let mut seen_paths = HashMap::new(); let mut seen_paths = HashMap::new();
@@ -144,7 +146,18 @@ fn sync_registry_from_browser(
seen_paths.insert(path.clone(), ()); seen_paths.insert(path.clone(), ());
let kind_tag = format!("{:?}", asset.kind); let kind_tag = format!("{:?}", asset.kind);
let mut record = if let Some(mut prior) = existing.remove(&path) { let mut record = if let Some(mut prior) = existing.remove(&path).or_else(|| {
take_uniquely_moved_model_record(&mut existing, &current_paths, &path, &kind_tag)
}) {
if prior.path != path {
info!(
"Asset registry preserved model identity {} across move {} -> {}",
prior.id.as_string(),
prior.path,
path
);
prior.path = path.clone();
}
prior.label = asset.label.clone(); prior.label = asset.label.clone();
prior.kind_tag = kind_tag; prior.kind_tag = kind_tag;
prior prior
@@ -159,9 +172,9 @@ fn sync_registry_from_browser(
} }
}; };
if record.kind_tag == "Model" { if record.kind_tag == "Model" {
if let Err(error) = super::static_mesh::refresh_static_mesh_artifact(&mut record) { if let Err(error) = super::refresh_model_artifacts(&mut record) {
warn!( warn!(
"Static mesh processor failed for {} (asset id {}): {error}", "Model artifact refresh failed for {} (asset id {}): {error}",
record.path, record.path,
record.id.as_string() record.id.as_string()
); );
@@ -185,6 +198,34 @@ fn sync_registry_from_browser(
} }
} }
fn take_uniquely_moved_model_record(
existing: &mut HashMap<String, AssetRecord>,
current_paths: &HashSet<String>,
new_path: &str,
kind_tag: &str,
) -> Option<AssetRecord> {
if kind_tag != "Model" {
return None;
}
let bytes = std::fs::read(new_path).ok()?;
let content_hash = blake3::hash(&bytes).to_hex().to_string();
let candidates = existing
.iter()
.filter_map(|(old_path, record)| {
if current_paths.contains(old_path) || record.kind_tag != "Model" {
return None;
}
let manifest_path = record.import_settings.animation_manifest_path.as_deref()?;
let manifest = super::animation::load_animation_manifest(manifest_path).ok()?;
(manifest.source.fingerprint.content_hash == content_hash).then(|| old_path.clone())
})
.collect::<Vec<_>>();
if candidates.len() != 1 {
return None;
}
existing.remove(&candidates[0])
}
pub fn find_asset_by_path(registry: &AssetRegistry, path: &str) -> Option<AssetRecord> { pub fn find_asset_by_path(registry: &AssetRegistry, path: &str) -> Option<AssetRecord> {
registry registry
.records .records
@@ -211,6 +252,34 @@ pub fn find_asset_mut_by_path<'a>(
.find(|record| record.path == path) .find(|record| record.path == path)
} }
pub fn ensure_asset_record(
registry: &mut AssetRegistry,
path: impl Into<String>,
label: impl Into<String>,
kind_tag: impl Into<String>,
) -> Result<AssetRecord, String> {
let path = path.into();
if let Some(record) = find_asset_by_path(registry, &path) {
return Ok(record);
}
let record = AssetRecord {
id: AssetId::new(),
path,
label: label.into(),
kind_tag: kind_tag.into(),
import_settings: ImportSettings::default(),
dependencies: Vec::new(),
};
registry.records.push(record.clone());
registry.index_dirty = true;
if let Err(error) = save_registry(registry) {
registry.records.pop();
return Err(error);
}
registry.index_dirty = false;
Ok(record)
}
pub fn update_import_settings( pub fn update_import_settings(
registry: &mut AssetRegistry, registry: &mut AssetRegistry,
path: &str, path: &str,
@@ -255,3 +324,99 @@ pub fn load_registry() -> AssetRegistry {
Err(_) => AssetRegistry::default(), Err(_) => AssetRegistry::default(),
} }
} }
#[cfg(test)]
mod tests {
use super::*;
use shared::{
AnimationManifest, AnimationManifestSource, AnimationSourceFingerprint,
ANIMATION_MANIFEST_SCHEMA_VERSION,
};
fn moved_model_fixture(bytes: &[u8]) -> (std::path::PathBuf, std::path::PathBuf, AssetRecord) {
let key = Uuid::new_v4();
let source_path = std::env::temp_dir().join(format!("blacksite-moved-model-{key}.glb"));
let manifest_path =
std::env::temp_dir().join(format!("blacksite-moved-model-{key}.animation.ron"));
std::fs::write(&source_path, bytes).unwrap();
let id = AssetId::new();
let old_path = format!("assets/models/old-{key}.glb");
let manifest = AnimationManifest {
schema_version: ANIMATION_MANIFEST_SCHEMA_VERSION,
asset_id: id.as_string(),
label: "Moved Model".into(),
default_animation_clip_id: None,
source: AnimationManifestSource {
path: old_path.clone(),
format: "glb".into(),
fingerprint: AnimationSourceFingerprint {
byte_len: bytes.len() as u64,
modified_unix_secs: 0,
content_hash: blake3::hash(bytes).to_hex().to_string(),
},
dependencies: Vec::new(),
},
runtime_supported: true,
skeletons: Vec::new(),
clips: Vec::new(),
diagnostics: Vec::new(),
};
std::fs::write(
&manifest_path,
ron::ser::to_string_pretty(&manifest, ron::ser::PrettyConfig::default()).unwrap(),
)
.unwrap();
let record = AssetRecord {
id,
path: old_path,
label: "Moved Model".into(),
kind_tag: "Model".into(),
import_settings: ImportSettings {
animation_manifest_path: Some(manifest_path.to_string_lossy().into_owned()),
..Default::default()
},
dependencies: Vec::new(),
};
(source_path, manifest_path, record)
}
#[test]
fn unique_content_match_preserves_model_record_across_move() {
let (source_path, manifest_path, record) = moved_model_fixture(b"stable model bytes");
let expected_id = record.id.clone();
let mut existing = HashMap::from([(record.path.clone(), record)]);
let moved = take_uniquely_moved_model_record(
&mut existing,
&HashSet::new(),
&source_path.to_string_lossy(),
"Model",
)
.expect("unique moved model should retain its registry record");
assert_eq!(moved.id, expected_id);
assert!(existing.is_empty());
let _ = std::fs::remove_file(source_path);
let _ = std::fs::remove_file(manifest_path);
}
#[test]
fn existing_source_path_is_not_reconciled_as_a_copy_move() {
let (source_path, manifest_path, record) = moved_model_fixture(b"copied model bytes");
let old_path = record.path.clone();
let mut existing = HashMap::from([(old_path.clone(), record)]);
let current_paths = HashSet::from([old_path]);
let moved = take_uniquely_moved_model_record(
&mut existing,
&current_paths,
&source_path.to_string_lossy(),
"Model",
);
assert!(moved.is_none());
assert_eq!(existing.len(), 1);
let _ = std::fs::remove_file(source_path);
let _ = std::fs::remove_file(manifest_path);
}
}
File diff suppressed because it is too large. Load diff
+101 -21
View File
@@ -2,10 +2,13 @@
use bevy::prelude::*; use bevy::prelude::*;
use bevy_egui::egui; use bevy_egui::egui;
use shared::{LevelObject, MaterialAsset, MaterialDesc}; use shared::{
ComponentInstanceId, LevelObject, MaterialAsset, MaterialDesc, MaterialRef,
RendererMaterialSlot,
};
use crate::assets::{EditorAsset, EditorAssetKind, EditorAssets}; use crate::assets::{EditorAsset, EditorAssetKind, EditorAssets};
use crate::history::set_material_with_history; use crate::history::{reflected_component_transaction, set_material_group_with_history};
use crate::ui::inspector::property_row; use crate::ui::inspector::property_row;
pub fn load_material_asset(catalog_path: &str) -> Result<MaterialAsset, String> { pub fn load_material_asset(catalog_path: &str) -> Result<MaterialAsset, String> {
@@ -13,38 +16,115 @@ pub fn load_material_asset(catalog_path: &str) -> Result<MaterialAsset, String>
} }
pub fn material_desc_from_asset(catalog_path: &str) -> Result<MaterialDesc, String> { pub fn material_desc_from_asset(catalog_path: &str) -> Result<MaterialDesc, String> {
let asset = load_material_asset(catalog_path)?; shared::load_resolved_material_from_path(catalog_path).map(|(desc, _)| desc)
let mut desc = asset.material;
desc.material_asset_path = Some(catalog_path.to_string());
Ok(desc)
} }
pub fn apply_material_asset_to_selection( pub fn apply_material_asset_to_selection(
world: &mut World, world: &mut World,
asset: &EditorAsset, asset: &EditorAsset,
selected: &bevy_inspector_egui::bevy_inspector::hierarchy::SelectedEntities, selected: &bevy_inspector_egui::bevy_inspector::hierarchy::SelectedEntities,
) { ) -> Result<(), String> {
let Some(path) = asset.path.clone() else { let path = asset
return; .path
.clone()
.ok_or_else(|| format!("Material has no source path: {}", asset.label))?;
let record = world
.get_resource::<crate::asset_db::AssetRegistry>()
.and_then(|registry| crate::asset_db::find_asset_by_path(registry, &path))
.ok_or_else(|| format!("Material is missing from the asset registry: {path}"))?;
let sub_asset_id = if shared::MaterialInstanceAsset::load_from_path(&path).is_ok() {
"material:instance"
} else {
"material:source"
}; };
let desc = match material_desc_from_asset(&path) { let material_ref = MaterialRef::new(
Ok(desc) => desc, shared::EditorAssetRef::new(record.id.as_string(), sub_asset_id, asset.label.clone())
Err(err) => { .with_source_path(path.clone()),
world.resource_mut::<crate::scene_io::SceneIo>().status = err; );
return; let desc = material_desc_from_asset(&path).ok();
} let entities = crate::ui::helpers::selected_level_entities(world, selected);
}; let mut renderer_changes = 0usize;
for entity in crate::ui::helpers::selected_level_entities(world, selected) { let mut legacy_changes = Vec::new();
for entity in entities {
if world.get::<LevelObject>(entity).is_none() { if world.get::<LevelObject>(entity).is_none() {
continue; continue;
} }
if world.get::<MaterialDesc>(entity).is_none() { if let Some(mut renderer) = world.get::<shared::StaticMeshRenderer>(entity).cloned() {
world.entity_mut(entity).insert(desc.clone()); ensure_static_material_slots(&mut renderer);
for slot in &mut renderer.materials.slots {
slot.material = Some(material_ref.clone());
} }
set_material_with_history(world, entity, desc.clone()); reflected_component_transaction(
world,
entity,
"Assign Material Slots",
shared::AUTHORING_COMPONENT_STATIC_MESH_RENDERER,
shared::COMPONENT_STATIC_MESH_RENDERER,
move |world, entity| {
world.entity_mut(entity).insert(renderer);
Ok(())
},
)?;
renderer_changes += 1;
continue;
}
if let Some(mut renderer) = world.get::<shared::SkinnedMeshRenderer>(entity).cloned() {
if renderer.materials.slots.is_empty() {
return Err(format!(
"Skinned renderer `{}` has no imported material slots; reimport its model",
renderer.path
));
}
for slot in &mut renderer.materials.slots {
slot.material = Some(material_ref.clone());
}
reflected_component_transaction(
world,
entity,
"Assign Material Slots",
shared::AUTHORING_COMPONENT_SKINNED_MESH_RENDERER,
shared::COMPONENT_SKINNED_MESH_RENDERER,
move |world, entity| {
world.entity_mut(entity).insert(renderer);
Ok(())
},
)?;
renderer_changes += 1;
continue;
}
if let Some(desc) = desc.as_ref() {
legacy_changes.push((entity, desc.clone()));
}
}
if !legacy_changes.is_empty() {
set_material_group_with_history(world, legacy_changes);
}
if renderer_changes == 0 && desc.is_none() {
return Err("No selected renderable actor accepts this material".into());
} }
world.resource_mut::<crate::scene_io::SceneIo>().status = world.resource_mut::<crate::scene_io::SceneIo>().status =
format!("Applied material {}", asset.label); format!("Applied shared material {}", asset.label);
Ok(())
}
pub(crate) fn ensure_static_material_slots(renderer: &mut shared::StaticMeshRenderer) {
for part in &mut renderer.slots {
if part.material_slot_id.0.trim().is_empty() {
part.material_slot_id = if part.id.0.trim().is_empty() {
ComponentInstanceId::new("slot:legacy")
} else {
ComponentInstanceId::new(format!("slot:{}", part.id.0))
};
}
if renderer.materials.slot(&part.material_slot_id).is_none() {
renderer.materials.slots.push(RendererMaterialSlot {
id: part.material_slot_id.clone(),
name: part.name.clone(),
source_material: part.material.clone().map(MaterialRef::new),
material: None,
});
}
}
} }
pub fn material_asset_picker_ui( pub fn material_asset_picker_ui(
+23 -2
View File
@@ -1,15 +1,36 @@
//! Asset catalog, database, thumbnails, materials, and prefab overrides. //! Asset catalog, database, thumbnails, materials, and prefab overrides.
pub mod animation;
pub mod asset_db; pub mod asset_db;
mod catalog; mod catalog;
mod import; mod import;
pub mod materials; pub mod materials;
pub mod operators;
pub mod prefab_overrides; pub mod prefab_overrides;
pub mod static_mesh; pub mod static_mesh;
pub mod thumbnails; pub mod thumbnails;
pub use catalog::*; pub use catalog::*;
pub use thumbnails::{ pub use thumbnails::{
draw_asset_cell_with, invalidate_on_catalog_refresh, kind_icon, prefetch_folder_thumbnails, draw_asset_cell_with, gltf_skinned_primitive_labels, invalidate_on_catalog_refresh, kind_icon,
AssetThumbnailCache, ThumbnailCacheSnapshot, ThumbnailState, ThumbnailStudio, ThumbnailsPlugin, prefetch_asset_thumbnails, prefetch_folder_thumbnails, AssetThumbnailCache,
ThumbnailCacheSnapshot, ThumbnailState, ThumbnailStudio, ThumbnailsPlugin,
}; };
/// Refreshes both generated contracts derived from one imported model source.
pub fn refresh_model_artifacts(
record: &mut asset_db::AssetRecord,
) -> Result<static_mesh::StaticMeshManifest, String> {
let static_mesh = static_mesh::refresh_static_mesh_artifact(record);
let animation = animation::refresh_animation_artifact(record);
match (static_mesh, animation) {
(Ok(static_mesh), Ok(_)) => Ok(static_mesh),
(Err(static_error), Ok(_)) => Err(format!("static mesh processor failed: {static_error}")),
(Ok(_), Err(animation_error)) => {
Err(format!("animation processor failed: {animation_error}"))
}
(Err(static_error), Err(animation_error)) => Err(format!(
"static mesh processor failed: {static_error}; animation processor failed: {animation_error}"
)),
}
}
+536
View File
@@ -0,0 +1,536 @@
//! Operator wrappers for asset placement and assignment workflows.
use bevy::prelude::*;
use bevy_inspector_egui::bevy_inspector::hierarchy::SelectedEntities;
use crate::operators::{run_immediate_operator, OperatorAvailability};
use crate::ui::helpers::{
apply_material_asset_to_selection, apply_texture_to_selection, selected_level_entities,
};
use super::{
animation_clip_authoring_data, animation_skeleton_signature_for_ref, audio_clip_ref_for_asset,
compatible_animation_skeleton_for_model, spawn_asset_at, spawn_subasset_at,
validate_prefab_asset, AssetSelection, EditorAsset,
};
fn selection_availability(world: &World, selected: &SelectedEntities) -> OperatorAvailability {
if selected_level_entities(world, selected).is_empty() {
OperatorAvailability::Disabled("Select at least one authored actor".to_string())
} else {
OperatorAvailability::Ready
}
}
pub fn place_asset_operator(world: &mut World, asset: EditorAsset, translation: Vec3) -> bool {
let label = format!("Place {}", asset.label);
run_immediate_operator(
world,
"assets.place",
&label,
OperatorAvailability::Ready,
move |world| {
validate_prefab_asset(world, &asset)?;
spawn_asset_at(world, &asset, translation)
.map(|_| ())
.ok_or_else(|| format!("Asset cannot be placed: {}", asset.label))
},
)
}
pub fn place_subasset_operator(
world: &mut World,
selection: AssetSelection,
translation: Vec3,
) -> bool {
let label = format!("Place {}", selection.display_label());
run_immediate_operator(
world,
"assets.place_subasset",
&label,
OperatorAvailability::Ready,
move |world| {
spawn_subasset_at(world, &selection, translation)
.map(|_| ())
.ok_or_else(|| format!("Sub-asset cannot be placed: {}", selection.display_label()))
},
)
}
pub fn apply_texture_operator(
world: &mut World,
asset: EditorAsset,
selected: &SelectedEntities,
) -> bool {
let label = format!("Apply Texture {}", asset.label);
let availability = selection_availability(world, selected);
run_immediate_operator(
world,
"assets.apply_texture",
&label,
availability,
move |world| apply_texture_to_selection(world, &asset, selected),
)
}
pub fn apply_material_operator(
world: &mut World,
asset: EditorAsset,
selected: &SelectedEntities,
) -> bool {
let label = format!("Apply Material {}", asset.label);
let availability = selection_availability(world, selected);
run_immediate_operator(
world,
"assets.apply_material",
&label,
availability,
move |world| apply_material_asset_to_selection(world, &asset, selected),
)
}
pub fn assign_audio_clip_operator(world: &mut World, asset: EditorAsset, entity: Entity) -> bool {
let availability = if world.get::<shared::AudioSourceDesc>(entity).is_some() {
OperatorAvailability::Ready
} else {
OperatorAvailability::Disabled("Select an authored audio source".to_string())
};
let label = format!("Assign Audio Clip {}", asset.label);
run_immediate_operator(
world,
"assets.assign_audio_clip",
&label,
availability,
move |world| {
let clip = audio_clip_ref_for_asset(world, &asset)?;
let mut source = world
.get::<shared::AudioSourceDesc>(entity)
.cloned()
.ok_or_else(|| "Selected actor is not an audio source".to_string())?;
source.clip = Some(clip);
crate::history::set_audio_source_with_history(world, entity, source);
Ok(())
},
)
}
pub fn assign_animation_clip_operator(
world: &mut World,
selection: AssetSelection,
entity: Entity,
) -> bool {
let availability = if world.get::<shared::SkinnedMeshRenderer>(entity).is_some() {
OperatorAvailability::Ready
} else {
OperatorAvailability::Disabled("Select an authored skinned-mesh actor".to_string())
};
let label = format!("Assign Animation Clip {}", selection.display_label());
run_immediate_operator(
world,
"assets.assign_animation_clip",
&label,
availability,
move |world| {
let authored = animation_clip_authoring_data(world, &selection)?;
let model = world
.get::<shared::SkinnedMeshRenderer>(entity)
.cloned()
.ok_or_else(|| "Selected actor has no SkinnedMeshRenderer".to_string())?;
let mut controller = world
.get::<shared::AnimationControllerDesc>(entity)
.cloned()
.unwrap_or_default();
let skeleton = match controller.skeleton.as_ref() {
Some(reference) => {
let existing_signature =
animation_skeleton_signature_for_ref(world, reference)?;
if existing_signature != authored.skeleton_signature {
return Err(format!(
"Clip `{}` targets rig `{}` but the actor uses `{}`. Animation v1 requires an exact skeleton match.",
authored.state.label,
authored.skeleton_signature.0,
existing_signature.0
));
}
reference.clone()
}
None => compatible_animation_skeleton_for_model(
world,
&model,
&authored.skeleton_signature,
)?,
};
if controller.states.iter().any(|state| {
state.clip.asset_id == authored.state.clip.asset_id
&& state.clip.sub_asset_id == authored.state.clip.sub_asset_id
}) {
return Err(format!(
"Animation controller already contains clip `{}`.",
authored.state.label
));
}
let mut state = authored.state;
let base_id = state.id.clone();
let mut suffix = 2;
while controller.states.iter().any(|entry| entry.id == state.id) {
state.id = format!("{base_id}_{suffix}");
suffix += 1;
}
controller.skeleton = Some(skeleton);
if controller.default_state.trim().is_empty() {
controller.default_state = state.id.clone();
}
controller.states.push(state);
crate::history::set_animation_controller_with_history(world, entity, controller);
Ok(())
},
)
}
#[cfg(test)]
mod tests {
use super::*;
use shared::{
animation_clip_sub_asset_id, animation_skeleton_sub_asset_id, ActorKind,
AnimationClipRecord, AnimationControllerDesc, AnimationManifest, AnimationManifestSource,
AnimationSkeletonRecord, AnimationSkeletonSignature, AnimationSourceFingerprint,
AudioSourceDesc, LevelObject, MaterialDesc, PrimitiveShape, SkinnedMeshRenderer,
ANIMATION_MANIFEST_SCHEMA_VERSION,
};
use crate::asset_db::{AssetId, AssetRecord, AssetRegistry, ImportSettings};
use crate::history::EditorHistory;
use crate::operators::test_harness::{assert_undo_redo_round_trip, OperatorInvariantHarness};
use crate::operators::ActiveOperator;
use crate::scene_io::SceneIo;
use crate::selection::SelectedEntity;
fn authored_count(world: &mut World) -> usize {
let mut query = world.query_filtered::<Entity, With<LevelObject>>();
query.iter(world).count()
}
fn animation_fixture() -> (std::path::PathBuf, AssetRecord, AssetSelection) {
let model_path = "assets/models/operator_fixture.glb".to_string();
let asset_id = AssetId::new();
let skeleton_id = animation_skeleton_sub_asset_id(0, "Rig");
let clip_id = animation_clip_sub_asset_id(0, "Idle");
let manifest = AnimationManifest {
schema_version: ANIMATION_MANIFEST_SCHEMA_VERSION,
asset_id: asset_id.as_string(),
label: "Operator Fixture".into(),
default_animation_clip_id: None,
source: AnimationManifestSource {
path: model_path.clone(),
format: "glb".into(),
fingerprint: AnimationSourceFingerprint {
byte_len: 1,
modified_unix_secs: 0,
content_hash: "fixture".into(),
},
dependencies: Vec::new(),
},
runtime_supported: true,
skeletons: vec![AnimationSkeletonRecord {
id: skeleton_id,
label: "Rig".into(),
source_index: 0,
signature: AnimationSkeletonSignature::new("exact-rig"),
joint_paths: vec!["Root".into()],
}],
clips: vec![AnimationClipRecord {
id: clip_id.clone(),
label: "Idle".into(),
source_index: 0,
duration_seconds: 1.0,
target_skeleton_signature: Some(AnimationSkeletonSignature::new("exact-rig")),
events: Vec::new(),
}],
diagnostics: Vec::new(),
};
let path = std::env::temp_dir().join(format!(
"blacksite-animation-operator-{}.animation.ron",
uuid::Uuid::new_v4()
));
std::fs::write(
&path,
ron::ser::to_string_pretty(&manifest, ron::ser::PrettyConfig::default()).unwrap(),
)
.unwrap();
let record = AssetRecord {
id: asset_id,
path: model_path.clone(),
label: "Operator Fixture".into(),
kind_tag: "Model".into(),
import_settings: ImportSettings {
animation_manifest_path: Some(path.to_string_lossy().into_owned()),
..Default::default()
},
dependencies: Vec::new(),
};
let selection = AssetSelection::SubAsset {
parent_path: model_path.clone(),
sub_asset_id: clip_id,
label: "Idle".into(),
kind: super::super::AssetSubAssetKind::AnimationClip,
source_path: Some(model_path),
};
(path, record, selection)
}
#[test]
fn asset_placement_commits_one_undo_group_and_round_trips() {
let mut world = World::new();
world.init_resource::<ActiveOperator>();
world.init_resource::<EditorHistory>();
world.init_resource::<SceneIo>();
world.init_resource::<SelectedEntity>();
let harness = OperatorInvariantHarness::capture(&mut world);
let asset = EditorAsset {
label: "Cube".to_string(),
path: None,
folder_path: "Built-ins".to_string(),
kind: super::super::EditorAssetKind::Primitive(PrimitiveShape::Box),
};
assert!(place_asset_operator(&mut world, asset, Vec3::ZERO));
harness.assert_committed(&mut world, 1, 1);
assert_undo_redo_round_trip(&mut world, 0, 1, authored_count);
}
#[test]
fn animation_clip_placement_creates_only_the_skinned_renderer_path() {
let mut world = World::new();
world.init_resource::<ActiveOperator>();
world.init_resource::<EditorHistory>();
world.init_resource::<SceneIo>();
world.init_resource::<SelectedEntity>();
let (manifest_path, record, selection) = animation_fixture();
world.insert_resource(AssetRegistry {
records: vec![record],
index_dirty: false,
});
let harness = OperatorInvariantHarness::capture(&mut world);
assert!(place_subasset_operator(
&mut world,
selection,
Vec3::new(1.0, 2.0, 3.0),
));
let entity = world
.query_filtered::<Entity, With<LevelObject>>()
.single(&world)
.unwrap();
assert_eq!(
world.get::<ActorKind>(entity),
Some(&ActorKind::SkinnedMesh)
);
assert!(world.get::<SkinnedMeshRenderer>(entity).is_some());
assert!(world.get::<AnimationControllerDesc>(entity).is_some());
assert!(world.get::<shared::ModelRef>(entity).is_none());
assert!(world.get::<shared::StaticMeshRenderer>(entity).is_none());
harness.assert_committed(&mut world, 1, 1);
assert_undo_redo_round_trip(&mut world, 0, 1, authored_count);
let _ = std::fs::remove_file(manifest_path);
}
#[test]
fn audio_clip_assignment_is_one_undoable_operator() {
let mut world = World::new();
world.init_resource::<ActiveOperator>();
world.init_resource::<EditorHistory>();
world.init_resource::<SceneIo>();
let path = "assets/audio/impact.ogg".to_string();
world.insert_resource(AssetRegistry {
records: vec![AssetRecord {
id: AssetId::new(),
path: path.clone(),
label: "Impact".into(),
kind_tag: "AudioClip".into(),
import_settings: Default::default(),
dependencies: Vec::new(),
}],
index_dirty: false,
});
let entity = world
.spawn((
LevelObject,
ActorKind::AudioSource,
Transform::IDENTITY,
AudioSourceDesc::default(),
))
.id();
let asset = EditorAsset {
label: "Impact".into(),
path: Some(path.clone()),
folder_path: "assets/audio".into(),
kind: super::super::EditorAssetKind::AudioClip,
};
let harness = OperatorInvariantHarness::capture(&mut world);
let read_clip = move |world: &mut World| {
world
.get::<AudioSourceDesc>(entity)
.and_then(|source| source.clip.clone())
};
assert!(assign_audio_clip_operator(&mut world, asset, entity));
let assigned = read_clip(&mut world).expect("clip assigned");
assert_eq!(assigned.source_path.as_deref(), Some(path.as_str()));
harness.assert_committed(&mut world, 1, 0);
assert_undo_redo_round_trip(&mut world, None, Some(assigned), read_clip);
}
#[test]
fn animation_clip_assignment_is_one_undoable_operator() {
let mut world = World::new();
world.init_resource::<ActiveOperator>();
world.init_resource::<EditorHistory>();
world.init_resource::<SceneIo>();
let (manifest_path, record, selection) = animation_fixture();
let model_path = record.path.clone();
world.insert_resource(AssetRegistry {
records: vec![record],
index_dirty: false,
});
let entity = world
.spawn((
LevelObject,
ActorKind::SkinnedMesh,
SkinnedMeshRenderer::new(model_path),
))
.id();
let harness = OperatorInvariantHarness::capture(&mut world);
let read_controller =
move |world: &mut World| world.get::<AnimationControllerDesc>(entity).cloned();
assert!(assign_animation_clip_operator(
&mut world, selection, entity
));
let assigned = read_controller(&mut world).expect("controller assigned");
assert_eq!(assigned.default_state, "idle");
assert_eq!(assigned.states.len(), 1);
assert_eq!(assigned.states[0].id, "idle");
assert_eq!(
assigned.skeleton.as_ref().unwrap().sub_asset_id,
animation_skeleton_sub_asset_id(0, "Rig")
);
harness.assert_committed(&mut world, 1, 0);
assert_undo_redo_round_trip(&mut world, None, Some(assigned), read_controller);
let _ = std::fs::remove_file(manifest_path);
}
#[test]
fn multi_actor_texture_assignment_is_one_undo_group() {
let mut world = World::new();
world.init_resource::<ActiveOperator>();
world.init_resource::<EditorHistory>();
world.init_resource::<SceneIo>();
let first = world.spawn((LevelObject, MaterialDesc::default())).id();
let second = world.spawn((LevelObject, MaterialDesc::default())).id();
let mut selected = SelectedEntities::default();
selected.select_replace(first);
selected.select_maybe_add(second, true);
let asset = EditorAsset {
label: "Grid".to_string(),
path: Some("assets/textures/grid.png".to_string()),
folder_path: "assets/textures".to_string(),
kind: super::super::EditorAssetKind::Texture,
};
let harness = OperatorInvariantHarness::capture(&mut world);
let read_textures = move |world: &mut World| {
[first, second]
.into_iter()
.map(|entity| {
world
.get::<MaterialDesc>(entity)
.and_then(|material| material.base_color_texture.clone())
})
.collect::<Vec<_>>()
};
assert!(apply_texture_operator(&mut world, asset, &selected));
harness.assert_committed(&mut world, 1, 0);
assert_undo_redo_round_trip(
&mut world,
vec![None, None],
vec![
Some("assets/textures/grid.png".to_string()),
Some("assets/textures/grid.png".to_string()),
],
read_textures,
);
}
#[test]
fn missing_subasset_commit_cancels_without_side_effects() {
let mut world = World::new();
world.init_resource::<ActiveOperator>();
world.init_resource::<EditorHistory>();
world.init_resource::<SceneIo>();
let harness = OperatorInvariantHarness::capture(&mut world);
let selection = AssetSelection::SubAsset {
parent_path: "assets/models/missing.glb".to_string(),
sub_asset_id: "mesh:missing".to_string(),
label: "Missing Mesh".to_string(),
kind: super::super::AssetSubAssetKind::Mesh,
source_path: None,
};
assert!(!place_subasset_operator(&mut world, selection, Vec3::ZERO));
harness.assert_canceled(&mut world);
}
#[test]
fn missing_material_source_cancels_without_side_effects() {
let mut world = World::new();
world.init_resource::<ActiveOperator>();
world.init_resource::<EditorHistory>();
world.init_resource::<SceneIo>();
let entity = world.spawn(LevelObject).id();
let mut selected = SelectedEntities::default();
selected.select_replace(entity);
let harness = OperatorInvariantHarness::capture(&mut world);
let asset = EditorAsset {
label: "Missing Material".to_string(),
path: Some("assets/materials/does-not-exist.material.ron".to_string()),
folder_path: "assets/materials".to_string(),
kind: super::super::EditorAssetKind::Material,
};
assert!(!apply_material_operator(&mut world, asset, &selected));
harness.assert_canceled(&mut world);
}
#[test]
fn texture_assignment_without_authored_selection_is_blocked() {
let mut world = World::new();
world.init_resource::<ActiveOperator>();
world.init_resource::<EditorHistory>();
world.init_resource::<SceneIo>();
let harness = OperatorInvariantHarness::capture(&mut world);
let asset = EditorAsset {
label: "Grid".to_string(),
path: Some("assets/textures/grid.png".to_string()),
folder_path: "assets/textures".to_string(),
kind: super::super::EditorAssetKind::Texture,
};
assert!(!apply_texture_operator(
&mut world,
asset,
&SelectedEntities::default()
));
harness.assert_blocked(&mut world);
}
}
File diff suppressed because it is too large. Load diff
+169 -17
View File
@@ -14,9 +14,12 @@ use serde::{Deserialize, Serialize};
use crate::asset_db::{ use crate::asset_db::{
AssetRecord, ImportSettings, MaterialImportPolicy, ModelHierarchyMode, ModelPlacementMode, AssetRecord, ImportSettings, MaterialImportPolicy, ModelHierarchyMode, ModelPlacementMode,
}; };
use shared::{ComponentInstanceId, EditorAssetRef, StaticMeshRenderer, StaticMeshRendererEntry}; use shared::{
ComponentInstanceId, EditorAssetRef, MaterialRef, RendererMaterialSet, RendererMaterialSlot,
StaticMeshRenderer, StaticMeshRendererEntry,
};
pub const STATIC_MESH_MANIFEST_SCHEMA: u32 = 1; pub const STATIC_MESH_MANIFEST_SCHEMA: u32 = 3;
pub const STATIC_MESH_ARTIFACT_DIR: &str = "assets/meshes/generated"; pub const STATIC_MESH_ARTIFACT_DIR: &str = "assets/meshes/generated";
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
@@ -80,6 +83,10 @@ pub struct StaticMeshPart {
pub source_node: Option<String>, pub source_node: Option<String>,
pub source_mesh: Option<String>, pub source_mesh: Option<String>,
pub source_material: Option<String>, pub source_material: Option<String>,
/// Whether the source primitive is bound to a skin and therefore must never become a static
/// renderer slot.
#[serde(default)]
pub skinned: bool,
} }
pub fn static_mesh_manifest_path(asset_id: &str) -> String { pub fn static_mesh_manifest_path(asset_id: &str) -> String {
@@ -94,6 +101,17 @@ pub fn material_id_from_label(label: &str) -> String {
format!("material:{}", stable_sub_asset_slug(label)) format!("material:{}", stable_sub_asset_slug(label))
} }
fn gltf_draw_id(node_index: Option<usize>, mesh_index: usize, primitive_index: usize) -> String {
let node = node_index
.map(|index| index.to_string())
.unwrap_or_else(|| "unbound".into());
format!("draw:scene0:node{node}:mesh{mesh_index}:primitive{primitive_index}")
}
fn fbx_draw_id(node_index: usize, material_index: usize) -> String {
format!("draw:scene0:node{node_index}:material{material_index}")
}
fn stable_sub_asset_slug(label: &str) -> String { fn stable_sub_asset_slug(label: &str) -> String {
let mut slug = String::new(); let mut slug = String::new();
for ch in label.chars() { for ch in label.chars() {
@@ -151,10 +169,10 @@ pub fn renderer_from_manifest(
MaterialImportPolicy::SourceMaterials MaterialImportPolicy::SourceMaterials
); );
StaticMeshRenderer { let parts: Vec<_> = manifest
slots: manifest
.parts .parts
.iter() .iter()
.filter(|part| !part.skinned && manifest.metadata.animation_count == 0)
.map(|part| StaticMeshRendererEntry { .map(|part| StaticMeshRendererEntry {
id: ComponentInstanceId::new(part_effective_id(part)), id: ComponentInstanceId::new(part_effective_id(part)),
name: part.name.clone(), name: part.name.clone(),
@@ -163,6 +181,7 @@ pub fn renderer_from_manifest(
part_effective_id(part), part_effective_id(part),
part.name.clone(), part.name.clone(),
), ),
material_slot_id: ComponentInstanceId::new(material_slot_id(part)),
material: use_source_materials material: use_source_materials
.then(|| { .then(|| {
part_effective_material_id(part).map(|id| { part_effective_material_id(part).map(|id| {
@@ -179,10 +198,77 @@ pub fn renderer_from_manifest(
cast_shadows: true, cast_shadows: true,
receive_shadows: true, receive_shadows: true,
}) })
.collect();
let materials = RendererMaterialSet {
slots: manifest
.parts
.iter()
.filter(|part| !part.skinned && manifest.metadata.animation_count == 0)
.map(|part| RendererMaterialSlot {
id: ComponentInstanceId::new(material_slot_id(part)),
name: part.material_slot_name.clone(),
source_material: use_source_materials
.then(|| {
part_effective_material_id(part).map(|id| {
MaterialRef::new(EditorAssetRef::new(
manifest.asset_id.clone(),
id,
part.material_slot_name.clone(),
))
})
})
.flatten(),
material: None,
})
.collect(), .collect(),
orphaned_assignments: Vec::new(),
};
StaticMeshRenderer {
slots: parts,
materials,
} }
} }
/// Builds the shared material slots for a full imported hierarchy. Unlike static renderer
/// construction this intentionally includes skin-bound and rigid animated draw bindings.
pub fn renderer_materials_from_manifest(
manifest: &StaticMeshManifest,
settings: &ImportSettings,
) -> RendererMaterialSet {
let use_source_materials = matches!(
settings.material_policy,
MaterialImportPolicy::SourceMaterials
);
RendererMaterialSet {
slots: manifest
.parts
.iter()
.map(|part| RendererMaterialSlot {
id: ComponentInstanceId::new(material_slot_id(part)),
name: part.material_slot_name.clone(),
source_material: use_source_materials
.then(|| {
part_effective_material_id(part).map(|id| {
MaterialRef::new(EditorAssetRef::new(
manifest.asset_id.clone(),
id,
part.material_slot_name.clone(),
))
})
})
.flatten(),
material: None,
})
.collect(),
orphaned_assignments: Vec::new(),
}
}
fn material_slot_id(part: &StaticMeshPart) -> String {
format!("slot:{}", part_effective_id(part))
}
fn part_effective_id(part: &StaticMeshPart) -> String { fn part_effective_id(part: &StaticMeshPart) -> String {
if part.id.trim().is_empty() { if part.id.trim().is_empty() {
part_id_from_label(&part.mesh_label) part_id_from_label(&part.mesh_label)
@@ -206,9 +292,9 @@ fn build_static_mesh_manifest(record: &AssetRecord) -> Result<StaticMeshManifest
scale: record.import_settings.scale, scale: record.import_settings.scale,
generate_collider: record.import_settings.generate_collider, generate_collider: record.import_settings.generate_collider,
lod0_only: record.import_settings.lod0_only, lod0_only: record.import_settings.lod0_only,
placement_mode: record.import_settings.placement_mode.clone(), placement_mode: record.import_settings.placement_mode,
hierarchy_mode: record.import_settings.hierarchy_mode.clone(), hierarchy_mode: record.import_settings.hierarchy_mode,
material_policy: record.import_settings.material_policy.clone(), material_policy: record.import_settings.material_policy,
}; };
let mut manifest = match format.as_str() { let mut manifest = match format.as_str() {
@@ -255,23 +341,23 @@ fn build_gltf_manifest(
.or_else(|| gltf.document.scenes().next()) .or_else(|| gltf.document.scenes().next())
{ {
for node in scene.nodes() { for node in scene.nodes() {
collect_gltf_node_parts(node, Mat4::IDENTITY, &mut parts); collect_gltf_node_parts(node, Mat4::IDENTITY, "", &mut parts);
} }
} else { } else {
for mesh in gltf.document.meshes() { for mesh in gltf.document.meshes() {
collect_gltf_mesh_parts(None, None, mesh, Mat4::IDENTITY, &mut parts); collect_gltf_mesh_parts(None, None, None, mesh, Mat4::IDENTITY, false, &mut parts);
} }
} }
if gltf.document.animations().count() > 0 { if gltf.document.animations().count() > 0 {
warnings.push( warnings.push(
"Animations are recorded as metadata; use Scene Instance placement for playback." "Animations are recorded as metadata; animated placement uses SkinnedMeshRenderer."
.into(), .into(),
); );
} }
if gltf.document.skins().count() > 0 { if gltf.document.skins().count() > 0 {
warnings.push( warnings.push(
"Skins are recorded as metadata; skinned playback stays on the Scene Instance path." "Skinned primitives are excluded from StaticMeshRenderer and use SkinnedMeshRenderer."
.into(), .into(),
); );
} }
@@ -306,29 +392,44 @@ fn build_gltf_manifest(
fn collect_gltf_node_parts( fn collect_gltf_node_parts(
node: gltf::Node<'_>, node: gltf::Node<'_>,
parent_transform: Mat4, parent_transform: Mat4,
parent_path: &str,
parts: &mut Vec<StaticMeshPart>, parts: &mut Vec<StaticMeshPart>,
) { ) {
let local = Mat4::from_cols_array_2d(&node.transform().matrix()); let local = Mat4::from_cols_array_2d(&node.transform().matrix());
let world_transform = parent_transform * local; let world_transform = parent_transform * local;
let segment = node
.name()
.map(str::to_string)
.unwrap_or_else(|| format!("Node{}", node.index()));
let node_path = if parent_path.is_empty() {
segment
} else {
format!("{parent_path}/{segment}")
};
let skinned = node.skin().is_some();
if let Some(mesh) = node.mesh() { if let Some(mesh) = node.mesh() {
collect_gltf_mesh_parts( collect_gltf_mesh_parts(
node.name().map(str::to_string), node.name().map(str::to_string),
Some(node.index()), Some(node.index()),
Some(node_path.clone()),
mesh, mesh,
world_transform, world_transform,
skinned,
parts, parts,
); );
} }
for child in node.children() { for child in node.children() {
collect_gltf_node_parts(child, world_transform, parts); collect_gltf_node_parts(child, world_transform, &node_path, parts);
} }
} }
fn collect_gltf_mesh_parts( fn collect_gltf_mesh_parts(
node_name: Option<String>, node_name: Option<String>,
node_index: Option<usize>, node_index: Option<usize>,
node_path: Option<String>,
mesh: gltf::Mesh<'_>, mesh: gltf::Mesh<'_>,
transform: Mat4, transform: Mat4,
skinned: bool,
parts: &mut Vec<StaticMeshPart>, parts: &mut Vec<StaticMeshPart>,
) { ) {
let mesh_index = mesh.index(); let mesh_index = mesh.index();
@@ -359,9 +460,11 @@ fn collect_gltf_mesh_parts(
.clone() .clone()
.or_else(|| mesh_name.clone()) .or_else(|| mesh_name.clone())
.unwrap_or_else(|| format!("Mesh {mesh_index}")); .unwrap_or_else(|| format!("Mesh {mesh_index}"));
let source_node = node_index.map(|index| format!("Node{index}")); let source_node = node_path
.clone()
.or_else(|| node_index.map(|index| format!("Node{index}")));
parts.push(StaticMeshPart { parts.push(StaticMeshPart {
id: part_id_from_label(&mesh_label), id: gltf_draw_id(node_index, mesh_index, primitive_index),
name: format!("{name} / Primitive {primitive_index}"), name: format!("{name} / Primitive {primitive_index}"),
material_id: material_label material_id: material_label
.as_ref() .as_ref()
@@ -373,6 +476,7 @@ fn collect_gltf_mesh_parts(
source_node, source_node,
source_mesh: Some(format!("Mesh{mesh_index}")), source_mesh: Some(format!("Mesh{mesh_index}")),
source_material: Some(material_name), source_material: Some(material_name),
skinned,
}); });
} }
} }
@@ -405,6 +509,7 @@ fn build_fbx_manifest(
if mesh.num_vertices == 0 || mesh.faces.as_ref().is_empty() { if mesh.num_vertices == 0 || mesh.faces.as_ref().is_empty() {
continue; continue;
} }
let skinned = !mesh.skin_deformers.as_ref().is_empty();
let mut groups: Vec<(usize, Vec<u32>)> = let mut groups: Vec<(usize, Vec<u32>)> =
group_faces_by_material(mesh).into_iter().collect(); group_faces_by_material(mesh).into_iter().collect();
@@ -428,7 +533,7 @@ fn build_fbx_manifest(
}; };
let mesh_label = FbxAssetLabel::Mesh(node_index * 1000 + material_index).to_string(); let mesh_label = FbxAssetLabel::Mesh(node_index * 1000 + material_index).to_string();
parts.push(StaticMeshPart { parts.push(StaticMeshPart {
id: part_id_from_label(&mesh_label), id: fbx_draw_id(node_index, material_index),
name: format!("{node_name} / Material {material_index}"), name: format!("{node_name} / Material {material_index}"),
material_id: material_label material_id: material_label
.as_ref() .as_ref()
@@ -440,19 +545,20 @@ fn build_fbx_manifest(
source_node: Some(format!("Node{node_index}")), source_node: Some(format!("Node{node_index}")),
source_mesh: Some(format!("Mesh{node_index}")), source_mesh: Some(format!("Mesh{node_index}")),
source_material: Some(material_name), source_material: Some(material_name),
skinned,
}); });
} }
} }
if !scene.anim_stacks.as_ref().is_empty() { if !scene.anim_stacks.as_ref().is_empty() {
warnings.push( warnings.push(
"Animations are recorded as metadata; use Scene Instance placement for playback." "Animations are recorded as metadata; animated placement uses SkinnedMeshRenderer."
.into(), .into(),
); );
} }
if !scene.skin_deformers.as_ref().is_empty() { if !scene.skin_deformers.as_ref().is_empty() {
warnings.push( warnings.push(
"Skins are recorded as metadata; skinned playback stays on the Scene Instance path." "Skinned primitives are excluded from StaticMeshRenderer and use SkinnedMeshRenderer."
.into(), .into(),
); );
} }
@@ -554,6 +660,7 @@ fn resolve_dependency(source_path: &str, uri: &str) -> String {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::asset_db::AssetId;
fn test_manifest() -> StaticMeshManifest { fn test_manifest() -> StaticMeshManifest {
StaticMeshManifest { StaticMeshManifest {
@@ -597,6 +704,7 @@ mod tests {
source_node: Some("Node0".into()), source_node: Some("Node0".into()),
source_mesh: Some("Mesh0".into()), source_mesh: Some("Mesh0".into()),
source_material: Some("Wood".into()), source_material: Some("Wood".into()),
skinned: false,
}], }],
warnings: Vec::new(), warnings: Vec::new(),
} }
@@ -645,4 +753,48 @@ mod tests {
assert!(renderer.slots[0].material.is_none()); assert!(renderer.slots[0].material.is_none());
} }
#[test]
fn renderer_from_manifest_excludes_skinned_primitives() {
let mut manifest = test_manifest();
manifest.parts[0].skinned = true;
let renderer = renderer_from_manifest(&manifest, &ImportSettings::default());
assert!(renderer.slots.is_empty());
}
#[test]
fn renderer_from_manifest_excludes_node_animated_geometry() {
let mut manifest = test_manifest();
manifest.metadata.animation_count = 1;
let renderer = renderer_from_manifest(&manifest, &ImportSettings::default());
assert!(renderer.slots.is_empty());
}
#[test]
fn committed_rigged_fixture_never_builds_static_renderer_slots() {
let path = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../../assets/models/robot_expressive.glb")
.to_string_lossy()
.into_owned();
let record = AssetRecord {
id: AssetId::new(),
path,
label: "Robot Expressive".into(),
kind_tag: "Model".into(),
import_settings: ImportSettings::default(),
dependencies: Vec::new(),
};
let manifest = build_static_mesh_manifest(&record).unwrap();
let renderer = renderer_from_manifest(&manifest, &record.import_settings);
assert!(manifest.metadata.skin_count > 0);
assert!(manifest.metadata.animation_count > 0);
assert!(manifest.parts.iter().any(|part| part.skinned));
assert!(renderer.slots.is_empty());
}
} }
+67 -17
View File
@@ -6,7 +6,7 @@ use bevy::prelude::*;
use bevy_egui::{egui, EguiPrimaryContextPass, EguiTextureHandle, EguiUserTextures}; use bevy_egui::{egui, EguiPrimaryContextPass, EguiTextureHandle, EguiUserTextures};
use egui_phosphor_icons::icons; use egui_phosphor_icons::icons;
use super::sources::gltf::gltf_base_color_texture_path; use super::sources::gltf::{gltf_base_color_texture_path, validate_gltf_dependencies};
use super::studio::{model_file_exists, ThumbnailStudio}; use super::studio::{model_file_exists, ThumbnailStudio};
use super::ThumbnailJobSource; use super::ThumbnailJobSource;
use crate::assets::{ use crate::assets::{
@@ -100,13 +100,12 @@ impl AssetThumbnailCache {
return; return;
} }
if let Some(texture_path) = gltf_base_color_texture_path(&model_path) { if !self.model_source_ready(&key, &model_path) {
self.request_texture(key, texture_path, asset_server);
return; return;
} }
if !model_file_exists(&model_path) { if let Some(texture_path) = gltf_base_color_texture_path(&model_path) {
self.mark_studio_failed(&key, "file not found", false); self.request_texture(key, texture_path, asset_server);
return; return;
} }
@@ -121,6 +120,7 @@ impl AssetThumbnailCache {
model_path: String, model_path: String,
mesh_label: String, mesh_label: String,
material_label: Option<String>, material_label: Option<String>,
requires_scene_instance: bool,
studio: &mut ThumbnailStudio, studio: &mut ThumbnailStudio,
) { ) {
if matches!( if matches!(
@@ -130,18 +130,19 @@ impl AssetThumbnailCache {
{ {
return; return;
} }
if !model_file_exists(&model_path) { if !self.model_source_ready(&key, &model_path) {
self.mark_studio_failed(&key, "file not found", false);
return; return;
} }
if studio.enqueue_source( let source = if requires_scene_instance {
key.clone(), ThumbnailJobSource::Model { model_path }
} else {
ThumbnailJobSource::MeshSubAsset { ThumbnailJobSource::MeshSubAsset {
model_path, model_path,
mesh_label, mesh_label,
material_label, material_label,
}, }
) { };
if studio.enqueue_source(key.clone(), source) {
self.studio_pending.insert(key); self.studio_pending.insert(key);
} }
} }
@@ -160,8 +161,7 @@ impl AssetThumbnailCache {
{ {
return; return;
} }
if !model_file_exists(&model_path) { if !self.model_source_ready(&key, &model_path) {
self.mark_studio_failed(&key, "file not found", false);
return; return;
} }
if studio.enqueue_source( if studio.enqueue_source(
@@ -188,24 +188,42 @@ impl AssetThumbnailCache {
{ {
return; return;
} }
let material = match shared::MaterialAsset::load_from_path(&path) { let material = match shared::load_resolved_material_from_path(&path) {
Ok(asset) => asset, Ok((material, _)) => material,
Err(error) => { Err(error) => {
self.mark_studio_failed(&key, &error, true); self.mark_studio_failed(&key, &error, true);
return; return;
} }
}; };
let label = shared::MaterialAsset::load_from_path(&path)
.map(|asset| asset.label)
.or_else(|_| {
shared::MaterialInstanceAsset::load_from_path(&path).map(|asset| asset.label)
})
.unwrap_or_else(|_| "Material".into());
if studio.enqueue_source( if studio.enqueue_source(
key.clone(), key.clone(),
ThumbnailJobSource::MaterialAsset { ThumbnailJobSource::MaterialAsset {
label: material.label.clone(), label,
material: material.material, material: Box::new(material),
}, },
) { ) {
self.studio_pending.insert(key); self.studio_pending.insert(key);
} }
} }
fn model_source_ready(&mut self, key: &str, model_path: &str) -> bool {
if !model_file_exists(model_path) {
self.mark_studio_failed(key, "file not found", false);
return false;
}
if let Err(reason) = validate_gltf_dependencies(model_path) {
self.mark_studio_failed(key, &reason, false);
return false;
}
true
}
pub(crate) fn complete_studio_thumbnail( pub(crate) fn complete_studio_thumbnail(
&mut self, &mut self,
key: &str, key: &str,
@@ -283,6 +301,7 @@ pub fn kind_icon(kind: &EditorAssetKind) -> egui_phosphor_icons::Icon {
EditorAssetKind::Model => icons::CUBE_TRANSPARENT, EditorAssetKind::Model => icons::CUBE_TRANSPARENT,
EditorAssetKind::Texture => icons::IMAGE, EditorAssetKind::Texture => icons::IMAGE,
EditorAssetKind::Material => icons::PAINT_BRUSH, EditorAssetKind::Material => icons::PAINT_BRUSH,
EditorAssetKind::AudioClip => icons::WAVEFORM,
EditorAssetKind::Level => icons::MAP_TRIFOLD, EditorAssetKind::Level => icons::MAP_TRIFOLD,
EditorAssetKind::Prefab => icons::PACKAGE, EditorAssetKind::Prefab => icons::PACKAGE,
EditorAssetKind::PostProcessVolume => icons::CAMERA, EditorAssetKind::PostProcessVolume => icons::CAMERA,
@@ -469,6 +488,37 @@ pub fn prefetch_folder_thumbnails(world: &mut World, folder: &str) {
.prefetched_folder = Some(folder.to_string()); .prefetched_folder = Some(folder.to_string());
} }
/// Requests thumbnails for an explicit cross-folder asset set.
pub fn prefetch_asset_thumbnails(world: &mut World, assets: &[EditorAsset]) {
let requests = assets
.iter()
.filter_map(|asset| {
Some((
asset_cache_key(asset),
asset.path.clone()?,
asset.kind.clone(),
))
})
.collect::<Vec<_>>();
let asset_server = world.resource::<AssetServer>().clone();
world.resource_scope(|world, mut cache: Mut<AssetThumbnailCache>| {
world.resource_scope(|_world, mut studio: Mut<ThumbnailStudio>| {
for (key, path, kind) in requests {
match kind {
EditorAssetKind::Texture => cache.request_texture(key, path, &asset_server),
EditorAssetKind::Model => {
cache.request_model(key, path, &asset_server, &mut studio)
}
EditorAssetKind::Material => {
cache.request_material_asset(key, path, &mut studio)
}
_ => {}
}
}
});
});
}
pub fn invalidate_on_catalog_refresh(world: &mut World) { pub fn invalidate_on_catalog_refresh(world: &mut World) {
world.resource_mut::<AssetThumbnailCache>().invalidate_all(); world.resource_mut::<AssetThumbnailCache>().invalidate_all();
if !world.contains_resource::<ThumbnailStudio>() { if !world.contains_resource::<ThumbnailStudio>() {
+1 -1
View File
@@ -24,7 +24,7 @@ pub enum ThumbnailJobSource {
}, },
MaterialAsset { MaterialAsset {
label: String, label: String,
material: MaterialDesc, material: Box<MaterialDesc>,
}, },
} }
+6 -3
View File
@@ -8,11 +8,14 @@ mod sources;
mod studio; mod studio;
pub use cache::{ pub use cache::{
draw_asset_cell_with, invalidate_on_catalog_refresh, kind_icon, prefetch_folder_thumbnails, draw_asset_cell_with, invalidate_on_catalog_refresh, kind_icon, prefetch_asset_thumbnails,
AssetThumbnailCache, AssetThumbnailsPlugin, ThumbnailCacheSnapshot, ThumbnailState, prefetch_folder_thumbnails, AssetThumbnailCache, AssetThumbnailsPlugin, ThumbnailCacheSnapshot,
ThumbnailState,
}; };
pub use job::{ThumbnailJob, ThumbnailJobSource}; pub use job::{ThumbnailJob, ThumbnailJobSource};
pub use sources::{FbxThumbnailSource, GltfThumbnailSource, ThumbnailModelSource}; pub use sources::{
gltf_skinned_primitive_labels, FbxThumbnailSource, GltfThumbnailSource, ThumbnailModelSource,
};
pub use studio::{ pub use studio::{
model_file_exists, model_scene_asset_path, ThumbnailStudio, ThumbnailStudioPlugin, model_file_exists, model_scene_asset_path, ThumbnailStudio, ThumbnailStudioPlugin,
}; };
@@ -1,5 +1,6 @@
//! glTF/GLB fast-path texture extraction for asset browser thumbnails. //! glTF/GLB fast-path texture extraction for asset browser thumbnails.
use std::collections::HashSet;
use std::path::Path; use std::path::Path;
/// Returns an asset-server path for the first base-color texture referenced by a glTF/GLB file. /// Returns an asset-server path for the first base-color texture referenced by a glTF/GLB file.
@@ -29,6 +30,67 @@ pub fn gltf_base_color_texture_path(model_asset_path: &str) -> Option<String> {
None None
} }
/// Verifies local external buffers and images before Bevy starts an async glTF load.
pub fn validate_gltf_dependencies(model_asset_path: &str) -> Result<(), String> {
let model_path = Path::new(model_asset_path);
if !is_gltf_path(model_path) {
return Ok(());
}
let gltf = gltf::Gltf::open(model_path).map_err(|error| format!("invalid glTF: {error}"))?;
let mut uris = Vec::new();
for buffer in gltf.buffers() {
if let gltf::buffer::Source::Uri(uri) = buffer.source() {
uris.push(uri);
}
}
for image in gltf.images() {
if let gltf::image::Source::Uri { uri, .. } = image.source() {
uris.push(uri);
}
}
let model_dir = model_path.parent().unwrap_or_else(|| Path::new(""));
for uri in uris {
if uri.starts_with("data:") || uri.contains("://") {
continue;
}
let dependency = model_dir.join(uri);
if !dependency.is_file() {
let display = normalize_asset_path(&dependency)
.unwrap_or_else(|| dependency.to_string_lossy().replace('\\', "/"));
return Err(format!("missing dependency: {display}"));
}
}
Ok(())
}
/// Returns primitive labels that cannot be rendered without their source skin hierarchy.
pub fn gltf_skinned_primitive_labels(model_asset_path: &str) -> HashSet<String> {
let model_path = Path::new(model_asset_path);
if !is_gltf_path(model_path) {
return HashSet::new();
}
let Ok(gltf) = gltf::Gltf::open(model_path) else {
return HashSet::new();
};
gltf.meshes()
.flat_map(|mesh| {
let mesh_index = mesh.index();
mesh.primitives()
.filter(|primitive| {
primitive.attributes().any(|(semantic, _)| {
matches!(
semantic,
gltf::Semantic::Joints(_) | gltf::Semantic::Weights(_)
)
})
})
.map(move |primitive| format!("Mesh{mesh_index}/Primitive{}", primitive.index()))
})
.collect()
}
pub struct GltfThumbnailSource; pub struct GltfThumbnailSource;
fn is_gltf_path(path: &Path) -> bool { fn is_gltf_path(path: &Path) -> bool {
@@ -61,7 +123,9 @@ fn normalize_asset_path(path: &Path) -> Option<String> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use std::fs;
use std::path::PathBuf; use std::path::PathBuf;
use std::time::{SystemTime, UNIX_EPOCH};
#[test] #[test]
fn normalize_asset_path_keeps_assets_prefix() { fn normalize_asset_path_keeps_assets_prefix() {
@@ -79,4 +143,37 @@ mod tests {
Some("assets/models/textures/chair_albedo.png".into()) Some("assets/models/textures/chair_albedo.png".into())
); );
} }
#[test]
fn dependency_validation_reports_missing_external_buffer() {
let nonce = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_nanos();
let directory = std::env::temp_dir().join(format!("blacksite-gltf-{nonce}"));
fs::create_dir_all(&directory).unwrap();
let model = directory.join("missing-buffer.gltf");
fs::write(
&model,
r#"{"asset":{"version":"2.0"},"buffers":[{"uri":"missing.bin","byteLength":4}]}"#,
)
.unwrap();
let error = validate_gltf_dependencies(model.to_str().unwrap()).unwrap_err();
assert!(error.contains("missing.bin"));
fs::remove_dir_all(directory).unwrap();
}
#[test]
fn committed_robot_fixture_identifies_skinned_primitives() {
let path =
Path::new(env!("CARGO_MANIFEST_DIR")).join("../../assets/models/robot_expressive.glb");
let labels = gltf_skinned_primitive_labels(path.to_str().unwrap());
assert!(labels.contains("Mesh12/Primitive0"));
assert!(labels.contains("Mesh13/Primitive0"));
assert!(!labels.contains("Mesh0/Primitive0"));
assert!(!labels.contains("Mesh999/Primitive0"));
}
} }
@@ -4,7 +4,7 @@ mod fbx;
pub(crate) mod gltf; pub(crate) mod gltf;
pub use fbx::FbxThumbnailSource; pub use fbx::FbxThumbnailSource;
pub use gltf::GltfThumbnailSource; pub use gltf::{gltf_skinned_primitive_labels, GltfThumbnailSource};
use bevy::prelude::*; use bevy::prelude::*;
+80 -11
View File
@@ -10,9 +10,8 @@ use bevy::math::bounding::Aabb3d;
use bevy::mesh::VertexAttributeValues; use bevy::mesh::VertexAttributeValues;
use bevy::prelude::*; use bevy::prelude::*;
use bevy::render::render_resource::TextureFormat; use bevy::render::render_resource::TextureFormat;
use bevy::scene::SceneRoot;
use bevy_egui::EguiUserTextures; use bevy_egui::EguiUserTextures;
use shared::{material_from_desc, ModelRef}; use shared::{material_from_desc, standard_material_asset_path, ModelRef};
use super::cache::AssetThumbnailCache; use super::cache::AssetThumbnailCache;
use super::job::{ThumbnailJob, ThumbnailJobSource}; use super::job::{ThumbnailJob, ThumbnailJobSource};
@@ -22,6 +21,10 @@ use crate::infra::EditorOnly;
pub(crate) const THUMB_SIZE: u32 = 128; pub(crate) const THUMB_SIZE: u32 = 128;
pub(crate) const THUMBNAIL_LAYER: usize = 31; pub(crate) const THUMBNAIL_LAYER: usize = 31;
const THUMBNAIL_VERTICAL_FOV: f32 = 40.0_f32.to_radians();
const THUMBNAIL_HALF_VERTICAL_FOV: f32 = THUMBNAIL_VERTICAL_FOV * 0.5;
const SCENE_FRAME_PADDING: f32 = 1.35;
const MATERIAL_SPHERE_FRAME_PADDING: f32 = 1.28;
const MESH_WARMUP_FRAMES: u8 = 12; const MESH_WARMUP_FRAMES: u8 = 12;
const POST_ATTACH_FRAMES: u8 = 8; const POST_ATTACH_FRAMES: u8 = 8;
const RENDER_FRAMES: u8 = 3; const RENDER_FRAMES: u8 = 3;
@@ -62,6 +65,25 @@ struct ActiveModelThumbnail {
framed: bool, framed: bool,
frames_remaining: u8, frames_remaining: u8,
wait_frames: u32, wait_frames: u32,
framing: ThumbnailFraming,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum ThumbnailFraming {
SceneBounds,
MaterialSphere,
}
impl ThumbnailFraming {
fn for_source(source: &ThumbnailJobSource) -> Self {
match source {
ThumbnailJobSource::SourceMaterial { .. }
| ThumbnailJobSource::MaterialAsset { .. } => Self::MaterialSphere,
ThumbnailJobSource::Model { .. } | ThumbnailJobSource::MeshSubAsset { .. } => {
Self::SceneBounds
}
}
}
} }
pub struct ThumbnailStudioPlugin; pub struct ThumbnailStudioPlugin;
@@ -134,6 +156,7 @@ fn setup_thumbnail_studio(mut commands: Commands, mut images: ResMut<Assets<Imag
ThumbnailStudioLayer, ThumbnailStudioLayer,
RenderLayers::layer(THUMBNAIL_LAYER), RenderLayers::layer(THUMBNAIL_LAYER),
Camera3d::default(), Camera3d::default(),
Msaa::Off,
Camera { Camera {
is_active: false, is_active: false,
order: -50, order: -50,
@@ -143,7 +166,7 @@ fn setup_thumbnail_studio(mut commands: Commands, mut images: ResMut<Assets<Imag
RenderTarget::Image(render_image.clone().into()), RenderTarget::Image(render_image.clone().into()),
Transform::from_xyz(2.0, 1.4, 2.0).looking_at(Vec3::new(0.0, 0.5, 0.0), Vec3::Y), Transform::from_xyz(2.0, 1.4, 2.0).looking_at(Vec3::new(0.0, 0.5, 0.0), Vec3::Y),
Projection::Perspective(PerspectiveProjection { Projection::Perspective(PerspectiveProjection {
fov: 40.0_f32.to_radians(), fov: THUMBNAIL_VERTICAL_FOV,
..default() ..default()
}), }),
)) ))
@@ -157,7 +180,7 @@ fn setup_thumbnail_studio(mut commands: Commands, mut images: ResMut<Assets<Imag
RenderLayers::layer(THUMBNAIL_LAYER), RenderLayers::layer(THUMBNAIL_LAYER),
DirectionalLight { DirectionalLight {
illuminance: 12_000.0, illuminance: 12_000.0,
shadows_enabled: false, shadow_maps_enabled: false,
..default() ..default()
}, },
Transform::from_rotation(Quat::from_euler(EulerRot::XYZ, -0.8, 0.9, 0.0)), Transform::from_rotation(Quat::from_euler(EulerRot::XYZ, -0.8, 0.9, 0.0)),
@@ -172,7 +195,7 @@ fn setup_thumbnail_studio(mut commands: Commands, mut images: ResMut<Assets<Imag
RenderLayers::layer(THUMBNAIL_LAYER), RenderLayers::layer(THUMBNAIL_LAYER),
DirectionalLight { DirectionalLight {
illuminance: 3_500.0, illuminance: 3_500.0,
shadows_enabled: false, shadow_maps_enabled: false,
..default() ..default()
}, },
Transform::from_rotation(Quat::from_euler(EulerRot::XYZ, -0.4, -2.2, 0.0)), Transform::from_rotation(Quat::from_euler(EulerRot::XYZ, -0.4, -2.2, 0.0)),
@@ -229,6 +252,7 @@ fn process_thumbnail_studio(
&mesh3d, &mesh3d,
&mesh_storage, &mesh_storage,
&mut camera_transforms, &mut camera_transforms,
active.framing,
) { ) {
active.framed = true; active.framed = true;
active.post_attach_frames = 0; active.post_attach_frames = 0;
@@ -315,10 +339,14 @@ fn process_thumbnail_studio(
ThumbnailStudioLayer, ThumbnailStudioLayer,
RenderLayers::layer(THUMBNAIL_LAYER), RenderLayers::layer(THUMBNAIL_LAYER),
Transform::default(), Transform::default(),
Visibility::Visible,
InheritedVisibility::default(),
ViewVisibility::default(),
)) ))
.id(); .id();
let label = job.source.label().to_string(); let label = job.source.label().to_string();
let framing = ThumbnailFraming::for_source(&job.source);
let content_spawned = spawn_thumbnail_job_content( let content_spawned = spawn_thumbnail_job_content(
&mut commands, &mut commands,
&mut mesh_storage, &mut mesh_storage,
@@ -347,6 +375,7 @@ fn process_thumbnail_studio(
framed: false, framed: false,
frames_remaining: 0, frames_remaining: 0,
wait_frames: 0, wait_frames: 0,
framing,
}, },
"no renderable meshes", "no renderable meshes",
true, true,
@@ -366,6 +395,7 @@ fn process_thumbnail_studio(
framed: false, framed: false,
frames_remaining: 0, frames_remaining: 0,
wait_frames: 0, wait_frames: 0,
framing,
}); });
} }
@@ -380,7 +410,7 @@ fn spawn_thumbnail_job_content(
match source { match source {
ThumbnailJobSource::Model { model_path } => { ThumbnailJobSource::Model { model_path } => {
if uses_scene_root(model_path) { if uses_scene_root(model_path) {
commands.entity(root).insert(SceneRoot( commands.entity(root).insert(WorldAssetRoot(
asset_server.load(model_scene_asset_path(model_path, 0)), asset_server.load(model_scene_asset_path(model_path, 0)),
)); ));
} }
@@ -410,7 +440,7 @@ fn spawn_thumbnail_job_content(
commands, commands,
mesh_storage, mesh_storage,
root, root,
asset_server.load(labeled_asset_path( asset_server.load(standard_material_asset_path(
&asset_server_path(model_path), &asset_server_path(model_path),
material_label, material_label,
)), )),
@@ -434,7 +464,7 @@ fn spawn_mesh_subasset_preview(
let source_path = asset_server_path(model_path); let source_path = asset_server_path(model_path);
let mesh: Handle<Mesh> = asset_server.load(labeled_asset_path(&source_path, mesh_label)); let mesh: Handle<Mesh> = asset_server.load(labeled_asset_path(&source_path, mesh_label));
let material = if let Some(material_label) = material_label { let material = if let Some(material_label) = material_label {
asset_server.load(labeled_asset_path(&source_path, material_label)) asset_server.load(standard_material_asset_path(&source_path, material_label))
} else { } else {
materials.add(StandardMaterial { materials.add(StandardMaterial {
base_color: Color::srgb(0.72, 0.72, 0.75), base_color: Color::srgb(0.72, 0.72, 0.75),
@@ -476,7 +506,7 @@ fn labeled_asset_path(path: &str, label: &str) -> String {
} }
fn studio_render_image() -> Image { fn studio_render_image() -> Image {
Image::new_target_texture(THUMB_SIZE, THUMB_SIZE, TextureFormat::Rgba8UnormSrgb, None) Image::new_target_texture(THUMB_SIZE, THUMB_SIZE, TextureFormat::Rgba16Float, None)
} }
fn finish_active_thumbnail( fn finish_active_thumbnail(
@@ -494,6 +524,10 @@ fn finish_active_thumbnail(
studio.cooldown_frames = COOLDOWN_FRAMES; studio.cooldown_frames = COOLDOWN_FRAMES;
} }
#[expect(
clippy::too_many_arguments,
reason = "thumbnail failure coordinates the job, cache, render target, and camera state"
)]
fn fail_active_thumbnail( fn fail_active_thumbnail(
commands: &mut Commands, commands: &mut Commands,
studio: &mut ThumbnailStudio, studio: &mut ThumbnailStudio,
@@ -581,6 +615,7 @@ fn frame_thumbnail_scene(
meshes: &Query<&Mesh3d>, meshes: &Query<&Mesh3d>,
mesh_assets: &Assets<Mesh>, mesh_assets: &Assets<Mesh>,
camera_transforms: &mut Query<&mut Transform, With<ThumbnailStudioCamera>>, camera_transforms: &mut Query<&mut Transform, With<ThumbnailStudioCamera>>,
framing: ThumbnailFraming,
) -> bool { ) -> bool {
let mut entities = Vec::new(); let mut entities = Vec::new();
collect_descendants(root, children, &mut entities); collect_descendants(root, children, &mut entities);
@@ -626,8 +661,7 @@ fn frame_thumbnail_scene(
} }
let center = (min + max) * 0.5; let center = (min + max) * 0.5;
let radius = (max - min).length().max(0.25) * 0.5; let distance = thumbnail_camera_distance(min, max, framing);
let distance = radius / (20.0_f32.to_radians()).tan() * 1.35;
let eye = center + Vec3::new(1.0, 0.75, 1.0).normalize() * distance; let eye = center + Vec3::new(1.0, 0.75, 1.0).normalize() * distance;
if let Ok(mut transform) = camera_transforms.single_mut() { if let Ok(mut transform) = camera_transforms.single_mut() {
@@ -637,6 +671,20 @@ fn frame_thumbnail_scene(
true true
} }
fn thumbnail_camera_distance(min: Vec3, max: Vec3, framing: ThumbnailFraming) -> f32 {
let bounds_size = max - min;
let (radius, padding) = match framing {
ThumbnailFraming::SceneBounds => {
(bounds_size.length().max(0.25) * 0.5, SCENE_FRAME_PADDING)
}
ThumbnailFraming::MaterialSphere => (
bounds_size.max_element().max(0.5) * 0.5,
MATERIAL_SPHERE_FRAME_PADDING,
),
};
radius / THUMBNAIL_HALF_VERTICAL_FOV.tan() * padding
}
fn collect_descendants(entity: Entity, children: &Query<&Children>, out: &mut Vec<Entity>) { fn collect_descendants(entity: Entity, children: &Query<&Children>, out: &mut Vec<Entity>) {
out.push(entity); out.push(entity);
let Ok(child_list) = children.get(entity) else { let Ok(child_list) = children.get(entity) else {
@@ -666,3 +714,24 @@ fn aabb_corners(aabb: &Aabb3d) -> [Vec3; 8] {
pub fn model_file_exists(catalog_path: &str) -> bool { pub fn model_file_exists(catalog_path: &str) -> bool {
Path::new(catalog_path).is_file() Path::new(catalog_path).is_file()
} }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn material_sphere_framing_fills_more_of_the_thumbnail_with_padding() {
let sphere_radius = 0.65;
let min = Vec3::splat(-sphere_radius);
let max = Vec3::splat(sphere_radius);
let scene_distance = thumbnail_camera_distance(min, max, ThumbnailFraming::SceneBounds);
let material_distance =
thumbnail_camera_distance(min, max, ThumbnailFraming::MaterialSphere);
let projected_radius_fraction =
sphere_radius / (material_distance * THUMBNAIL_HALF_VERTICAL_FOV.tan());
assert!(material_distance < scene_distance * 0.6);
assert!((0.75..0.82).contains(&projected_radius_fraction));
}
}
+21
View File
@@ -1,6 +1,27 @@
//! In-process editor binary entry point. //! In-process editor binary entry point.
fn main() { fn main() {
let startup = match editor::launcher::parse_startup_arguments(std::env::args().skip(1)) {
Ok(startup) => startup,
Err(error) => {
eprintln!(
"Blacksite Editor: {error}\n\n{}",
editor::launcher::command_line_help()
);
std::process::exit(2);
}
};
if startup.help {
println!("{}", editor::launcher::command_line_help());
return;
}
if let Some(root) = startup.project {
if let Err(error) = editor::launcher::activate_project_root(&root) {
eprintln!("Blacksite Editor: {error}");
std::process::exit(2);
}
}
if std::env::var_os("WGPU_VALIDATION").is_none() { if std::env::var_os("WGPU_VALIDATION").is_none() {
// SAFETY: called before any threads or GPU init. // SAFETY: called before any threads or GPU init.
unsafe { std::env::set_var("WGPU_VALIDATION", "0") }; unsafe { std::env::set_var("WGPU_VALIDATION", "0") };
@@ -0,0 +1,9 @@
//! Dedicated pre-engine Blacksite project browser.
fn main() {
if std::env::var_os("WGPU_VALIDATION").is_none() {
// SAFETY: called before Bevy starts worker threads or initializes the renderer.
unsafe { std::env::set_var("WGPU_VALIDATION", "0") };
}
editor::launcher::run_project_launcher();
}
+355 -25
View File
@@ -4,17 +4,29 @@ use bevy::prelude::*;
use bevy_egui::{egui, EguiContexts, EguiPrimaryContextPass}; use bevy_egui::{egui, EguiContexts, EguiPrimaryContextPass};
use crate::history::group_selection_with_history; use crate::history::group_selection_with_history;
use crate::operators::{run_immediate_operator, OperatorAvailability};
use crate::state::{EditorMode, PlayPossession}; use crate::state::{EditorMode, PlayPossession};
use crate::ui::helpers::{ use crate::ui::helpers::{
reset_scene_lighting_to_project_defaults, toggle_play_mode, toggle_play_paused, reset_scene_lighting_to_project_defaults, toggle_play_mode, toggle_play_paused,
}; };
use crate::ui::selection_ops::focus_editor_camera_on_selection; use crate::ui::selection_ops::{focus_editor_camera_on_selection, reset_selected_transforms};
use crate::ui::theme::{apply_editor_theme, PANEL_BG, TEXT, TEXT_DIM}; use crate::ui::theme::{apply_editor_theme, PANEL_BG, TEXT, TEXT_DIM};
use crate::ui::UiState; use crate::ui::UiState;
use crate::viewport::brush_tool::start_draw_brush_tool;
use crate::viewport::{
intersect_selected_brushes, merge_selected_brushes, selected_brush_count,
subtract_selected_brushes,
};
/// Named editor command invokable from the palette and BRP. /// Named editor command invokable from the palette and BRP.
pub trait EditorCommand: Send + Sync { pub trait EditorCommand: Send + Sync {
fn name(&self) -> &str; fn name(&self) -> &str;
fn label(&self) -> &str {
self.name()
}
fn disabled_reason(&self, _world: &World) -> Option<String> {
None
}
fn execute(&self, world: &mut World); fn execute(&self, world: &mut World);
} }
@@ -23,6 +35,12 @@ pub struct EditorCommandRegistry {
commands: Vec<Box<dyn EditorCommand>>, commands: Vec<Box<dyn EditorCommand>>,
} }
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EditorCommandEntry {
pub name: String,
pub label: String,
}
impl EditorCommandRegistry { impl EditorCommandRegistry {
pub fn register(&mut self, command: Box<dyn EditorCommand>) { pub fn register(&mut self, command: Box<dyn EditorCommand>) {
self.commands.push(command); self.commands.push(command);
@@ -35,6 +53,23 @@ impl EditorCommandRegistry {
.collect() .collect()
} }
pub fn entries(&self) -> Vec<EditorCommandEntry> {
self.commands
.iter()
.map(|command| EditorCommandEntry {
name: command.name().to_string(),
label: command.label().to_string(),
})
.collect()
}
pub fn command_state(&self, world: &World, name: &str) -> Option<(String, Option<String>)> {
self.commands
.iter()
.find(|cmd| cmd.name() == name)
.map(|cmd| (cmd.label().to_string(), cmd.disabled_reason(world)))
}
pub fn run(&self, world: &mut World, name: &str) -> bool { pub fn run(&self, world: &mut World, name: &str) -> bool {
if let Some(command) = self.commands.iter().find(|cmd| cmd.name() == name) { if let Some(command) = self.commands.iter().find(|cmd| cmd.name() == name) {
command.execute(world); command.execute(world);
@@ -127,6 +162,8 @@ pub struct CommandPalette {
pub open: bool, pub open: bool,
pub filter: String, pub filter: String,
pub pending_run: Option<String>, pub pending_run: Option<String>,
pub focus_filter: bool,
pub selected_index: usize,
} }
pub struct ExtensibilityPlugin; pub struct ExtensibilityPlugin;
@@ -160,9 +197,14 @@ fn register_builtin_commands(mut registry: ResMut<EditorCommandRegistry>) {
registry.register(Box::new(ResetLightingCommand)); registry.register(Box::new(ResetLightingCommand));
registry.register(Box::new(GroupSelectionCommand)); registry.register(Box::new(GroupSelectionCommand));
registry.register(Box::new(FocusSelectionCommand)); registry.register(Box::new(FocusSelectionCommand));
registry.register(Box::new(ResetSelectionTransformCommand));
registry.register(Box::new(CreatePostProcessVolumeCommand)); registry.register(Box::new(CreatePostProcessVolumeCommand));
registry.register(Box::new(FocusActiveVolumesCommand)); registry.register(Box::new(FocusActiveVolumesCommand));
registry.register(Box::new(SelectVolumesAtCameraCommand)); registry.register(Box::new(SelectVolumesAtCameraCommand));
registry.register(Box::new(DrawBrushCommand));
registry.register(Box::new(IntersectBrushesCommand));
registry.register(Box::new(MergeBrushesCommand));
registry.register(Box::new(SubtractBrushesCommand));
} }
fn run_palette_commands(world: &mut World) { fn run_palette_commands(world: &mut World) {
@@ -181,11 +223,39 @@ fn run_palette_commands(world: &mut World) {
} }
fn dispatch_editor_command(world: &mut World, name: &str) { fn dispatch_editor_command(world: &mut World, name: &str) {
let ran = world let Some((label, disabled_reason)) =
.resource_scope(|world, registry: Mut<EditorCommandRegistry>| registry.run(world, name)); world.resource_scope(|world, registry: Mut<EditorCommandRegistry>| {
if !ran { registry.command_state(world, name)
})
else {
warn!("unknown editor command: {name}"); warn!("unknown editor command: {name}");
return;
};
let name_for_commit = name.to_string();
let name_for_status = name.to_string();
let label_for_commit = label.clone();
run_immediate_operator(
world,
&name_for_status,
&label,
match disabled_reason {
Some(reason) => OperatorAvailability::Disabled(reason),
None => OperatorAvailability::Ready,
},
move |world| {
let ran = world.resource_scope(|world, registry: Mut<EditorCommandRegistry>| {
registry.run(world, &name_for_commit)
});
if ran {
Ok(())
} else {
Err(format!("Unknown editor command: {name_for_commit}"))
} }
},
);
trace!("dispatched editor operator command {label_for_commit}");
} }
struct TogglePlayCommand; struct TogglePlayCommand;
@@ -195,6 +265,10 @@ impl EditorCommand for TogglePlayCommand {
"play.toggle" "play.toggle"
} }
fn label(&self) -> &str {
"Toggle Play / Edit"
}
fn execute(&self, world: &mut World) { fn execute(&self, world: &mut World) {
toggle_play_mode(world); toggle_play_mode(world);
} }
@@ -207,6 +281,15 @@ impl EditorCommand for TogglePlayPausedCommand {
"play.toggle_pause" "play.toggle_pause"
} }
fn label(&self) -> &str {
"Pause / Resume Simulation"
}
fn disabled_reason(&self, world: &World) -> Option<String> {
(*world.resource::<State<EditorMode>>().get() != EditorMode::Playing)
.then(|| "Enter Play mode before pausing the simulation".to_string())
}
fn execute(&self, world: &mut World) { fn execute(&self, world: &mut World) {
toggle_play_paused(world); toggle_play_paused(world);
} }
@@ -219,10 +302,16 @@ impl EditorCommand for TogglePossessionCommand {
"play.toggle_possession" "play.toggle_possession"
} }
fn execute(&self, world: &mut World) { fn label(&self) -> &str {
if *world.resource::<State<EditorMode>>().get() != EditorMode::Playing { "Possess / Eject Player"
return;
} }
fn disabled_reason(&self, world: &World) -> Option<String> {
(*world.resource::<State<EditorMode>>().get() != EditorMode::Playing)
.then(|| "Enter Play mode before toggling possession".to_string())
}
fn execute(&self, world: &mut World) {
let next = match *world.resource::<PlayPossession>() { let next = match *world.resource::<PlayPossession>() {
PlayPossession::Possessed => PlayPossession::Ejected, PlayPossession::Possessed => PlayPossession::Ejected,
PlayPossession::Ejected => PlayPossession::Possessed, PlayPossession::Ejected => PlayPossession::Possessed,
@@ -238,6 +327,10 @@ impl EditorCommand for ResetLightingCommand {
"scene.reset_lighting" "scene.reset_lighting"
} }
fn label(&self) -> &str {
"Reset Scene Lighting"
}
fn execute(&self, world: &mut World) { fn execute(&self, world: &mut World) {
reset_scene_lighting_to_project_defaults(world); reset_scene_lighting_to_project_defaults(world);
} }
@@ -250,6 +343,10 @@ impl EditorCommand for GroupSelectionCommand {
"selection.group" "selection.group"
} }
fn label(&self) -> &str {
"Group Selection"
}
fn execute(&self, world: &mut World) { fn execute(&self, world: &mut World) {
let selected: Vec<Entity> = world let selected: Vec<Entity> = world
.resource::<UiState>() .resource::<UiState>()
@@ -267,11 +364,112 @@ impl EditorCommand for FocusSelectionCommand {
"selection.focus" "selection.focus"
} }
fn label(&self) -> &str {
"Focus Selection"
}
fn execute(&self, world: &mut World) { fn execute(&self, world: &mut World) {
focus_editor_camera_on_selection(world); focus_editor_camera_on_selection(world);
} }
} }
struct ResetSelectionTransformCommand;
impl EditorCommand for ResetSelectionTransformCommand {
fn name(&self) -> &str {
"selection.reset_transform"
}
fn label(&self) -> &str {
"Reset Selection Transform"
}
fn execute(&self, world: &mut World) {
reset_selected_transforms(world);
}
}
struct DrawBrushCommand;
impl EditorCommand for DrawBrushCommand {
fn name(&self) -> &str {
"brush.draw"
}
fn label(&self) -> &str {
"Draw Brush"
}
fn disabled_reason(&self, world: &World) -> Option<String> {
(*world.resource::<State<EditorMode>>().get() != EditorMode::Editing)
.then(|| "Enter Edit mode before drawing brushes".to_string())
}
fn execute(&self, world: &mut World) {
start_draw_brush_tool(world);
}
}
struct IntersectBrushesCommand;
impl EditorCommand for IntersectBrushesCommand {
fn name(&self) -> &str {
"brush.intersect"
}
fn label(&self) -> &str {
"Brush Intersect"
}
fn disabled_reason(&self, world: &World) -> Option<String> {
(selected_brush_count(world) < 2).then(|| "Select at least two brushes".to_string())
}
fn execute(&self, world: &mut World) {
intersect_selected_brushes(world);
}
}
struct MergeBrushesCommand;
impl EditorCommand for MergeBrushesCommand {
fn name(&self) -> &str {
"brush.merge_convex"
}
fn label(&self) -> &str {
"Brush Convex Merge"
}
fn disabled_reason(&self, world: &World) -> Option<String> {
(selected_brush_count(world) < 2).then(|| "Select at least two brushes".to_string())
}
fn execute(&self, world: &mut World) {
merge_selected_brushes(world);
}
}
struct SubtractBrushesCommand;
impl EditorCommand for SubtractBrushesCommand {
fn name(&self) -> &str {
"brush.subtract"
}
fn label(&self) -> &str {
"Brush Subtract"
}
fn disabled_reason(&self, world: &World) -> Option<String> {
(selected_brush_count(world) < 2).then(|| "Select at least two brushes".to_string())
}
fn execute(&self, world: &mut World) {
subtract_selected_brushes(world);
}
}
struct CreatePostProcessVolumeCommand; struct CreatePostProcessVolumeCommand;
impl EditorCommand for CreatePostProcessVolumeCommand { impl EditorCommand for CreatePostProcessVolumeCommand {
@@ -279,6 +477,10 @@ impl EditorCommand for CreatePostProcessVolumeCommand {
"rendering.create_volume" "rendering.create_volume"
} }
fn label(&self) -> &str {
"Create Post-process Volume"
}
fn execute(&self, world: &mut World) { fn execute(&self, world: &mut World) {
crate::rendering_diagnostics::spawn_post_process_volume_at_camera(world); crate::rendering_diagnostics::spawn_post_process_volume_at_camera(world);
} }
@@ -291,6 +493,10 @@ impl EditorCommand for FocusActiveVolumesCommand {
"rendering.focus_active_volumes" "rendering.focus_active_volumes"
} }
fn label(&self) -> &str {
"Focus Active Post-process Volumes"
}
fn execute(&self, world: &mut World) { fn execute(&self, world: &mut World) {
crate::rendering_diagnostics::select_volumes_at_camera(world); crate::rendering_diagnostics::select_volumes_at_camera(world);
focus_editor_camera_on_selection(world); focus_editor_camera_on_selection(world);
@@ -304,6 +510,10 @@ impl EditorCommand for SelectVolumesAtCameraCommand {
"rendering.select_volumes_at_camera" "rendering.select_volumes_at_camera"
} }
fn label(&self) -> &str {
"Select Volumes at Camera"
}
fn execute(&self, world: &mut World) { fn execute(&self, world: &mut World) {
crate::rendering_diagnostics::select_volumes_at_camera(world); crate::rendering_diagnostics::select_volumes_at_camera(world);
} }
@@ -322,6 +532,9 @@ fn command_palette_ui(
if ctx.input(|input| input.modifiers.command && input.key_pressed(egui::Key::P)) { if ctx.input(|input| input.modifiers.command && input.key_pressed(egui::Key::P)) {
palette.open = true; palette.open = true;
palette.filter.clear();
palette.focus_filter = true;
palette.selected_index = 0;
} }
if !palette.open { if !palette.open {
@@ -329,35 +542,82 @@ fn command_palette_ui(
} }
let mut open = palette.open; let mut open = palette.open;
let palette_width = (ctx.content_rect().width() - 32.0).clamp(320.0, 520.0);
egui::Window::new("Command Palette") egui::Window::new("Command Palette")
.open(&mut open) .open(&mut open)
.default_width(400.0) .anchor(egui::Align2::CENTER_TOP, egui::vec2(0.0, 64.0))
.frame(egui::Frame::window(&ctx.style()).fill(PANEL_BG)) .collapsible(false)
.resizable(false)
.default_width(palette_width)
.min_width(palette_width)
.max_width(palette_width)
.frame(egui::Frame::window(&ctx.global_style()).fill(PANEL_BG))
.show(ctx, |ui| { .show(ctx, |ui| {
ui.label( let filter_response = ui.add(
egui::RichText::new("Ctrl+P — filter and run commands")
.color(TEXT_DIM)
.small(),
);
ui.add(
egui::TextEdit::singleline(&mut palette.filter) egui::TextEdit::singleline(&mut palette.filter)
.hint_text("Type to filter...") .hint_text("Search commands...")
.desired_width(f32::INFINITY), .desired_width(f32::INFINITY),
); );
if palette.focus_filter {
filter_response.request_focus();
palette.focus_filter = false;
}
if filter_response.changed() {
palette.selected_index = 0;
}
let filtered_entries = filtered_command_entries(&registry, &palette.filter);
if !filtered_entries.is_empty() {
palette.selected_index = palette.selected_index.min(filtered_entries.len() - 1);
} else {
palette.selected_index = 0;
}
if ui.input_mut(|input| input.consume_key(egui::Modifiers::NONE, egui::Key::ArrowDown))
&& !filtered_entries.is_empty()
{
palette.selected_index = (palette.selected_index + 1) % filtered_entries.len();
}
if ui.input_mut(|input| input.consume_key(egui::Modifiers::NONE, egui::Key::ArrowUp))
&& !filtered_entries.is_empty()
{
palette.selected_index = if palette.selected_index == 0 {
filtered_entries.len() - 1
} else {
palette.selected_index - 1
};
}
if ui.input_mut(|input| input.consume_key(egui::Modifiers::NONE, egui::Key::Enter)) {
if let Some(entry) = filtered_entries.get(palette.selected_index) {
palette.pending_run = Some(entry.name.clone());
palette.open = false;
ui.close();
}
}
if ui.input_mut(|input| input.consume_key(egui::Modifiers::NONE, egui::Key::Escape)) {
palette.open = false;
ui.close();
}
ui.separator(); ui.separator();
egui::ScrollArea::vertical() egui::ScrollArea::vertical()
.max_height(280.0) .max_height(320.0)
.show(ui, |ui| { .show(ui, |ui| {
for name in registry.names() { if filtered_entries.is_empty() {
if !palette.filter.is_empty() ui.weak("No matching commands");
&& !name.to_lowercase().contains(&palette.filter.to_lowercase()) }
{ for (index, entry) in filtered_entries.iter().enumerate() {
continue; let selected = index == palette.selected_index;
let response = ui.add_sized(
[ui.available_width(), 40.0],
egui::Button::selectable(selected, command_palette_row(entry)),
);
if selected {
response.scroll_to_me(Some(egui::Align::Center));
} }
let response =
ui.selectable_label(false, egui::RichText::new(&name).color(TEXT));
if response.clicked() { if response.clicked() {
palette.pending_run = Some(name); palette.selected_index = index;
palette.pending_run = Some(entry.name.clone());
palette.open = false; palette.open = false;
ui.close(); ui.close();
} }
@@ -368,3 +628,73 @@ fn command_palette_ui(
Ok(()) Ok(())
} }
fn filtered_command_entries(
registry: &EditorCommandRegistry,
filter: &str,
) -> Vec<EditorCommandEntry> {
let filter = filter.trim().to_lowercase();
registry
.entries()
.into_iter()
.filter(|entry| {
filter.is_empty()
|| entry.name.to_lowercase().contains(&filter)
|| entry.label.to_lowercase().contains(&filter)
})
.collect()
}
fn command_palette_row(entry: &EditorCommandEntry) -> egui::WidgetText {
let mut job = egui::text::LayoutJob::default();
job.append(
&entry.label,
0.0,
egui::TextFormat {
font_id: egui::FontId::new(13.0, egui::FontFamily::Proportional),
color: TEXT,
..Default::default()
},
);
job.append(
&format!("\n{}", entry.name),
0.0,
egui::TextFormat {
font_id: egui::FontId::new(11.0, egui::FontFamily::Monospace),
color: TEXT_DIM,
..Default::default()
},
);
job.into()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn command_filter_matches_human_label_and_stable_id() {
let mut registry = EditorCommandRegistry::default();
registry.register(Box::new(TogglePlayCommand));
registry.register(Box::new(ResetLightingCommand));
let by_label = filtered_command_entries(&registry, "scene lighting");
assert_eq!(by_label.len(), 1);
assert_eq!(by_label[0].name, "scene.reset_lighting");
let by_id = filtered_command_entries(&registry, "play.toggle");
assert_eq!(by_id.len(), 1);
assert_eq!(by_id[0].label, "Toggle Play / Edit");
}
#[test]
fn empty_command_filter_preserves_registration_order() {
let mut registry = EditorCommandRegistry::default();
registry.register(Box::new(TogglePlayCommand));
registry.register(Box::new(ResetLightingCommand));
let entries = filtered_command_entries(&registry, " ");
assert_eq!(entries[0].name, "play.toggle");
assert_eq!(entries[1].name, "scene.reset_lighting");
}
}
+192 -4
View File
@@ -1,9 +1,13 @@
use std::path::PathBuf;
use bevy::prelude::*; use bevy::prelude::*;
use shared::{ use shared::{
ActorId, ActorKind, ActorName, ColliderDesc, EditorVisibility, InspectorOrder, LightDesc, ActorId, ActorKind, ActorName, AnimationControllerDesc, AudioListenerDesc, AudioSourceDesc,
MaterialDesc, MaterialOverride, ModelRef, ObjectiveMarker, PhysicsBody, PostProcessVolumeDesc, AuthoringComponentStates, BrushDesc, ColliderDesc, EditorVisibility, InspectorOrder, LightDesc,
PrefabInstance, PrefabRef, Primitive, RigidBodyDesc, StaticMeshRenderer, TeamSpawn, MaterialDesc, MaterialOverride, ModelRef, NavigationArea, NavigationBounds, NavigationLink,
TriggerVolume, WeaponSpawn, NavigationObstacle, ObjectiveMarker, PhysicsBody, PostProcessVolumeDesc, PrefabInstance,
PrefabRef, Primitive, RigidBodyDesc, SceneComposition, SkinnedMeshRenderer, StaticMeshRenderer,
TeamSpawn, TriggerVolume, WeaponSpawn,
}; };
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct EditorEntitySnapshot { pub struct EditorEntitySnapshot {
@@ -13,13 +17,18 @@ pub struct EditorEntitySnapshot {
pub name: Option<String>, pub name: Option<String>,
pub transform: Transform, pub transform: Transform,
pub primitive: Option<Primitive>, pub primitive: Option<Primitive>,
pub brush: Option<BrushDesc>,
pub static_mesh_renderer: Option<StaticMeshRenderer>, pub static_mesh_renderer: Option<StaticMeshRenderer>,
pub skinned_mesh_renderer: Option<SkinnedMeshRenderer>,
pub material: Option<MaterialDesc>, pub material: Option<MaterialDesc>,
pub material_override: Option<MaterialOverride>, pub material_override: Option<MaterialOverride>,
pub rigid_body: Option<RigidBodyDesc>, pub rigid_body: Option<RigidBodyDesc>,
pub collider: Option<ColliderDesc>, pub collider: Option<ColliderDesc>,
pub physics: Option<PhysicsBody>, pub physics: Option<PhysicsBody>,
pub light: Option<LightDesc>, pub light: Option<LightDesc>,
pub animation_controller: Option<AnimationControllerDesc>,
pub audio_source: Option<AudioSourceDesc>,
pub audio_listener: Option<AudioListenerDesc>,
pub player_spawn: bool, pub player_spawn: bool,
pub model: Option<ModelRef>, pub model: Option<ModelRef>,
pub prefab: Option<PrefabRef>, pub prefab: Option<PrefabRef>,
@@ -29,11 +38,52 @@ pub struct EditorEntitySnapshot {
pub post_process_volume: Option<PostProcessVolumeDesc>, pub post_process_volume: Option<PostProcessVolumeDesc>,
pub team_spawn: Option<TeamSpawn>, pub team_spawn: Option<TeamSpawn>,
pub objective: Option<ObjectiveMarker>, pub objective: Option<ObjectiveMarker>,
pub navigation_bounds: Option<NavigationBounds>,
pub navigation_obstacle: Option<NavigationObstacle>,
pub navigation_area: Option<NavigationArea>,
pub navigation_link: Option<NavigationLink>,
pub hierarchy_sibling_index: i32, pub hierarchy_sibling_index: i32,
pub editor_visibility: EditorVisibility, pub editor_visibility: EditorVisibility,
pub inspector_order: Option<InspectorOrder>,
pub component_states: Option<AuthoringComponentStates>,
pub children: Vec<EditorEntitySnapshot>, pub children: Vec<EditorEntitySnapshot>,
} }
/// One reflected component value used by registry-driven editor transactions.
/// `component_id` is stable; `type_path` is retained only to resolve Bevy's
/// reflection adapter for this build.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ReflectedComponentValue {
pub component_id: String,
pub type_path: String,
pub ron: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ComponentDelta {
pub component_id: String,
pub type_path: String,
pub before: Option<ReflectedComponentValue>,
pub after: Option<ReflectedComponentValue>,
}
/// An atomic add/remove/reset/paste operation. Requirements, dependent removals,
/// and the derived ActorKind hint can be represented as additional deltas.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ComponentTransaction {
pub entity: Entity,
pub label: &'static str,
pub deltas: Vec<ComponentDelta>,
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct NavigationComponentState {
pub bounds: Option<NavigationBounds>,
pub obstacle: Option<NavigationObstacle>,
pub area: Option<NavigationArea>,
pub link: Option<NavigationLink>,
}
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct SiblingChange { pub struct SiblingChange {
pub entity: Entity, pub entity: Entity,
@@ -41,6 +91,17 @@ pub struct SiblingChange {
pub new_parent: Option<Entity>, pub new_parent: Option<Entity>,
pub old_index: i32, pub old_index: i32,
pub new_index: i32, pub new_index: i32,
pub old_transform: Option<Transform>,
pub new_transform: Option<Transform>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct PrefabEditState {
pub instance: Option<PrefabInstance>,
pub prefab_ref: Option<PrefabRef>,
pub blocked_reason: Option<String>,
pub transform: Option<Transform>,
pub material: Option<MaterialDesc>,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@@ -49,6 +110,10 @@ pub enum EditorCommand {
snapshot: EditorEntitySnapshot, snapshot: EditorEntitySnapshot,
entity: Option<Entity>, entity: Option<Entity>,
}, },
SpawnMany {
snapshots: Vec<EditorEntitySnapshot>,
entities: Vec<Entity>,
},
Despawn { Despawn {
snapshot: EditorEntitySnapshot, snapshot: EditorEntitySnapshot,
entity: Option<Entity>, entity: Option<Entity>,
@@ -72,6 +137,11 @@ pub enum EditorCommand {
old: Option<MaterialDesc>, old: Option<MaterialDesc>,
new: MaterialDesc, new: MaterialDesc,
}, },
SetMaterialGroup {
entities: Vec<Entity>,
olds: Vec<Option<MaterialDesc>>,
news: Vec<MaterialDesc>,
},
SetMaterialOverride { SetMaterialOverride {
entity: Entity, entity: Entity,
old: Option<MaterialOverride>, old: Option<MaterialOverride>,
@@ -82,6 +152,21 @@ pub enum EditorCommand {
old: Option<LightDesc>, old: Option<LightDesc>,
new: LightDesc, new: LightDesc,
}, },
SetAnimationController {
entity: Entity,
old: Option<AnimationControllerDesc>,
new: AnimationControllerDesc,
},
SetAudioSource {
entity: Entity,
old: Option<AudioSourceDesc>,
new: AudioSourceDesc,
},
SetAudioListener {
entity: Entity,
old: Option<AudioListenerDesc>,
new: AudioListenerDesc,
},
SetPhysics { SetPhysics {
entity: Entity, entity: Entity,
old: Option<PhysicsBody>, old: Option<PhysicsBody>,
@@ -102,6 +187,26 @@ pub enum EditorCommand {
old: Option<Primitive>, old: Option<Primitive>,
new: Primitive, new: Primitive,
}, },
SetBrush {
entity: Entity,
old: Option<BrushDesc>,
new: BrushDesc,
},
SetBrushTransform {
entity: Entity,
old_transform: Transform,
new_transform: Transform,
old_brush: Option<BrushDesc>,
new_brush: BrushDesc,
},
ApplyBrushCsg {
primary: Entity,
old_transform: Transform,
new_transform: Transform,
old_brush: Option<BrushDesc>,
new_brush: BrushDesc,
deleted: Vec<(EditorEntitySnapshot, Option<Entity>)>,
},
SetStaticMeshRenderer { SetStaticMeshRenderer {
entity: Entity, entity: Entity,
old: Option<StaticMeshRenderer>, old: Option<StaticMeshRenderer>,
@@ -112,6 +217,11 @@ pub enum EditorCommand {
old: Option<PostProcessVolumeDesc>, old: Option<PostProcessVolumeDesc>,
new: PostProcessVolumeDesc, new: PostProcessVolumeDesc,
}, },
SetNavigation {
entity: Entity,
old: NavigationComponentState,
new: NavigationComponentState,
},
SetTransformGroup { SetTransformGroup {
entities: Vec<Entity>, entities: Vec<Entity>,
olds: Vec<Transform>, olds: Vec<Transform>,
@@ -140,6 +250,35 @@ pub enum EditorCommand {
old: Option<InspectorOrder>, old: Option<InspectorOrder>,
new: InspectorOrder, new: InspectorOrder,
}, },
SetSceneComposition {
old: SceneComposition,
new: SceneComposition,
},
SetPrefabState {
entity: Entity,
old: PrefabEditState,
new: PrefabEditState,
},
ApplyPrefabToSource {
entity: Entity,
source_path: PathBuf,
before_source: String,
after_source: String,
old: PrefabEditState,
new: PrefabEditState,
},
UnpackPrefab {
entity: Entity,
instance: PrefabInstance,
prefab_ref: PrefabRef,
linked_actor_kind: ActorKind,
fully_local: bool,
linked_local_snapshots: Vec<EditorEntitySnapshot>,
linked_local_roots: Vec<Entity>,
unpacked_snapshots: Vec<EditorEntitySnapshot>,
unpacked_parented_to_anchor: Vec<bool>,
unpacked_roots: Vec<Entity>,
},
AddComponent { AddComponent {
entity: Entity, entity: Entity,
snapshot: EditorEntitySnapshot, snapshot: EditorEntitySnapshot,
@@ -148,4 +287,53 @@ pub enum EditorCommand {
entity: Entity, entity: Entity,
snapshot: EditorEntitySnapshot, snapshot: EditorEntitySnapshot,
}, },
ComponentTransaction(ComponentTransaction),
}
impl EditorCommand {
pub fn label(&self) -> &'static str {
match self {
EditorCommand::Spawn { .. } => "Spawn",
EditorCommand::SpawnMany { .. } => "Spawn Brushes",
EditorCommand::Despawn { .. } => "Delete",
EditorCommand::Duplicate { .. } => "Duplicate",
EditorCommand::Rename { .. } => "Rename",
EditorCommand::SetTransform { .. } => "Move",
EditorCommand::SetMaterial { .. } => "Set Material",
EditorCommand::SetMaterialGroup { .. } => "Apply Material to Selection",
EditorCommand::SetMaterialOverride { .. } => "Set Material Override",
EditorCommand::SetLight { .. } => "Set Light",
EditorCommand::SetAnimationController { .. } => "Set Animation Controller",
EditorCommand::SetAudioSource { .. } => "Set Audio Source",
EditorCommand::SetAudioListener { .. } => "Set Audio Listener",
EditorCommand::SetPhysics { .. } => "Set Physics",
EditorCommand::SetRigidBody { .. } => "Set Rigid Body",
EditorCommand::SetCollider { .. } => "Set Collider",
EditorCommand::SetPrimitive { .. } => "Set Primitive",
EditorCommand::SetBrush { .. } => "Set Brush",
EditorCommand::SetBrushTransform { .. } => "Clip Brush",
EditorCommand::ApplyBrushCsg { .. } => "Brush CSG",
EditorCommand::SetStaticMeshRenderer { .. } => "Set Static Mesh Renderer",
EditorCommand::SetPostProcessVolume { .. } => "Set Post Process Volume",
EditorCommand::SetNavigation { .. } => "Set Navigation",
EditorCommand::SetTransformGroup { .. } => "Move Selection",
EditorCommand::Reparent { .. } => "Reparent",
EditorCommand::SetActorKind { .. } => "Set Actor Kind",
EditorCommand::ReorderSibling { .. } => "Reorder Hierarchy",
EditorCommand::SetEditorVisibility { .. } => "Set Visibility",
EditorCommand::SetInspectorOrder { .. } => "Set Component Order",
EditorCommand::SetSceneComposition { .. } => "Set Scene Composition",
EditorCommand::SetPrefabState { .. } => "Edit Prefab Instance",
EditorCommand::ApplyPrefabToSource { .. } => "Apply Prefab to Source",
EditorCommand::UnpackPrefab {
fully_local: true, ..
} => "Convert Prefab to Local",
EditorCommand::UnpackPrefab {
fully_local: false, ..
} => "Unpack Prefab Layer",
EditorCommand::AddComponent { .. } => "Add Component",
EditorCommand::RemoveComponent { .. } => "Remove Component",
EditorCommand::ComponentTransaction(transaction) => transaction.label,
}
}
} }
File diff suppressed because it is too large. Load diff
+42 -3
View File
@@ -5,6 +5,7 @@ pub mod assets;
pub mod ext; pub mod ext;
pub mod history; pub mod history;
pub mod infra; pub mod infra;
pub mod operators;
pub mod play; pub mod play;
pub mod project; pub mod project;
pub mod render_target; pub mod render_target;
@@ -21,45 +22,69 @@ pub use ext::extensibility;
pub use ext::hot_reload; pub use ext::hot_reload;
pub use play::net_editor; pub use play::net_editor;
pub use play::state; pub use play::state;
pub use project::collaboration;
pub use project::diagnostics_bundle;
pub use project::launcher;
pub use project::native_dialog;
pub use project::project_io; pub use project::project_io;
pub use project::session;
pub use project::settings_ui; pub use project::settings_ui;
pub use project::workspace;
pub use scene::scene_io; pub use scene::scene_io;
pub use scene::scene_schema; pub use scene::scene_schema;
pub use scene::scene_view; pub use scene::scene_view;
pub use viewport::actor_icons; pub use viewport::actor_icons;
pub use viewport::brush_csg;
pub use viewport::brush_edit;
pub use viewport::brush_tool;
pub use viewport::camera; pub use viewport::camera;
pub use viewport::gizmos; pub use viewport::gizmos;
pub use viewport::material_drop;
pub use viewport::physics_placement;
pub use viewport::render_view; pub use viewport::render_view;
pub use viewport::rendering_diagnostics; pub use viewport::rendering_diagnostics;
pub use viewport::selection; pub use viewport::selection;
pub use viewport::selection_outline; pub use viewport::selection_outline;
pub use viewport::terrain_paint;
pub use viewport::terrain_sculpt;
pub use viewport::visualizers; pub use viewport::visualizers;
use bevy::app::PluginGroupBuilder; use bevy::app::PluginGroupBuilder;
use bevy::prelude::*; use bevy::prelude::*;
use bevy_egui::EguiPlugin; use bevy_egui::EguiPlugin;
use game::{ use game::{
launch, GameInputEnabled, GameInputFocused, GamePlugin, GameRenderBootstrap, SimEnabled, launch, GameInputEnabled, GameInputFocused, GamePlugin, GameRenderBootstrap,
GameSceneBootstrap, SimEnabled,
}; };
use transform_gizmo_bevy::prelude::TransformGizmoPlugin; use transform_gizmo_bevy::prelude::TransformGizmoPlugin;
use actor_icons::ActorIconsPlugin; use actor_icons::ActorIconsPlugin;
use asset_db::AssetDbPlugin; use asset_db::AssetDbPlugin;
use brush_csg::BrushCsgPlugin;
use brush_edit::BrushEditPlugin;
use brush_tool::BrushToolPlugin;
use camera::EditorCameraPlugin; use camera::EditorCameraPlugin;
use extensibility::ExtensibilityPlugin; use extensibility::ExtensibilityPlugin;
use gizmos::EditorGizmoPlugin; use gizmos::EditorGizmoPlugin;
use history::EditorHistoryPlugin; use history::EditorHistoryPlugin;
use infra::EditorInfraPlugin; use infra::EditorInfraPlugin;
use material_drop::MaterialDropPlugin;
use operators::OperatorPlugin;
use physics_placement::PhysicsPlacementPlugin;
use play::audio_preview::AudioPreviewPlugin;
use play::PlaySessionPlugin; use play::PlaySessionPlugin;
use project::collaboration::CollaborationPlugin;
use project::native_dialog::NativeDialogPlugin;
use project_io::ProjectIoPlugin; use project_io::ProjectIoPlugin;
use render_view::RenderViewPlugin; use render_view::RenderViewPlugin;
use scene_io::SceneIoPlugin; use scene_io::SceneIoPlugin;
use scene_view::SceneViewPlugin; use scene_view::SceneViewPlugin;
use selection::EditorSelectionPlugin; use selection::EditorSelectionPlugin;
use selection_outline::SelectionOutlinePlugin; use selection_outline::SelectionOutlinePlugin;
use session::EditorSessionPlugin;
use settings_ui::SettingsUiPlugin; use settings_ui::SettingsUiPlugin;
use state::EditorStatePlugin; use state::EditorStatePlugin;
use terrain_paint::TerrainPaintPlugin;
use terrain_sculpt::TerrainSculptPlugin;
use ui::EditorUiPlugin; use ui::EditorUiPlugin;
use viewport::ViewportPlugin; use viewport::ViewportPlugin;
use visualizers::EditorVisualizersPlugin; use visualizers::EditorVisualizersPlugin;
@@ -73,10 +98,11 @@ impl PluginGroup for EditorPluginGroup {
let group = PluginGroupBuilder::start::<Self>() let group = PluginGroupBuilder::start::<Self>()
.add(EditorInfraPlugin) .add(EditorInfraPlugin)
.add(ProjectIoPlugin) .add(ProjectIoPlugin)
.add(workspace::WorkspacePlugin) .add(NativeDialogPlugin)
.add(scene_schema::SceneSchemaPlugin) .add(scene_schema::SceneSchemaPlugin)
.add(net_editor::NetEditorPlugin) .add(net_editor::NetEditorPlugin)
.add(AssetDbPlugin) .add(AssetDbPlugin)
.add(OperatorPlugin)
.add(ExtensibilityPlugin) .add(ExtensibilityPlugin)
.add(SettingsUiPlugin) .add(SettingsUiPlugin)
.add(assets::EditorAssetsPlugin) .add(assets::EditorAssetsPlugin)
@@ -86,15 +112,25 @@ impl PluginGroup for EditorPluginGroup {
.add(SceneViewPlugin) .add(SceneViewPlugin)
.add(PlaySessionPlugin) .add(PlaySessionPlugin)
.add(ViewportPlugin) .add(ViewportPlugin)
.add(BrushCsgPlugin)
.add(BrushEditPlugin)
.add(BrushToolPlugin)
.add(TerrainSculptPlugin)
.add(TerrainPaintPlugin)
.add(EditorCameraPlugin) .add(EditorCameraPlugin)
.add(AudioPreviewPlugin)
.add(ActorIconsPlugin) .add(ActorIconsPlugin)
.add(MaterialDropPlugin)
.add(PhysicsPlacementPlugin)
.add(EditorSelectionPlugin) .add(EditorSelectionPlugin)
.add(SelectionOutlinePlugin) .add(SelectionOutlinePlugin)
.add(EditorGizmoPlugin) .add(EditorGizmoPlugin)
.add(EditorVisualizersPlugin) .add(EditorVisualizersPlugin)
.add(EditorHistoryPlugin) .add(EditorHistoryPlugin)
.add(SceneIoPlugin) .add(SceneIoPlugin)
.add(CollaborationPlugin)
.add(EditorUiPlugin) .add(EditorUiPlugin)
.add(EditorSessionPlugin)
.add(brp::BrpPlugin); .add(brp::BrpPlugin);
#[cfg(feature = "hot-reload")] #[cfg(feature = "hot-reload")]
let group = group.add(hot_reload::HotReloadPlugin); let group = group.add(hot_reload::HotReloadPlugin);
@@ -111,6 +147,9 @@ pub fn configure_editor_app(app: &mut App) {
.insert_resource(GameRenderBootstrap { .insert_resource(GameRenderBootstrap {
defer_player_camera_fx: true, defer_player_camera_fx: true,
}) })
.insert_resource(GameSceneBootstrap {
defer_default_level: true,
})
.add_plugins(GamePlugin) .add_plugins(GamePlugin)
.add_plugins(MeshPickingPlugin) .add_plugins(MeshPickingPlugin)
.add_plugins(TransformGizmoPlugin) .add_plugins(TransformGizmoPlugin)
+378
View File
@@ -0,0 +1,378 @@
//! Shared lifecycle for editor actions that mutate or drive tools.
use bevy::prelude::*;
use crate::history::EditorHistory;
#[cfg(test)]
pub(crate) mod test_harness;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum OperatorPhase {
Idle,
Preview,
Committed,
Canceled,
Blocked,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct OperatorStatus {
pub id: String,
pub label: String,
pub phase: OperatorPhase,
pub hint: String,
pub warnings: Vec<String>,
}
impl OperatorStatus {
fn new(id: &str, label: &str, phase: OperatorPhase, hint: impl Into<String>) -> Self {
Self {
id: id.to_string(),
label: label.to_string(),
phase,
hint: hint.into(),
warnings: Vec::new(),
}
}
}
#[derive(Resource, Debug, Default)]
pub struct ActiveOperator {
pub status: Option<OperatorStatus>,
}
impl ActiveOperator {
pub fn label(&self) -> Option<String> {
self.status
.as_ref()
.map(|status| match status.hint.is_empty() {
true => format!("Tool: {}", status.label),
false => format!("Tool: {} - {}", status.label, status.hint),
})
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum OperatorAvailability {
Ready,
Disabled(String),
}
pub trait EditorOperator {
fn id(&self) -> &str;
fn label(&self) -> &str;
fn can_start(&self, _world: &World) -> OperatorAvailability {
OperatorAvailability::Ready
}
fn begin(&mut self, _world: &mut World) -> Result<(), String> {
Ok(())
}
fn preview(&mut self, _world: &mut World) -> Result<(), String> {
Ok(())
}
fn commit(&mut self, world: &mut World) -> Result<(), String>;
fn cancel(&mut self, _world: &mut World) {}
fn undo_label(&self) -> String {
self.label().to_string()
}
}
pub struct OperatorPlugin;
impl Plugin for OperatorPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<ActiveOperator>();
}
}
pub fn run_operator(world: &mut World, operator: &mut dyn EditorOperator) -> bool {
let undo_depth_before = world
.get_resource::<EditorHistory>()
.map(EditorHistory::undo_depth)
.unwrap_or_default();
match operator.can_start(world) {
OperatorAvailability::Ready => {}
OperatorAvailability::Disabled(reason) => {
set_operator_status(
world,
OperatorStatus::new(
operator.id(),
operator.label(),
OperatorPhase::Blocked,
reason,
),
);
return false;
}
}
set_operator_status(
world,
OperatorStatus::new(
operator.id(),
operator.label(),
OperatorPhase::Preview,
"Preview",
),
);
if let Err(err) = operator.begin(world).and_then(|_| operator.preview(world)) {
operator.cancel(world);
set_operator_status(
world,
OperatorStatus::new(
operator.id(),
operator.label(),
OperatorPhase::Canceled,
err,
),
);
return false;
}
match operator.commit(world) {
Ok(()) => {
let status = OperatorStatus::new(
operator.id(),
operator.label(),
OperatorPhase::Committed,
format!("Committed {}", operator.undo_label()),
);
set_operator_status(world, status);
let undo_depth_after = world
.get_resource::<EditorHistory>()
.map(EditorHistory::undo_depth)
.unwrap_or_default();
if undo_depth_after > undo_depth_before {
let Some(label) = world.resource::<ActiveOperator>().label() else {
return true;
};
world.resource_mut::<EditorHistory>().set_undo_status(label);
}
true
}
Err(err) => {
operator.cancel(world);
set_operator_status(
world,
OperatorStatus::new(
operator.id(),
operator.label(),
OperatorPhase::Canceled,
err,
),
);
false
}
}
}
pub fn run_immediate_operator(
world: &mut World,
id: &str,
label: &str,
availability: OperatorAvailability,
commit: impl FnOnce(&mut World) -> Result<(), String>,
) -> bool {
struct ImmediateOperator<F> {
id: String,
label: String,
availability: OperatorAvailability,
commit: Option<F>,
}
impl<F> EditorOperator for ImmediateOperator<F>
where
F: FnOnce(&mut World) -> Result<(), String>,
{
fn id(&self) -> &str {
&self.id
}
fn label(&self) -> &str {
&self.label
}
fn can_start(&self, _world: &World) -> OperatorAvailability {
self.availability.clone()
}
fn commit(&mut self, world: &mut World) -> Result<(), String> {
self.commit
.take()
.expect("immediate operator commit must run once")(world)
}
}
let mut operator = ImmediateOperator {
id: id.to_string(),
label: label.to_string(),
availability,
commit: Some(commit),
};
run_operator(world, &mut operator)
}
fn set_operator_status(world: &mut World, status: OperatorStatus) {
if let Some(mut active) = world.get_resource_mut::<ActiveOperator>() {
active.status = Some(status);
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::history::EditorHistory;
use crate::operators::test_harness::OperatorInvariantHarness;
use crate::scene_io::SceneIo;
#[derive(Resource, Default)]
struct Counter(i32);
#[derive(Component)]
struct PreviewHelper;
struct CounterOperator {
before: i32,
helper: Option<Entity>,
}
impl EditorOperator for CounterOperator {
fn id(&self) -> &str {
"test.counter"
}
fn label(&self) -> &str {
"Increment Counter"
}
fn begin(&mut self, world: &mut World) -> Result<(), String> {
self.before = world.resource::<Counter>().0;
self.helper = Some(world.spawn(PreviewHelper).id());
Ok(())
}
fn preview(&mut self, world: &mut World) -> Result<(), String> {
world.resource_mut::<Counter>().0 += 1;
Ok(())
}
fn commit(&mut self, world: &mut World) -> Result<(), String> {
self.remove_helper(world);
Ok(())
}
fn cancel(&mut self, world: &mut World) {
world.resource_mut::<Counter>().0 = self.before;
self.remove_helper(world);
}
}
impl CounterOperator {
fn remove_helper(&mut self, world: &mut World) {
if let Some(helper) = self.helper.take() {
if let Ok(entity) = world.get_entity_mut(helper) {
entity.despawn();
}
}
}
}
fn test_world() -> World {
let mut world = World::new();
world.init_resource::<ActiveOperator>();
world.init_resource::<Counter>();
world.init_resource::<EditorHistory>();
world.init_resource::<SceneIo>();
world
}
#[test]
fn operator_commit_keeps_previewed_change() {
let mut world = test_world();
let harness = OperatorInvariantHarness::capture(&mut world);
let mut operator = CounterOperator {
before: 0,
helper: None,
};
assert!(run_operator(&mut world, &mut operator));
assert_eq!(world.resource::<Counter>().0, 1);
harness.assert_committed(&mut world, 0, 0);
harness.assert_no_helpers::<PreviewHelper>(&mut world);
}
#[test]
fn operator_cancel_restores_previewed_change_on_commit_error() {
struct FailingCounterOperator(CounterOperator);
impl EditorOperator for FailingCounterOperator {
fn id(&self) -> &str {
self.0.id()
}
fn label(&self) -> &str {
self.0.label()
}
fn begin(&mut self, world: &mut World) -> Result<(), String> {
self.0.begin(world)
}
fn preview(&mut self, world: &mut World) -> Result<(), String> {
self.0.preview(world)
}
fn commit(&mut self, _world: &mut World) -> Result<(), String> {
Err("commit failed".to_string())
}
fn cancel(&mut self, world: &mut World) {
self.0.cancel(world);
}
}
let mut world = test_world();
let harness = OperatorInvariantHarness::capture(&mut world);
let mut operator = FailingCounterOperator(CounterOperator {
before: 0,
helper: None,
});
assert!(!run_operator(&mut world, &mut operator));
assert_eq!(world.resource::<Counter>().0, 0);
harness.assert_canceled(&mut world);
harness.assert_no_helpers::<PreviewHelper>(&mut world);
}
#[test]
fn blocked_operator_never_begins_or_mutates_world() {
let mut world = test_world();
let harness = OperatorInvariantHarness::capture(&mut world);
let result = run_immediate_operator(
&mut world,
"test.blocked",
"Blocked Operator",
OperatorAvailability::Disabled("fixture unavailable".to_string()),
|world| {
world.resource_mut::<Counter>().0 += 1;
Ok(())
},
);
assert!(!result);
assert_eq!(world.resource::<Counter>().0, 0);
harness.assert_blocked(&mut world);
}
}
+136
View File
@@ -0,0 +1,136 @@
//! Reusable invariant assertions for modal tools and editor operators.
use std::fmt::Debug;
use bevy::prelude::*;
use shared::LevelObject;
use crate::history::{apply_command_redo, apply_command_undo, EditorHistory};
use crate::operators::{ActiveOperator, OperatorPhase};
use crate::scene_io::SceneIo;
#[derive(Debug)]
pub(crate) struct OperatorInvariantHarness {
undo_depth: usize,
dirty: bool,
authored_count: usize,
}
impl OperatorInvariantHarness {
pub(crate) fn capture(world: &mut World) -> Self {
Self {
undo_depth: world
.get_resource::<EditorHistory>()
.map(EditorHistory::undo_depth)
.unwrap_or_default(),
dirty: world
.get_resource::<SceneIo>()
.is_some_and(|scene_io| scene_io.dirty),
authored_count: authored_count(world),
}
}
pub(crate) fn assert_committed(
&self,
world: &mut World,
undo_delta: usize,
authored_delta: isize,
) {
self.assert_phase(world, OperatorPhase::Committed);
assert_eq!(
world.resource::<EditorHistory>().undo_depth(),
self.undo_depth + undo_delta,
"committed operator must create the expected number of undo groups"
);
if undo_delta > 0 {
assert!(
world.resource::<SceneIo>().dirty,
"a committed authored mutation must mark the scene dirty"
);
}
assert_eq!(
authored_count(world) as isize,
self.authored_count as isize + authored_delta,
"committed operator changed an unexpected number of authored entities"
);
}
pub(crate) fn assert_canceled(&self, world: &mut World) {
self.assert_phase(world, OperatorPhase::Canceled);
assert_eq!(
world.resource::<EditorHistory>().undo_depth(),
self.undo_depth,
"canceled operator must not create undo history"
);
assert_eq!(
world.resource::<SceneIo>().dirty,
self.dirty,
"canceled operator must preserve the prior dirty state"
);
assert_eq!(
authored_count(world),
self.authored_count,
"canceled operator must restore authored entity state"
);
}
pub(crate) fn assert_blocked(&self, world: &mut World) {
self.assert_phase(world, OperatorPhase::Blocked);
assert_eq!(
world.resource::<EditorHistory>().undo_depth(),
self.undo_depth
);
assert_eq!(world.resource::<SceneIo>().dirty, self.dirty);
assert_eq!(authored_count(world), self.authored_count);
}
pub(crate) fn assert_no_helpers<T: Component>(&self, world: &mut World) {
let mut query = world.query_filtered::<Entity, With<T>>();
assert_eq!(
query.iter(world).count(),
0,
"operator left preview/helper entities behind"
);
}
fn assert_phase(&self, world: &World, expected: OperatorPhase) {
let phase = world
.resource::<ActiveOperator>()
.status
.as_ref()
.map(|status| status.phase.clone());
assert_eq!(phase, Some(expected), "operator reported the wrong phase");
}
}
pub(crate) fn assert_undo_redo_round_trip<T>(
world: &mut World,
initial: T,
committed: T,
mut read: impl FnMut(&mut World) -> T,
) where
T: Debug + PartialEq,
{
assert_eq!(
read(world),
committed,
"commit state did not match expectation"
);
apply_command_undo(world);
assert_eq!(
read(world),
initial,
"undo did not restore the initial state"
);
apply_command_redo(world);
assert_eq!(
read(world),
committed,
"redo did not restore the committed state"
);
}
fn authored_count(world: &mut World) -> usize {
let mut query = world.query_filtered::<Entity, With<LevelObject>>();
query.iter(world).count()
}
+468
View File
@@ -0,0 +1,468 @@
//! Transient, non-dirty audio audition owned by the editor.
use bevy::asset::LoadState;
use bevy::audio::{
AudioPlayer, AudioSink, AudioSinkPlayback, AudioSource, PlaybackMode, PlaybackSettings,
SpatialAudioSink, SpatialListener, SpatialScale, Volume,
};
use bevy::prelude::*;
use settings::AUDIO_BUS_SFX_ID;
use shared::{asset_server_path, AudioAttenuationDesc, AudioSourceDesc};
use crate::assets::{EditorAsset, EditorAssetKind};
use crate::camera::EditorCamera;
use crate::infra::EditorOnly;
use crate::state::EditorMode;
#[derive(Resource, Debug, Clone, Default)]
pub struct AudioPreviewState {
pub voices: Vec<Entity>,
pub source: Option<Entity>,
pub clip_path: Option<String>,
pub status: String,
clip_handle: Option<Handle<AudioSource>>,
listener: Option<Entity>,
}
#[derive(Component, Debug, Clone)]
struct AudioPreviewVoice {
source: Option<Entity>,
bus: String,
source_gain_db: f32,
mix_weight: f32,
spatial: bool,
attenuation: AudioAttenuationDesc,
}
#[derive(Component, Debug, Clone, Copy)]
struct EditorAudioPreviewListener;
pub struct AudioPreviewPlugin;
impl Plugin for AudioPreviewPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<AudioPreviewState>()
.add_systems(Update, update_audio_preview)
.add_systems(OnEnter(EditorMode::Playing), stop_audio_preview);
}
}
pub fn audition_audio_source(world: &mut World, source: Entity) -> Result<(), String> {
ensure_edit_mode(world)?;
let descriptor = world
.get::<AudioSourceDesc>(source)
.cloned()
.ok_or_else(|| "Selected actor has no AudioSourceDesc".to_string())?;
let path = descriptor
.clip
.as_ref()
.and_then(|clip| clip.source_path.as_deref())
.filter(|path| !path.trim().is_empty())
.ok_or_else(|| "Assign an audio clip before auditioning this source".to_string())?
.to_string();
spawn_preview(world, path, Some((source, descriptor)))
}
pub fn audition_audio_asset(world: &mut World, asset: &EditorAsset) -> Result<(), String> {
ensure_edit_mode(world)?;
if !matches!(asset.kind, EditorAssetKind::AudioClip) {
return Err("Selected asset is not an audio clip".into());
}
let path = asset
.path
.as_deref()
.filter(|path| !path.trim().is_empty())
.ok_or_else(|| "Audio clip has no project path".to_string())?
.to_string();
spawn_preview(world, path, None)
}
fn ensure_edit_mode(world: &World) -> Result<(), String> {
if *world.resource::<State<EditorMode>>().get() != EditorMode::Editing {
return Err("Audio audition is available only in Edit mode".into());
}
Ok(())
}
fn spawn_preview(
world: &mut World,
path: String,
source: Option<(Entity, AudioSourceDesc)>,
) -> Result<(), String> {
stop_audio_preview(world);
let descriptor = source
.as_ref()
.map(|(_, descriptor)| descriptor.clone())
.unwrap_or_else(|| AudioSourceDesc {
autoplay: false,
spatial_blend: 0.0,
bus: AUDIO_BUS_SFX_ID.into(),
..Default::default()
});
let source_entity = source.as_ref().map(|(entity, _)| *entity);
let mixes = game::audio::audio_voice_mix(descriptor.spatial_blend);
let panning_scale = game::audio::spatial_panning_scale(&descriptor.attenuation, 0.2);
let needs_listener = mixes.iter().any(|(spatial, _)| *spatial);
let listener = if needs_listener {
let mut query = world
.query_filtered::<(Entity, &GlobalTransform, Has<SpatialListener>), With<EditorCamera>>(
);
Some(
query
.iter(world)
.next()
.map(|(entity, transform, has_listener)| (entity, *transform, has_listener))
.ok_or_else(|| "Editor camera is unavailable for spatial audition".to_string())?,
)
} else {
None
};
let listener = listener.map(|(camera, camera_transform, has_listener)| {
if has_listener {
camera
} else {
world
.spawn((
Name::new("Editor Audio Preview Listener"),
EditorOnly,
Transform::IDENTITY,
camera_transform,
SpatialListener::new(0.2),
EditorAudioPreviewListener,
ChildOf(camera),
))
.id()
}
});
let asset_server = world.resource::<AssetServer>().clone();
let handle: Handle<AudioSource> = asset_server.load(asset_server_path(&path));
let mut voices = Vec::with_capacity(mixes.len());
for (spatial, mix_weight) in mixes {
let mut voice = world.spawn((
Name::new(if spatial {
"Editor Spatial Audio Preview"
} else {
"Editor 2D Audio Preview"
}),
EditorOnly,
Transform::IDENTITY,
AudioPlayer::new(handle.clone()),
PlaybackSettings {
mode: PlaybackMode::Once,
volume: Volume::Linear(0.0),
speed: descriptor.pitch,
paused: false,
muted: false,
spatial,
spatial_scale: spatial.then(|| SpatialScale::new(panning_scale)),
start_position: None,
duration: None,
},
AudioPreviewVoice {
source: source_entity,
bus: descriptor.bus.clone(),
source_gain_db: descriptor.gain_db,
mix_weight,
spatial,
attenuation: descriptor.attenuation,
},
));
if let Some(source) = source_entity {
voice.insert(ChildOf(source));
}
voices.push(voice.id());
}
*world.resource_mut::<AudioPreviewState>() = AudioPreviewState {
voices,
source: source_entity,
clip_path: Some(path.clone()),
status: format!("Auditioning {}", file_label(&path)),
clip_handle: Some(handle),
listener,
};
Ok(())
}
fn file_label(path: &str) -> &str {
std::path::Path::new(path)
.file_name()
.and_then(|name| name.to_str())
.unwrap_or(path)
}
pub fn stop_audio_preview(world: &mut World) {
stop_audio_preview_with_status(world, "Audio preview stopped");
}
fn stop_audio_preview_with_status(world: &mut World, status: impl Into<String>) {
let voices = std::mem::take(&mut world.resource_mut::<AudioPreviewState>().voices);
for voice in voices {
if let Some(sink) = world.get::<AudioSink>(voice) {
sink.stop();
}
if let Some(sink) = world.get::<SpatialAudioSink>(voice) {
sink.stop();
}
if let Ok(entity_mut) = world.get_entity_mut(voice) {
entity_mut.despawn();
}
}
let mut query = world.query_filtered::<Entity, With<EditorAudioPreviewListener>>();
let listeners: Vec<Entity> = query.iter(world).collect();
for listener in listeners {
if let Ok(entity_mut) = world.get_entity_mut(listener) {
entity_mut.despawn();
}
}
let state = world.resource_mut::<AudioPreviewState>().into_inner();
state.source = None;
state.clip_path = None;
state.clip_handle = None;
state.listener = None;
state.status = status.into();
}
fn update_audio_preview(world: &mut World) {
let state = world.resource::<AudioPreviewState>().clone();
if state.voices.is_empty() {
return;
}
if *world.resource::<State<EditorMode>>().get() != EditorMode::Editing {
stop_audio_preview_with_status(world, "Audio preview stopped on entering Play mode");
return;
}
if state.source.is_some_and(|source| {
world.get_entity(source).is_err() || world.get::<AudioSourceDesc>(source).is_none()
}) {
stop_audio_preview_with_status(world, "Audio preview stopped because its source changed");
return;
}
if state
.listener
.is_some_and(|listener| world.get::<GlobalTransform>(listener).is_none())
{
stop_audio_preview_with_status(
world,
"Audio preview stopped because the editor camera changed",
);
return;
}
if let Some(LoadState::Failed(error)) = state
.clip_handle
.as_ref()
.map(|handle| world.resource::<AssetServer>().load_state(handle.id()))
{
let status = format!("Audio preview failed: {error}");
stop_audio_preview_with_status(world, status.clone());
if let Some(mut scene_io) = world.get_resource_mut::<crate::scene_io::SceneIo>() {
scene_io.set_status(status);
}
return;
}
let listener_position = state
.listener
.and_then(|listener| world.get::<GlobalTransform>(listener))
.map(GlobalTransform::translation);
let project_audio = world.resource::<settings::ProjectSettings>().audio.clone();
let bus_runtime = world.resource::<game::audio::AudioBusRuntime>().clone();
let mut finished = 0usize;
for voice_entity in &state.voices {
let Some(voice) = world.get::<AudioPreviewVoice>(*voice_entity).cloned() else {
finished += 1;
continue;
};
let source_position = voice
.source
.and_then(|source| world.get::<GlobalTransform>(source))
.map(GlobalTransform::translation);
let attenuation = if voice.spatial {
match (listener_position, source_position) {
(Some(listener), Some(source)) => {
game::audio::attenuation_gain(&voice.attenuation, listener.distance(source))
}
_ => 0.0,
}
} else {
1.0
};
let gain = game::audio::db_to_linear(voice.source_gain_db)
* game::audio::effective_bus_gain_linear(&project_audio, &bus_runtime, &voice.bus)
* voice.mix_weight
* attenuation;
if let Some(mut sink) = world.get_mut::<AudioSink>(*voice_entity) {
sink.set_volume(Volume::Linear(gain));
if sink.empty() {
finished += 1;
}
} else if let Some(mut sink) = world.get_mut::<SpatialAudioSink>(*voice_entity) {
sink.set_volume(Volume::Linear(gain));
if sink.empty() {
finished += 1;
}
}
}
if finished == state.voices.len() {
stop_audio_preview_with_status(world, "Audio preview finished");
}
}
#[cfg(test)]
mod tests {
use super::*;
use bevy::asset::{AssetApp, AssetPlugin};
use bevy::state::app::StatesPlugin;
use shared::{EditorAssetRef, AUDIO_CLIP_SUB_ASSET_ID};
#[test]
fn file_label_is_stable_for_project_paths() {
assert_eq!(file_label("assets/audio/impact.ogg"), "impact.ogg");
assert_eq!(file_label("clip.wav"), "clip.wav");
}
fn preview_app() -> App {
let mut app = App::new();
app.add_plugins((MinimalPlugins, AssetPlugin::default(), StatesPlugin))
.init_asset::<AudioSource>()
.init_state::<EditorMode>()
.add_plugins(AudioPreviewPlugin)
.init_resource::<crate::scene_io::SceneIo>()
.init_resource::<crate::history::EditorHistory>()
.init_resource::<game::audio::AudioBusRuntime>()
.insert_resource(settings::ProjectSettings::default());
app
}
fn spawn_camera(app: &mut App, listener: Option<SpatialListener>) -> Entity {
let mut camera = app.world_mut().spawn((
EditorCamera::default(),
Transform::IDENTITY,
GlobalTransform::IDENTITY,
));
if let Some(listener) = listener {
camera.insert(listener);
}
camera.id()
}
fn spawn_source(app: &mut App) -> Entity {
app.world_mut()
.spawn((
Transform::from_xyz(0.0, 0.0, -2.0),
GlobalTransform::IDENTITY,
AudioSourceDesc {
clip: Some(
EditorAssetRef::new("audio-id", AUDIO_CLIP_SUB_ASSET_ID, "Impact")
.with_source_path("assets/audio/impact.ogg"),
),
..Default::default()
},
))
.id()
}
#[test]
fn audition_and_stop_do_not_dirty_scene_or_push_history() {
let mut app = preview_app();
spawn_camera(&mut app, None);
let source = spawn_source(&mut app);
audition_audio_source(app.world_mut(), source).unwrap();
assert!(!app
.world()
.resource::<AudioPreviewState>()
.voices
.is_empty());
assert!(!app.world().resource::<crate::scene_io::SceneIo>().dirty);
assert_eq!(
app.world()
.resource::<crate::history::EditorHistory>()
.undo_depth(),
0
);
stop_audio_preview(app.world_mut());
assert!(app
.world()
.resource::<AudioPreviewState>()
.voices
.is_empty());
assert!(!app.world().resource::<crate::scene_io::SceneIo>().dirty);
assert_eq!(
app.world()
.resource::<crate::history::EditorHistory>()
.undo_depth(),
0
);
}
#[test]
fn spatial_preview_preserves_an_existing_editor_camera_listener() {
let mut app = preview_app();
let camera = spawn_camera(&mut app, Some(SpatialListener::new(0.5)));
let source = spawn_source(&mut app);
let expected = app.world().get::<SpatialListener>(camera).unwrap().clone();
audition_audio_source(app.world_mut(), source).unwrap();
let actual = app.world().get::<SpatialListener>(camera).unwrap();
assert_eq!(actual.left_ear_offset, expected.left_ear_offset);
assert_eq!(actual.right_ear_offset, expected.right_ear_offset);
assert_eq!(
app.world().resource::<AudioPreviewState>().listener,
Some(camera)
);
let mut preview_listeners = app
.world_mut()
.query_filtered::<Entity, With<EditorAudioPreviewListener>>();
assert_eq!(preview_listeners.iter(app.world()).count(), 0);
stop_audio_preview(app.world_mut());
let actual = app.world().get::<SpatialListener>(camera).unwrap();
assert_eq!(actual.left_ear_offset, expected.left_ear_offset);
assert_eq!(actual.right_ear_offset, expected.right_ear_offset);
}
#[test]
fn source_component_removal_cleans_up_preview() {
let mut app = preview_app();
spawn_camera(&mut app, None);
let source = spawn_source(&mut app);
audition_audio_source(app.world_mut(), source).unwrap();
app.world_mut()
.entity_mut(source)
.remove::<AudioSourceDesc>();
update_audio_preview(app.world_mut());
let state = app.world().resource::<AudioPreviewState>();
assert!(state.voices.is_empty());
assert!(state.source.is_none());
assert!(state.status.contains("source changed"));
}
#[test]
fn entering_play_mode_cleans_up_preview() {
let mut app = preview_app();
spawn_camera(&mut app, None);
let source = spawn_source(&mut app);
audition_audio_source(app.world_mut(), source).unwrap();
app.world_mut()
.resource_mut::<NextState<EditorMode>>()
.set(EditorMode::Playing);
app.update();
let state = app.world().resource::<AudioPreviewState>();
assert!(state.voices.is_empty());
assert!(state.source.is_none());
let mut preview_listeners = app
.world_mut()
.query_filtered::<Entity, With<EditorAudioPreviewListener>>();
assert_eq!(preview_listeners.iter(app.world()).count(), 0);
}
}
+1
View File
@@ -1,5 +1,6 @@
//! Play-in-editor session, editor mode state, and net editor profiles. //! Play-in-editor session, editor mode state, and net editor profiles.
pub mod audio_preview;
pub mod net_editor; pub mod net_editor;
mod session; mod session;
pub mod state; pub mod state;
+13 -4
View File
@@ -6,7 +6,10 @@ use bevy::window::WindowRef;
use game::player::PlayerCamera; use game::player::PlayerCamera;
use protocol::PlayerInputIntent; use protocol::PlayerInputIntent;
use settings::SimTuning; use settings::SimTuning;
use shared::{inspector_component_active, InspectorOrder, PlayerSpawn, COMPONENT_PLAYER_SPAWN}; use shared::{
authoring_component_active, AuthoringComponentStates, InspectorOrder, PlayerSpawn,
COMPONENT_PLAYER_SPAWN,
};
use sim::{Crouching, Grounded, JumpState, Player, PlayerVelocity}; use sim::{Crouching, Grounded, JumpState, Player, PlayerVelocity};
use crate::render_target::ViewportRenderTarget; use crate::render_target::ViewportRenderTarget;
@@ -66,10 +69,16 @@ fn bootstrap_player_on_play(world: &mut World) {
.unwrap_or_else(|| SimTuning::from_physics(&settings::PhysicsSettings::default())); .unwrap_or_else(|| SimTuning::from_physics(&settings::PhysicsSettings::default()));
let spawn = world let spawn = world
.query_filtered::<(&Transform, Option<&InspectorOrder>), With<PlayerSpawn>>() .query_filtered::<(
&Transform,
Option<&AuthoringComponentStates>,
Option<&InspectorOrder>,
), With<PlayerSpawn>>()
.iter(world) .iter(world)
.filter(|(_, order)| inspector_component_active(*order, COMPONENT_PLAYER_SPAWN)) .filter(|(_, states, legacy_order)| {
.map(|(transform, _)| transform) authoring_component_active(*states, *legacy_order, COMPONENT_PLAYER_SPAWN)
})
.map(|(transform, _, _)| transform)
.next() .next()
.copied() .copied()
.unwrap_or_else(default_player_spawn); .unwrap_or_else(default_player_spawn);
+56 -7
View File
@@ -1,13 +1,15 @@
use std::time::Duration;
use avian3d::prelude::{Physics, PhysicsTime};
use bevy::prelude::*; use bevy::prelude::*;
use bevy::window::{CursorGrabMode, CursorOptions, PrimaryWindow}; use bevy::window::{CursorGrabMode, CursorOptions, PrimaryWindow};
use bevy_egui::PrimaryEguiContext; use bevy_egui::PrimaryEguiContext;
use game::player::PlayerCamera; use game::player::PlayerCamera;
use game::{GameInputEnabled, GameInputFocused, SimEnabled}; use game::{GameInputEnabled, GameInputFocused, SimEnabled};
use protocol::PlayerInputIntent; use protocol::{PlayerInputIntent, SIM_TICK_RATE_HZ};
use sim::{Crouching, Grounded, JumpState, Player, PlayerVelocity}; use sim::{Crouching, Grounded, JumpState, Player, PlayerVelocity};
use crate::camera::EditorCamera; use crate::camera::EditorCamera;
use crate::scene_io::SceneIo;
/// Editor/game mode. `Playing` runs the real game sim; use [`PlayPossession`] for camera control. /// Editor/game mode. `Playing` runs the real game sim; use [`PlayPossession`] for camera control.
#[derive(States, Debug, Clone, Copy, PartialEq, Eq, Hash, Default)] #[derive(States, Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
@@ -196,6 +198,7 @@ pub(crate) fn sync_mode_resources_and_cameras(
mut step: ResMut<PlayStepOnce>, mut step: ResMut<PlayStepOnce>,
mut input_enabled: ResMut<GameInputEnabled>, mut input_enabled: ResMut<GameInputEnabled>,
mut sim_enabled: ResMut<SimEnabled>, mut sim_enabled: ResMut<SimEnabled>,
mut physics_time: ResMut<Time<Physics>>,
mut editor_cameras: Query<&mut Camera, With<EditorCamera>>, mut editor_cameras: Query<&mut Camera, With<EditorCamera>>,
mut player_cameras: Query<&mut Camera, (With<PlayerCamera>, Without<EditorCamera>)>, mut player_cameras: Query<&mut Camera, (With<PlayerCamera>, Without<EditorCamera>)>,
mut egui_cameras: Query< mut egui_cameras: Query<
@@ -213,9 +216,11 @@ pub(crate) fn sync_mode_resources_and_cameras(
let ejected = playing && *possession == PlayPossession::Ejected; let ejected = playing && *possession == PlayPossession::Ejected;
let possessed = playing && *possession == PlayPossession::Possessed; let possessed = playing && *possession == PlayPossession::Possessed;
sim_enabled.0 = playing && (!paused.0 || step.0); let stepping = step.0;
sim_enabled.0 = playing && (!paused.0 || stepping);
input_enabled.0 = possessed && !paused.0; input_enabled.0 = possessed && !paused.0;
if step.0 { sync_editor_physics_clock(&mut physics_time, playing, paused.0, stepping);
if stepping {
step.0 = false; step.0 = false;
} }
@@ -241,6 +246,22 @@ pub(crate) fn sync_mode_resources_and_cameras(
} }
} }
fn sync_editor_physics_clock(
physics_time: &mut Time<Physics>,
playing: bool,
paused: bool,
stepping: bool,
) {
if playing && !paused {
physics_time.unpause();
return;
}
physics_time.pause();
if playing && stepping {
physics_time.advance_by(Duration::from_secs_f64(1.0 / SIM_TICK_RATE_HZ as f64));
}
}
fn sync_play_input_focus( fn sync_play_input_focus(
mode: Res<State<EditorMode>>, mode: Res<State<EditorMode>>,
possession: Res<PlayPossession>, possession: Res<PlayPossession>,
@@ -252,6 +273,8 @@ fn sync_play_input_focus(
} }
fn enter_play_mode(world: &mut World) { fn enter_play_mode(world: &mut World) {
// Edit-mode scrubbing must not override authored controller playback in PIE.
game::animation::stop_animation_preview(world);
let snapshot = snapshot_player_sim(world); let snapshot = snapshot_player_sim(world);
world.resource_mut::<PlayModeSnapshot>().player = Some(snapshot); world.resource_mut::<PlayModeSnapshot>().player = Some(snapshot);
} }
@@ -260,9 +283,9 @@ fn exit_play_mode(world: &mut World) {
if let Some(snapshot) = world.resource_mut::<PlayModeSnapshot>().player.take() { if let Some(snapshot) = world.resource_mut::<PlayModeSnapshot>().player.take() {
restore_player_sim(world, &snapshot); restore_player_sim(world, &snapshot);
} }
if let Some(mut scene_io) = world.get_resource_mut::<SceneIo>() { world.resource_mut::<SimEnabled>().0 = false;
scene_io.dirty = true; game::animation::reset_authored_animation_runtime(world);
} game::audio::reset_authored_audio_runtime(world);
} }
fn snapshot_player_sim(world: &mut World) -> PlayerSimSnapshot { fn snapshot_player_sim(world: &mut World) -> PlayerSimSnapshot {
@@ -413,3 +436,29 @@ pub fn toggle_play_possession_world(world: &mut World) {
} }
} }
} }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn editor_physics_clock_tracks_edit_play_pause_and_single_step() {
let mut time = Time::<Physics>::default();
sync_editor_physics_clock(&mut time, false, false, false);
assert!(time.is_paused());
sync_editor_physics_clock(&mut time, true, false, false);
assert!(!time.is_paused());
sync_editor_physics_clock(&mut time, true, true, false);
assert!(time.is_paused());
sync_editor_physics_clock(&mut time, true, true, true);
assert!(time.is_paused());
assert_eq!(
time.delta(),
Duration::from_secs_f64(1.0 / SIM_TICK_RATE_HZ as f64)
);
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,278 @@
//! Privacy-bounded support bundle export for editor troubleshooting.
use std::path::PathBuf;
use std::time::{SystemTime, UNIX_EPOCH};
use bevy::prelude::*;
use bevy::render::renderer::RenderAdapterInfo;
use serde::{Deserialize, Serialize};
use shared::{brush_math::validate_brush, BrushDesc, LevelObject};
use crate::project_io::ProjectWorkspace;
use crate::scene::recovery::{atomic_write, default_state_root};
use crate::scene_io::{SceneIo, SceneIoEventSeverity};
use crate::session::EditorSessionRuntime;
const DIAGNOSTICS_SCHEMA_VERSION: u32 = 1;
const DIAGNOSTICS_DIR: &str = "diagnostics";
const MAX_EVENT_MESSAGE_CHARS: usize = 512;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct DiagnosticBuildInfo {
pub editor_version: String,
pub bevy_version: String,
pub target_os: String,
pub target_arch: String,
pub build_profile: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct DiagnosticRendererInfo {
pub adapter_name: String,
pub device_type: String,
pub backend: String,
pub driver: String,
pub driver_info: String,
pub vendor_id: u32,
pub device_id: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct DiagnosticProjectInfo {
pub project_root: String,
pub settings_path: String,
pub active_scene: Option<String>,
pub scene_dirty: bool,
pub project_settings_dirty: bool,
pub layout_dirty: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct DiagnosticValidationSummary {
pub level_object_count: usize,
pub brush_actor_count: usize,
pub invalid_brush_count: usize,
pub brush_error_count: usize,
pub brush_warning_count: usize,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct DiagnosticSceneIoEvent {
pub id: u64,
pub severity: String,
pub message: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct DiagnosticBundleDocument {
pub schema_version: u32,
pub created_unix_seconds: u64,
pub build: DiagnosticBuildInfo,
pub renderer: Option<DiagnosticRendererInfo>,
pub project: DiagnosticProjectInfo,
pub validation: DiagnosticValidationSummary,
pub prior_abnormal_shutdown: bool,
pub scene_io_events: Vec<DiagnosticSceneIoEvent>,
}
/// Writes an allowlisted support report without scene data, environment values, or credentials.
pub fn export_diagnostic_bundle(world: &mut World) -> Result<PathBuf, String> {
let document = capture_diagnostic_bundle(world);
let directory = default_state_root()
.ok_or_else(|| "XDG_STATE_HOME and HOME are both unavailable".to_string())?
.join(DIAGNOSTICS_DIR);
let timestamp = document.created_unix_seconds;
let path = directory.join(format!(
"blacksite-diagnostics-{timestamp:020}-{}.ron",
std::process::id()
));
let text = serialize_diagnostic_bundle(&document)?;
atomic_write(&path, text.as_bytes())?;
Ok(path)
}
fn capture_diagnostic_bundle(world: &mut World) -> DiagnosticBundleDocument {
let validation = validation_summary(world);
let renderer =
world
.get_resource::<RenderAdapterInfo>()
.map(|adapter| DiagnosticRendererInfo {
adapter_name: adapter.name.clone(),
device_type: format!("{:?}", adapter.device_type),
backend: format!("{:?}", adapter.backend),
driver: adapter.driver.clone(),
driver_info: adapter.driver_info.clone(),
vendor_id: adapter.vendor,
device_id: adapter.device,
});
let scene_io = world.resource::<SceneIo>();
let workspace = world.resource::<ProjectWorkspace>();
let project = DiagnosticProjectInfo {
project_root: workspace.root.clone(),
settings_path: workspace.settings_path.clone(),
active_scene: scene_io
.active_path
.as_ref()
.map(|path| path.display().to_string()),
scene_dirty: scene_io.has_unsaved_tabs(),
project_settings_dirty: workspace.settings_dirty,
layout_dirty: workspace.layout_dirty,
};
let scene_io_events = scene_io
.events
.iter()
.map(|event| DiagnosticSceneIoEvent {
id: event.id,
severity: match event.severity {
SceneIoEventSeverity::Info => "info",
SceneIoEventSeverity::Error => "error",
}
.to_string(),
message: bounded_message(&event.message),
})
.collect();
DiagnosticBundleDocument {
schema_version: DIAGNOSTICS_SCHEMA_VERSION,
created_unix_seconds: SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_secs(),
build: build_info(),
renderer,
project,
validation,
prior_abnormal_shutdown: world
.get_resource::<EditorSessionRuntime>()
.is_some_and(|runtime| runtime.prior_abnormal_shutdown),
scene_io_events,
}
}
fn validation_summary(world: &mut World) -> DiagnosticValidationSummary {
let mut level_query = world.query_filtered::<Entity, With<LevelObject>>();
let level_object_count = level_query.iter(world).count();
let mut brush_query = world.query_filtered::<&BrushDesc, With<LevelObject>>();
let mut summary = DiagnosticValidationSummary {
level_object_count,
brush_actor_count: 0,
invalid_brush_count: 0,
brush_error_count: 0,
brush_warning_count: 0,
};
for brush in brush_query.iter(world) {
summary.brush_actor_count += 1;
let report = validate_brush(brush);
let errors = report
.diagnostics
.iter()
.filter(|diagnostic| {
diagnostic.severity == shared::brush_math::BrushDiagnosticSeverity::Error
})
.count();
let warnings = report.diagnostics.len().saturating_sub(errors);
summary.brush_error_count += errors;
summary.brush_warning_count += warnings;
summary.invalid_brush_count += usize::from(errors > 0);
}
summary
}
fn build_info() -> DiagnosticBuildInfo {
DiagnosticBuildInfo {
editor_version: env!("CARGO_PKG_VERSION").to_string(),
bevy_version: "0.19".to_string(),
target_os: std::env::consts::OS.to_string(),
target_arch: std::env::consts::ARCH.to_string(),
build_profile: if cfg!(debug_assertions) {
"debug"
} else {
"release"
}
.to_string(),
}
}
fn bounded_message(message: &str) -> String {
message
.chars()
.filter(|character| !character.is_control() || *character == ' ')
.take(MAX_EVENT_MESSAGE_CHARS)
.collect()
}
fn serialize_diagnostic_bundle(document: &DiagnosticBundleDocument) -> Result<String, String> {
ron::ser::to_string_pretty(document, ron::ser::PrettyConfig::default())
.map_err(|error| format!("could not serialize diagnostics: {error}"))
}
#[cfg(test)]
mod tests {
use super::*;
fn fixture() -> DiagnosticBundleDocument {
DiagnosticBundleDocument {
schema_version: DIAGNOSTICS_SCHEMA_VERSION,
created_unix_seconds: 42,
build: build_info(),
renderer: None,
project: DiagnosticProjectInfo {
project_root: "/project".to_string(),
settings_path: "assets/project.ron".to_string(),
active_scene: Some("assets/levels/test.scn.ron".to_string()),
scene_dirty: true,
project_settings_dirty: false,
layout_dirty: false,
},
validation: DiagnosticValidationSummary {
level_object_count: 12,
brush_actor_count: 2,
invalid_brush_count: 1,
brush_error_count: 1,
brush_warning_count: 0,
},
prior_abnormal_shutdown: true,
scene_io_events: vec![DiagnosticSceneIoEvent {
id: 1,
severity: "error".to_string(),
message: "Save failed: disk full".to_string(),
}],
}
}
#[test]
fn serialized_bundle_contains_only_allowlisted_sections() {
let text = serialize_diagnostic_bundle(&fixture()).unwrap();
for allowed in [
"build",
"renderer",
"project",
"validation",
"scene_io_events",
] {
assert!(text.contains(allowed));
}
for forbidden in [
"scene_contents",
"asset_contents",
"environment",
"credential",
"access_token",
"hostname",
"username",
"modal_operator",
] {
assert!(!text.to_ascii_lowercase().contains(forbidden));
}
}
#[test]
fn event_messages_are_control_free_and_bounded() {
let message = format!("failure\n{}", "x".repeat(MAX_EVENT_MESSAGE_CHARS + 20));
let bounded = bounded_message(&message);
assert!(bounded.chars().count() <= MAX_EVENT_MESSAGE_CHARS);
assert!(!bounded.contains('\n'));
}
}
+879
View File
@@ -0,0 +1,879 @@
//! Pre-engine project validation, recent-project discovery, and sandbox scaffolding.
use std::collections::HashSet;
use std::path::{Component, Path, PathBuf};
use std::process::Command;
use bevy::app::AppExit;
use bevy::prelude::*;
use bevy::window::{CompositeAlphaMode, PresentMode, WindowPlugin};
use bevy_egui::{egui, EguiContext, EguiPlugin, EguiPrimaryContextPass, PrimaryEguiContext};
use settings::{
save_project_settings_to_string, ProjectKind, ProjectSettings, DEFAULT_PROJECT_PATH,
PROJECT_TEMPLATE_VERSION,
};
use crate::native_dialog::{NativeDialogBroker, NativeDialogPlugin};
use crate::project_io::UserPreferences;
use crate::scene::recovery::atomic_write;
use crate::ui::theme::{
apply_editor_theme, ACCENT, BORDER, CANVAS_BG, PANEL_BG, PANEL_BG_DARK, SELECTION, TEXT,
TEXT_DIM, TEXT_MUTED,
};
const SANDBOX_DIRECTORIES: &[&str] = &[
"assets/.index",
"assets/.trash",
"assets/audio",
"assets/build_profiles",
"assets/levels",
"assets/materials",
"assets/meshes/generated",
"assets/models",
"assets/post_fx",
"assets/rendering_profiles",
"assets/shaders",
"assets/textures",
];
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ProjectSummary {
pub root: PathBuf,
pub project_id: String,
pub name: String,
pub project_kind: ProjectKind,
pub template_version: u32,
pub capabilities: Vec<String>,
pub default_level: PathBuf,
pub last_scene: Option<PathBuf>,
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct StartupArguments {
pub project: Option<PathBuf>,
pub help: bool,
}
#[derive(Resource)]
struct ProjectLauncherUi {
recents: Vec<ProjectSummary>,
sandbox_name: String,
sandbox_destination: Option<PathBuf>,
status: Option<String>,
}
impl Default for ProjectLauncherUi {
fn default() -> Self {
let mut preferences = crate::project_io::read_user_preferences();
if let Ok(root) = std::env::current_dir().and_then(|root| root.canonicalize()) {
crate::project_io::remember_project_root(&mut preferences, &root);
}
Self {
recents: recent_project_summaries(&preferences),
sandbox_name: "New Sandbox".to_string(),
sandbox_destination: None,
status: None,
}
}
}
pub fn run_project_launcher() {
let mut app = App::new();
app.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
title: "Blacksite Project Browser".to_string(),
name: Some("blacksite-project-launcher".to_string()),
resolution: (960, 620).into(),
present_mode: PresentMode::AutoVsync,
transparent: false,
composite_alpha_mode: CompositeAlphaMode::Opaque,
..default()
}),
..default()
}))
.add_plugins(EguiPlugin::default())
.add_plugins(NativeDialogPlugin)
.init_resource::<ProjectLauncherUi>()
.add_systems(Startup, spawn_project_launcher_camera)
.add_systems(EguiPrimaryContextPass, project_launcher_ui_system);
app.run();
}
fn spawn_project_launcher_camera(mut commands: Commands) {
commands.spawn((Camera2d, PrimaryEguiContext));
}
pub fn spawn_project_launcher_process() -> Result<(), String> {
let executable = sibling_executable("project_launcher")?;
let root = std::env::current_dir()
.map_err(|error| format!("could not resolve active project root: {error}"))?;
spawn_detached(&executable, &[], &root)
}
pub fn reveal_project_root(root: &Path) -> Result<(), String> {
Command::new("xdg-open")
.arg(root)
.spawn()
.map_err(|error| format!("could not reveal {}: {error}", root.display()))?;
Ok(())
}
fn project_launcher_ui_system(world: &mut World) {
let Ok(context) = world
.query_filtered::<&mut EguiContext, With<PrimaryEguiContext>>()
.single(world)
else {
return;
};
let mut context = context.clone();
world.resource_scope(|world, mut state: Mut<ProjectLauncherUi>| {
project_launcher_ui(world, context.get_mut(), &mut state);
});
}
#[expect(
deprecated,
reason = "bevy_egui exposes a Context during EguiPrimaryContextPass, requiring one top-level context-based panel"
)]
fn project_launcher_ui(world: &mut World, context: &egui::Context, state: &mut ProjectLauncherUi) {
apply_editor_theme(context);
egui::CentralPanel::default()
.frame(
egui::Frame::new()
.fill(CANVAS_BG)
.inner_margin(egui::Margin::same(24)),
)
.show(context, |ui| {
let content_width = ui.available_width().min(1240.0);
let side_space = ((ui.available_width() - content_width) * 0.5).max(0.0);
ui.horizontal(|ui| {
ui.add_space(side_space);
ui.vertical(|ui| {
ui.set_width(content_width);
ui.horizontal(|ui| {
ui.vertical(|ui| {
ui.label(
egui::RichText::new("BLACKSITE")
.size(22.0)
.strong()
.color(ACCENT),
);
ui.label(
egui::RichText::new("PROJECT BROWSER")
.size(11.0)
.color(TEXT_DIM),
);
});
ui.add_space(18.0);
ui.separator();
ui.add_space(10.0);
ui.label(
egui::RichText::new(
"Choose a validated workspace before the engine starts",
)
.color(TEXT_DIM),
);
});
ui.add_space(22.0);
ui.horizontal(|ui| {
ui.vertical(|ui| {
ui.set_width(340.0);
launcher_actions(world, ui, state);
});
ui.add_space(18.0);
ui.vertical(|ui| {
ui.set_width((content_width - 358.0).max(360.0));
recent_projects(world, ui, state);
});
});
if let Some(status) = state.status.as_deref() {
ui.add_space(12.0);
ui.separator();
ui.label(egui::RichText::new(status).color(TEXT_DIM));
}
});
});
});
}
fn launcher_actions(world: &mut World, ui: &mut egui::Ui, state: &mut ProjectLauncherUi) {
egui::Frame::new()
.fill(PANEL_BG_DARK)
.stroke(egui::Stroke::new(1.0, BORDER))
.inner_margin(egui::Margin::same(16))
.show(ui, |ui| {
ui.set_min_height(455.0);
ui.heading("Open Project");
ui.label(
egui::RichText::new("Select a root containing assets/project.ron").color(TEXT_DIM),
);
ui.add_space(8.0);
let dialog_pending = world.resource::<NativeDialogBroker>().is_pending();
if ui
.add_enabled(!dialog_pending, egui::Button::new("Browse Existing..."))
.clicked()
{
let result = world.resource::<NativeDialogBroker>().request(
|| rfd::FileDialog::new().pick_folder(),
|world, root| {
let Some(root) = root else {
return;
};
world.resource_scope(|world, mut state: Mut<ProjectLauncherUi>| {
open_project_from_launcher(world, &mut state, root);
});
},
);
if let Err(error) = result {
state.status = Some(format!("Project browser unavailable: {error}"));
}
}
ui.add_space(24.0);
ui.separator();
ui.add_space(14.0);
ui.heading("New Sandbox");
ui.label(
egui::RichText::new("Creates a clean content workspace with a valid empty level")
.color(TEXT_DIM),
);
ui.add_space(8.0);
ui.label(egui::RichText::new("Project name").color(TEXT_DIM));
ui.text_edit_singleline(&mut state.sandbox_name);
ui.add_space(6.0);
let destination = state
.sandbox_destination
.as_ref()
.map(|path| path.display().to_string())
.unwrap_or_else(|| "No destination selected".to_string());
ui.add(
egui::Label::new(
egui::RichText::new(destination)
.monospace()
.color(TEXT_MUTED),
)
.truncate(),
);
if ui
.add_enabled(!dialog_pending, egui::Button::new("Choose Empty Folder..."))
.clicked()
{
let result = world.resource::<NativeDialogBroker>().request(
|| rfd::FileDialog::new().pick_folder(),
|world, destination| {
if let Some(destination) = destination {
world
.resource_mut::<ProjectLauncherUi>()
.sandbox_destination = Some(destination);
}
},
);
if let Err(error) = result {
state.status = Some(format!("Folder browser unavailable: {error}"));
}
}
let can_create =
state.sandbox_destination.is_some() && !state.sandbox_name.trim().is_empty();
if ui
.add_enabled(can_create, egui::Button::new("Create And Open Sandbox"))
.clicked()
{
let destination = state.sandbox_destination.clone().unwrap();
match scaffold_sandbox_project(&destination, &state.sandbox_name) {
Ok(summary) => launch_editor_and_close(world, state, &summary),
Err(error) => state.status = Some(error),
}
}
});
}
fn recent_projects(world: &mut World, ui: &mut egui::Ui, state: &mut ProjectLauncherUi) {
ui.horizontal(|ui| {
ui.heading("Recent Projects");
ui.add_space(8.0);
ui.label(egui::RichText::new(state.recents.len().to_string()).color(TEXT_MUTED));
});
ui.label(
egui::RichText::new("Missing and invalid projects are filtered automatically")
.color(TEXT_DIM),
);
ui.add_space(10.0);
if state.recents.is_empty() {
egui::Frame::new()
.fill(PANEL_BG)
.stroke(egui::Stroke::new(1.0, BORDER))
.inner_margin(egui::Margin::same(16))
.show(ui, |ui| {
ui.label(egui::RichText::new("No valid recent projects").color(TEXT));
ui.label(
egui::RichText::new("Browse an existing project or create a sandbox.")
.color(TEXT_DIM),
);
});
return;
}
let recents = state.recents.clone();
egui::ScrollArea::vertical()
.id_salt("project_launcher_recents")
.show(ui, |ui| {
for summary in recents {
let response = egui::Frame::new()
.fill(PANEL_BG)
.stroke(egui::Stroke::new(1.0, BORDER))
.inner_margin(egui::Margin::same(14))
.show(ui, |ui| {
ui.horizontal(|ui| {
ui.vertical(|ui| {
ui.label(egui::RichText::new(&summary.name).strong().color(TEXT));
ui.label(
egui::RichText::new(summary.root.display().to_string())
.monospace()
.size(11.0)
.color(TEXT_MUTED),
);
let detail = summary.last_scene.as_ref().map_or_else(
|| format!("{:?} | default scene", summary.project_kind),
|scene| {
format!(
"{:?} | {}",
summary.project_kind,
scene
.strip_prefix(&summary.root)
.unwrap_or(scene)
.display()
)
},
);
ui.label(egui::RichText::new(detail).size(11.0).color(TEXT_DIM));
});
ui.with_layout(
egui::Layout::right_to_left(egui::Align::Center),
|ui| {
if ui.button("Open").clicked() {
launch_editor_and_close(world, state, &summary);
}
},
);
});
});
if response.response.hovered() {
ui.painter().rect_stroke(
response.response.rect,
0.0,
egui::Stroke::new(1.0, SELECTION),
egui::StrokeKind::Inside,
);
}
ui.add_space(8.0);
}
});
}
fn open_project_from_launcher(world: &mut World, state: &mut ProjectLauncherUi, root: PathBuf) {
match inspect_project(&root, None) {
Ok(summary) => launch_editor_and_close(world, state, &summary),
Err(error) => state.status = Some(error),
}
}
fn launch_editor_and_close(
world: &mut World,
state: &mut ProjectLauncherUi,
summary: &ProjectSummary,
) {
match spawn_editor_process(&summary.root) {
Ok(()) => {
state.status = Some(format!("Opening {}", summary.name));
world.write_message(AppExit::Success);
}
Err(error) => state.status = Some(error),
}
}
fn spawn_editor_process(root: &Path) -> Result<(), String> {
let executable = sibling_executable("editor")?;
spawn_detached(
&executable,
&[std::ffi::OsStr::new("--project"), root.as_os_str()],
root,
)
}
#[cfg(target_os = "linux")]
fn spawn_detached(
executable: &Path,
arguments: &[&std::ffi::OsStr],
cwd: &Path,
) -> Result<(), String> {
let mut command = Command::new("systemd-run");
command
.args(["--user", "--collect", "--quiet", "--service-type=exec"])
.arg(format!("--working-directory={}", cwd.display()));
for variable in [
"PATH",
"WAYLAND_DISPLAY",
"DISPLAY",
"XAUTHORITY",
"XDG_RUNTIME_DIR",
"HYPRLAND_INSTANCE_SIGNATURE",
"DBUS_SESSION_BUS_ADDRESS",
"XDG_CURRENT_DESKTOP",
"XDG_SESSION_DESKTOP",
"XDG_SESSION_TYPE",
"XDG_DATA_HOME",
"XDG_CONFIG_HOME",
"XDG_STATE_HOME",
"GDK_BACKEND",
"LD_LIBRARY_PATH",
"WGPU_VALIDATION",
"BEVY_FPS_HDR",
] {
if let Some(value) = std::env::var_os(variable) {
command.arg(format!("--setenv={variable}={}", value.to_string_lossy()));
}
}
let status = command
.arg(executable)
.args(arguments)
.status()
.map_err(|error| format!("could not invoke systemd-run: {error}"))?;
status.success().then_some(()).ok_or_else(|| {
format!(
"systemd-run could not start {} (status {status})",
executable.display()
)
})
}
#[cfg(not(target_os = "linux"))]
fn spawn_detached(
executable: &Path,
arguments: &[&std::ffi::OsStr],
cwd: &Path,
) -> Result<(), String> {
Command::new(executable)
.args(arguments)
.current_dir(cwd)
.spawn()
.map_err(|error| format!("could not start {}: {error}", executable.display()))?;
Ok(())
}
fn sibling_executable(name: &str) -> Result<PathBuf, String> {
let current = std::env::current_exe()
.map_err(|error| format!("could not locate current executable: {error}"))?;
let extension = current
.extension()
.map(|extension| extension.to_os_string());
let mut executable = current.with_file_name(name);
if let Some(extension) = extension {
executable.set_extension(extension);
}
executable
.is_file()
.then_some(executable.clone())
.ok_or_else(|| format!("required executable is not built: {}", executable.display()))
}
pub fn parse_startup_arguments(
arguments: impl IntoIterator<Item = String>,
) -> Result<StartupArguments, String> {
let mut parsed = StartupArguments::default();
let mut arguments = arguments.into_iter();
while let Some(argument) = arguments.next() {
match argument.as_str() {
"--project" => {
if parsed.project.is_some() {
return Err("--project may only be provided once".to_string());
}
let path = arguments
.next()
.ok_or_else(|| "--project requires a project root path".to_string())?;
parsed.project = Some(PathBuf::from(path));
}
"--help" | "-h" => parsed.help = true,
unknown => return Err(format!("unknown editor argument `{unknown}`")),
}
}
Ok(parsed)
}
pub fn command_line_help() -> &'static str {
"Blacksite Editor\n\nUSAGE:\n editor [--project <root>]\n\nOPTIONS:\n --project <root> Open a validated Blacksite project before engine startup\n -h, --help Print this help"
}
pub fn activate_project_root(root: &Path) -> Result<ProjectSummary, String> {
let summary = inspect_project(root, None)?;
std::env::set_current_dir(&summary.root).map_err(|error| {
format!(
"could not activate project root {}: {error}",
summary.root.display()
)
})?;
Ok(summary)
}
pub fn inspect_project(root: &Path, last_scene: Option<&Path>) -> Result<ProjectSummary, String> {
let root = root
.canonicalize()
.map_err(|error| format!("could not open project root {}: {error}", root.display()))?;
if !root.is_dir() {
return Err(format!(
"project root is not a directory: {}",
root.display()
));
}
let manifest_path = root.join(DEFAULT_PROJECT_PATH);
let text = std::fs::read_to_string(&manifest_path)
.map_err(|error| format!("could not read {}: {error}", manifest_path.display()))?;
let manifest: ProjectSettings = ron::from_str(&text).map_err(|error| {
format!(
"invalid project manifest {}: {error}",
manifest_path.display()
)
})?;
if manifest.name.trim().is_empty() {
return Err(format!(
"project name is empty in {}",
manifest_path.display()
));
}
manifest.audio.validate().map_err(|error| {
format!(
"invalid audio settings in {}: {error}",
manifest_path.display()
)
})?;
let default_reference = Path::new(&manifest.default_level);
if !default_reference.starts_with("assets/levels")
|| !manifest.default_level.ends_with(".scn.ron")
{
return Err("default_level must be a .scn.ron scene under assets/levels/".into());
}
let default_level = safe_project_path(&root, default_reference, "default_level")?;
let default_metadata = std::fs::symlink_metadata(&default_level).ok();
if !default_metadata
.as_ref()
.is_some_and(std::fs::Metadata::is_file)
|| default_metadata.is_some_and(|metadata| metadata.file_type().is_symlink())
{
return Err(format!(
"default level is missing or is not a regular file: {}",
default_level.display()
));
}
let default_level_text = std::fs::read_to_string(&default_level).map_err(|error| {
format!(
"could not read default level {}: {error}",
default_level.display()
)
})?;
scene::validate_level_text(&default_level_text).map_err(|error| {
format!(
"default level failed validation {}: {error}",
default_level.display()
)
})?;
scene::validate_composition_graph(&default_level, &root).map_err(|error| {
format!(
"default level composition failed validation {}: {error}",
default_level.display()
)
})?;
let last_scene = last_scene
.and_then(|path| safe_project_path(&root, path, "last_scene").ok())
.filter(|path| path.is_file());
let project_id = if manifest.project_id.trim().is_empty() {
format!("legacy:{}", root.display())
} else {
manifest.project_id
};
Ok(ProjectSummary {
root,
project_id,
name: manifest.name,
project_kind: manifest.project_kind,
template_version: manifest.template_version,
capabilities: manifest.capabilities,
default_level,
last_scene,
})
}
pub fn recent_project_summaries(preferences: &UserPreferences) -> Vec<ProjectSummary> {
let mut seen = HashSet::new();
preferences
.recent_projects
.iter()
.filter_map(|root| {
let root = PathBuf::from(root);
let last_scene = preferences
.recent_levels
.iter()
.map(PathBuf::from)
.find(|scene| root.join(scene).is_file());
inspect_project(&root, last_scene.as_deref()).ok()
})
.filter(|summary| seen.insert(summary.root.clone()))
.collect()
}
pub fn scaffold_sandbox_project(destination: &Path, name: &str) -> Result<ProjectSummary, String> {
let name = name.trim();
if name.is_empty() {
return Err("sandbox project name cannot be empty".to_string());
}
if destination.exists() {
let mut entries = std::fs::read_dir(destination)
.map_err(|error| format!("could not inspect {}: {error}", destination.display()))?;
if entries.next().is_some() {
return Err(format!(
"sandbox destination must be empty: {}",
destination.display()
));
}
}
for directory in SANDBOX_DIRECTORIES {
std::fs::create_dir_all(destination.join(directory)).map_err(|error| {
format!(
"could not create sandbox directory {}: {error}",
destination.join(directory).display()
)
})?;
}
let default_level = "assets/levels/main.scn.ron";
let empty_scene = format!(
"(schema_version: {},\n resources: {{}},\n entities: {{}},\n)\n",
scene::CURRENT_SCENE_SCHEMA_VERSION
);
scene::validate_level_text(&empty_scene)?;
atomic_write(&destination.join(default_level), empty_scene.as_bytes())?;
let manifest = ProjectSettings {
project_id: uuid::Uuid::new_v4().to_string(),
name: name.to_string(),
project_kind: ProjectKind::Sandbox,
template_version: PROJECT_TEMPLATE_VERSION,
capabilities: vec![
"editor".into(),
"gameplay".into(),
"rendering".into(),
"audio".into(),
],
default_level: default_level.to_string(),
asset_roots: vec![
"assets/audio".into(),
"assets/levels".into(),
"assets/materials".into(),
"assets/meshes".into(),
"assets/models".into(),
"assets/textures".into(),
],
..ProjectSettings::default()
};
let manifest_text = save_project_settings_to_string(&manifest)
.map_err(|error| format!("could not serialize sandbox manifest: {error}"))?;
atomic_write(
&destination.join(DEFAULT_PROJECT_PATH),
manifest_text.as_bytes(),
)?;
for (name, profile) in sandbox_build_profiles(default_level) {
atomic_write(
&destination.join("assets/build_profiles").join(name),
profile.as_bytes(),
)?;
}
inspect_project(destination, None)
}
fn sandbox_build_profiles(default_level: &str) -> [(&'static str, String); 3] {
[
(
"development.ron",
format!(
"(version:1,name:\"Development\",cargo_profile:Development,target:None,features:[],rendering_tier:\"development\",default_scene:Some(\"{default_level}\"),output_dir:\"dist/development\")\n"
),
),
(
"qa.ron",
format!(
"(version:1,name:\"QA\",cargo_profile:Qa,target:None,features:[],rendering_tier:\"representative\",default_scene:Some(\"{default_level}\"),output_dir:\"dist/qa\")\n"
),
),
(
"release.ron",
format!(
"(version:1,name:\"Release\",cargo_profile:Release,target:None,features:[],rendering_tier:\"shipping\",default_scene:Some(\"{default_level}\"),output_dir:\"dist/release\")\n"
),
),
]
}
fn safe_project_path(root: &Path, path: impl AsRef<Path>, field: &str) -> Result<PathBuf, String> {
let path = path.as_ref();
if path.as_os_str().is_empty() || path.is_absolute() {
return Err(format!("{field} must be a non-empty project-relative path"));
}
if path.components().any(|component| {
matches!(
component,
Component::ParentDir | Component::RootDir | Component::Prefix(_)
)
}) {
return Err(format!("{field} cannot escape the project root"));
}
Ok(root.join(path))
}
#[cfg(test)]
mod tests {
use super::*;
fn temp_root(label: &str) -> PathBuf {
std::env::temp_dir().join(format!("blacksite-{label}-{}", uuid::Uuid::new_v4()))
}
#[test]
fn startup_arguments_parse_project_and_reject_unknown_flags() {
let parsed =
parse_startup_arguments(["--project".to_string(), "/tmp/project".to_string()]).unwrap();
assert_eq!(parsed.project, Some(PathBuf::from("/tmp/project")));
assert!(parse_startup_arguments(["--mystery".to_string()]).is_err());
assert!(parse_startup_arguments(["--project".to_string()]).is_err());
}
#[test]
fn sandbox_scaffold_can_be_inspected_and_reloaded() {
let root = temp_root("sandbox");
let created = scaffold_sandbox_project(&root, "Prototype").unwrap();
let reopened =
inspect_project(&root, Some(Path::new("assets/levels/main.scn.ron"))).unwrap();
assert_eq!(created.project_id, reopened.project_id);
assert_eq!(reopened.name, "Prototype");
assert_eq!(reopened.project_kind, ProjectKind::Sandbox);
assert_eq!(reopened.template_version, PROJECT_TEMPLATE_VERSION);
assert!(reopened.capabilities.iter().any(|item| item == "audio"));
let manifest = settings::load_project_settings_from_path(
root.join(DEFAULT_PROJECT_PATH).to_string_lossy().as_ref(),
);
assert!(manifest.audio.validate().is_ok());
assert!(manifest.audio.bus(settings::AUDIO_BUS_SFX_ID).is_some());
assert_eq!(
reopened.last_scene,
Some(root.join("assets/levels/main.scn.ron"))
);
for directory in SANDBOX_DIRECTORIES {
assert!(root.join(directory).is_dir(), "missing {directory}");
}
for profile in ["development.ron", "qa.ron", "release.ron"] {
let text =
std::fs::read_to_string(root.join("assets/build_profiles").join(profile)).unwrap();
assert!(text.contains("assets/levels/main.scn.ron"), "{profile}");
assert!(text.contains("output_dir"), "{profile}");
}
std::fs::remove_dir_all(root).unwrap();
}
#[test]
fn recent_projects_filter_missing_invalid_and_duplicate_roots() {
let valid = temp_root("recent-valid");
let invalid = temp_root("recent-invalid");
scaffold_sandbox_project(&valid, "Valid").unwrap();
std::fs::create_dir_all(&invalid).unwrap();
let preferences = UserPreferences {
recent_projects: vec![
valid.display().to_string(),
"/definitely/missing/blacksite-project".to_string(),
invalid.display().to_string(),
valid.display().to_string(),
],
recent_levels: vec!["assets/levels/main.scn.ron".to_string()],
..Default::default()
};
let summaries = recent_project_summaries(&preferences);
assert_eq!(summaries.len(), 1);
assert_eq!(summaries[0].name, "Valid");
assert!(summaries[0].last_scene.is_some());
std::fs::remove_dir_all(valid).unwrap();
std::fs::remove_dir_all(invalid).unwrap();
}
#[test]
fn project_inspection_rejects_invalid_audio_bus_graphs() {
let root = temp_root("invalid-audio-buses");
scaffold_sandbox_project(&root, "Invalid Audio").unwrap();
let manifest_path = root.join(DEFAULT_PROJECT_PATH);
let mut manifest =
settings::load_project_settings_from_path(manifest_path.to_string_lossy().as_ref());
manifest
.audio
.bus_mut(settings::AUDIO_BUS_SFX_ID)
.unwrap()
.parent = Some("missing".into());
std::fs::write(
&manifest_path,
save_project_settings_to_string(&manifest).unwrap(),
)
.unwrap();
let error = inspect_project(&root, None).unwrap_err();
assert!(error.contains("invalid audio settings"), "{error}");
std::fs::remove_dir_all(root).unwrap();
}
#[test]
fn sandbox_scaffold_refuses_nonempty_destination_and_path_escape() {
let root = temp_root("sandbox-nonempty");
std::fs::create_dir_all(&root).unwrap();
std::fs::write(root.join("keep.txt"), "user data").unwrap();
assert!(scaffold_sandbox_project(&root, "Unsafe").is_err());
assert!(safe_project_path(&root, "../outside", "test").is_err());
assert_eq!(
std::fs::read_to_string(root.join("keep.txt")).unwrap(),
"user data"
);
std::fs::remove_dir_all(root).unwrap();
}
#[test]
fn project_default_level_must_use_the_audited_levels_tree() {
let root = temp_root("default-level-contract");
scaffold_sandbox_project(&root, "Contract").unwrap();
std::fs::create_dir_all(root.join("assets/custom")).unwrap();
std::fs::write(
root.join("assets/custom/start.scn.ron"),
format!(
"(schema_version:{},resources:{{}},entities:{{}})",
scene::CURRENT_SCENE_SCHEMA_VERSION
),
)
.unwrap();
let mut manifest = settings::load_project_settings_from_path(
root.join(DEFAULT_PROJECT_PATH).to_string_lossy().as_ref(),
);
manifest.default_level = "assets/custom/start.scn.ron".into();
std::fs::write(
root.join(DEFAULT_PROJECT_PATH),
save_project_settings_to_string(&manifest).unwrap(),
)
.unwrap();
let error = inspect_project(&root, None).unwrap_err();
assert!(error.contains("assets/levels"), "{error}");
std::fs::remove_dir_all(root).unwrap();
}
}
Loaded 100 of 486 files, more files were not shown because too many files have changed in this diff. Show more