Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1a56f77cc | ||
|
|
293811aecd | ||
|
|
ed21bcc52d | ||
|
|
577d8dcb27 | ||
|
|
ba59f57a5a | ||
|
|
d038cf3670 | ||
|
|
61be2440bd | ||
|
|
3794faa4aa | ||
|
|
02247f029a | ||
|
|
3931de1f0a | ||
|
|
f2ad88fd03 | ||
|
|
5a82a9ee29 | ||
|
|
b4aa61e394 | ||
|
|
0798aa5d57 |
No files matched your search
@@ -7,4 +7,6 @@ rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
||||
[alias]
|
||||
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 --"
|
||||
@@ -21,9 +21,23 @@ performance, soak, regression, and first-hour workflows must pass against a repr
|
||||
`#43`; M6 implementation is complete.
|
||||
4. Completed: authoritative content validation `#45` and the validation-gated packaging/Build
|
||||
workflow `#44`.
|
||||
5. Completed: audio source/listener/bus authoring and spatial preview passed production acceptance
|
||||
in `#47`. Next: animation `#46`, navigation `#48`, source-control safety `#49`, then readiness
|
||||
gate `#50`.
|
||||
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
|
||||
|
||||
|
||||
@@ -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,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,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.
|
||||
@@ -14,6 +14,7 @@
|
||||
# Editor/runtime generated session state
|
||||
/assets/levels/.pie_session.scn.ron
|
||||
/assets/.trash/
|
||||
/.blacksite/backups/
|
||||
|
||||
# Backup, temporary, and log files
|
||||
**/*.rs.bk
|
||||
|
||||
Generated
+540
-169
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,6 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"crates/blacksite_surface",
|
||||
"crates/game",
|
||||
"crates/game_hot",
|
||||
"crates/shared",
|
||||
@@ -36,6 +37,7 @@ bevy = { version = "0.19", features = [
|
||||
] }
|
||||
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"
|
||||
@@ -43,6 +45,9 @@ egui_dock = { version = "0.19.1", features = ["serde"] }
|
||||
egui_phosphor_icons = { version = "0.3.1", default-features = false }
|
||||
transform-gizmo-bevy = "0.9"
|
||||
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" }
|
||||
game = { path = "crates/game" }
|
||||
game_hot = { path = "crates/game_hot" }
|
||||
@@ -52,6 +57,8 @@ settings = { path = "crates/settings" }
|
||||
scene = { path = "crates/scene" }
|
||||
|
||||
[patch.crates-io]
|
||||
# Blacksite Surface ABI and deformation-safety integration for Solari.
|
||||
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.
|
||||
|
||||
@@ -27,6 +27,9 @@ cargo clippy --workspace --all-targets -- -D warnings
|
||||
cargo clippy -p editor -p game --bins --features dev,hot-reload -- -D warnings
|
||||
cargo test --workspace
|
||||
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
|
||||
@@ -149,6 +152,10 @@ deep-stale variants.
|
||||
| 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/` |
|
||||
| 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 |
|
||||
| Shift/Ctrl + click (Hierarchy) | Additive selection |
|
||||
@@ -156,11 +163,16 @@ deep-stale variants.
|
||||
| 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, Open, transactional Save/Save As, recovery restore/keep-copy/discard when available, Import Assets, Export Selection, Save Selection As Prefab (including linked-root variants), Recent Scenes |
|
||||
| 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 footer → Add Component | Expands an inline search shelf for registered authoring, rendering, physics, gameplay, and volume components with descriptions, availability hints, and undo |
|
||||
| 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 |
|
||||
| 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 |
|
||||
|
||||
@@ -230,10 +242,22 @@ Viewport shortcut keys require the pointer to be in the viewport and are suspend
|
||||
details when you need full `WorldAssetRoot` scene data instead of normalized static slots.
|
||||
Expanding a model in the Asset Browser exposes normalized mesh/material/texture plus generated
|
||||
skeleton/animation-clip subassets. Dragging a mesh places that part through the static mesh path;
|
||||
dragging a clip creates an animated scene instance or assigns an exact-rig-compatible state to
|
||||
the selected imported model. The Animation Controller inspector edits state IDs, clips,
|
||||
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
|
||||
@@ -245,6 +269,13 @@ Viewport shortcut keys require the pointer to be in the viewport and are suspend
|
||||
without changing the scene.
|
||||
- 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.
|
||||
- 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
|
||||
`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
|
||||
@@ -307,6 +338,16 @@ identity, project and active-scene paths, dirty flags, aggregate validation coun
|
||||
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
|
||||
|
||||
The `.vscode/` folder is preconfigured:
|
||||
@@ -329,6 +370,8 @@ The `.vscode/` folder is preconfigured:
|
||||
- [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 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
|
||||
|
||||
@@ -358,6 +401,10 @@ crates/
|
||||
- [x] Filtered hierarchy, inspector, viewport, toolbar, asset browser, and status panels
|
||||
- [x] Delete, duplicate, rename, and structural/material undo-redo
|
||||
- [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] 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] PIE player-only snapshot/restore (authored `LevelObject` edits persist on stop)
|
||||
- [x] Unified viewport render-to-texture target + Play session bootstrap
|
||||
@@ -375,12 +422,14 @@ crates/
|
||||
- [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] 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] 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] 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)
|
||||
@@ -392,16 +441,20 @@ crates/
|
||||
- [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] 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] 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 runtime-only property blocks ([ADR 0035](docs/adr/0035-shared-material-assets-and-renderer-slots.md), [material-system guide](docs/editor/material-system.md))
|
||||
- [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] 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] 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
|
||||
@@ -414,10 +467,12 @@ crates/
|
||||
untextured models), material sphere thumbnails, search/filter/sort controls, expandable model
|
||||
subasset shelves, and a staged details pane. **File → Import Assets**
|
||||
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
|
||||
uses `StaticMeshRenderer` by default with imported asset refs and optional separate static mesh
|
||||
collider components. Expanded mesh subassets generate independent thumbnails and can be placed independently. Asset details can switch
|
||||
placement to **Scene Instance** for `ModelRef`/`WorldAssetRoot` playback, shared material assets can be
|
||||
Model assets generate normalized model manifests under `assets/meshes/generated/`; drag/drop uses
|
||||
**Renderable Asset (Auto)**. Unrigged sources use `StaticMeshRenderer` with imported asset refs
|
||||
and optional separate static mesh colliders. Skin-bound or animated sources and their subasset placement use
|
||||
`SkinnedMeshRenderer`, preserve the source joint hierarchy, and never create static slots or
|
||||
automatic triangle colliders. Expanded mesh subassets generate independent thumbnails. Asset details can switch
|
||||
placement to **Scene Instance** for generic `ModelRef`/`WorldAssetRoot` scenes, shared material assets can be
|
||||
edited from the browser, and delete actions move files to `assets/.trash/`. Animation authoring
|
||||
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
|
||||
@@ -432,7 +487,7 @@ crates/
|
||||
**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 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 material edits live on the actor `MaterialDesc`; static mesh source-material refs remain imported defaults and shared material assets are edited from the Asset Browser.
|
||||
- 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. Dynamic skinned/morph Solari geometry and a persisted property-block authoring workflow remain future work; 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.
|
||||
- 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.
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -28,6 +30,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -44,6 +48,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -60,6 +66,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -76,6 +84,44 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
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: [],
|
||||
),
|
||||
(
|
||||
id: ("113f74df-e39c-41d4-9b5b-e48efe541f7f"),
|
||||
path: "assets/models/RobotExpressive.glb",
|
||||
label: "RobotExpressive",
|
||||
kind_tag: "Model",
|
||||
import_settings: (
|
||||
scale: 1.0,
|
||||
generate_collider: true,
|
||||
lod0_only: true,
|
||||
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,
|
||||
material_policy: SourceMaterials,
|
||||
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: [],
|
||||
),
|
||||
@@ -92,6 +138,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -108,6 +156,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -124,6 +174,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -140,6 +192,26 @@
|
||||
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: [],
|
||||
),
|
||||
@@ -156,6 +228,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -172,6 +246,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -188,6 +264,26 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
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: [],
|
||||
),
|
||||
@@ -204,6 +300,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -220,6 +318,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -236,6 +336,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -252,6 +354,62 @@
|
||||
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: [],
|
||||
),
|
||||
@@ -268,6 +426,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -284,6 +444,26 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
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: [],
|
||||
),
|
||||
@@ -300,6 +480,26 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
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: [],
|
||||
),
|
||||
@@ -316,6 +516,26 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
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: [],
|
||||
),
|
||||
@@ -332,6 +552,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -348,6 +570,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -364,6 +588,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -380,6 +606,8 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
),
|
||||
dependencies: [],
|
||||
),
|
||||
@@ -396,6 +624,26 @@
|
||||
hierarchy_mode: SingleActor,
|
||||
material_policy: SourceMaterials,
|
||||
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: [],
|
||||
),
|
||||
|
||||
@@ -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: [],
|
||||
)
|
||||
@@ -1,18 +1,16 @@
|
||||
(schema_version: 2,
|
||||
resources: {},
|
||||
entities: {
|
||||
4294969001: (
|
||||
components: {
|
||||
"bevy_ecs::name::Name": "Audition Tone Source",
|
||||
"bevy_transform::components::transform::Transform": (
|
||||
(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::LevelObject": (),
|
||||
"shared::components::ActorId": ("audio-showcase-source"),
|
||||
"shared::components::ActorKind": AudioSource,
|
||||
"shared::components::AudioSourceDesc": (
|
||||
"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",
|
||||
@@ -32,25 +30,23 @@
|
||||
),
|
||||
bus: "sfx",
|
||||
),
|
||||
},
|
||||
),
|
||||
4294969002: (
|
||||
components: {
|
||||
"bevy_ecs::name::Name": "Showcase Listener",
|
||||
"bevy_transform::components::transform::Transform": (
|
||||
"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::LevelObject": (),
|
||||
"shared::components::ActorId": ("audio-showcase-listener"),
|
||||
"shared::components::ActorKind": AudioListener,
|
||||
"shared::components::AudioListenerDesc": (
|
||||
"shared::components::ActorId": ("audio-showcase-listener"),
|
||||
"shared::components::ActorKind": AudioListener,
|
||||
"shared::components::AudioListenerDesc": (
|
||||
enabled: true,
|
||||
priority: 100,
|
||||
ear_gap: 0.2,
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
)
|
||||
"shared::components::LevelObject": (),
|
||||
}),
|
||||
},
|
||||
)
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+1877
-1604
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)),
|
||||
}),
|
||||
},
|
||||
)
|
||||
@@ -1,17 +1,16 @@
|
||||
(schema_version: 2,
|
||||
resources: {},
|
||||
entities: {
|
||||
4294968001: (
|
||||
components: {
|
||||
"bevy_ecs::name::Name": "Fog Volume",
|
||||
"bevy_transform::components::transform::Transform": (
|
||||
(schema_version: 4,resources: {
|
||||
},
|
||||
entities: {
|
||||
4294968001: (components: {
|
||||
"bevy_ecs::name::Name": "Fog Volume",
|
||||
"bevy_transform::components::transform::Transform": (
|
||||
translation: (0.0, 2.0, 0.0),
|
||||
rotation: (0.0, 0.0, 0.0, 1.0),
|
||||
scale: (1.0, 1.0, 1.0),
|
||||
),
|
||||
"shared::components::LevelObject": (),
|
||||
"shared::components::ActorKind": PostProcessVolume,
|
||||
"shared::components::PostProcessVolumeDesc": (
|
||||
"shared::components::ActorKind": PostProcessVolume,
|
||||
"shared::components::LevelObject": (),
|
||||
"shared::components::PostProcessVolumeDesc": (
|
||||
half_extents: (6.0, 3.0, 6.0),
|
||||
priority: 0,
|
||||
blend_distance: 2.0,
|
||||
@@ -23,19 +22,17 @@
|
||||
profile: None,
|
||||
label: Some("Foggy courtyard"),
|
||||
),
|
||||
},
|
||||
),
|
||||
4294968002: (
|
||||
components: {
|
||||
"bevy_ecs::name::Name": "Dark Exposure Volume",
|
||||
"bevy_transform::components::transform::Transform": (
|
||||
}),
|
||||
4294968002: (components: {
|
||||
"bevy_ecs::name::Name": "Dark Exposure Volume",
|
||||
"bevy_transform::components::transform::Transform": (
|
||||
translation: (14.0, 2.0, 0.0),
|
||||
rotation: (0.0, 0.0, 0.0, 1.0),
|
||||
scale: (1.0, 1.0, 1.0),
|
||||
),
|
||||
"shared::components::LevelObject": (),
|
||||
"shared::components::ActorKind": PostProcessVolume,
|
||||
"shared::components::PostProcessVolumeDesc": (
|
||||
"shared::components::ActorKind": PostProcessVolume,
|
||||
"shared::components::LevelObject": (),
|
||||
"shared::components::PostProcessVolumeDesc": (
|
||||
half_extents: (4.0, 2.5, 4.0),
|
||||
priority: 5,
|
||||
blend_distance: 1.5,
|
||||
@@ -47,19 +44,17 @@
|
||||
profile: Some("assets/rendering_profiles/cave_dark.ron"),
|
||||
label: Some("Cave mouth"),
|
||||
),
|
||||
},
|
||||
),
|
||||
4294968003: (
|
||||
components: {
|
||||
"bevy_ecs::name::Name": "Vignette FX Volume",
|
||||
"bevy_transform::components::transform::Transform": (
|
||||
}),
|
||||
4294968003: (components: {
|
||||
"bevy_ecs::name::Name": "Vignette FX Volume",
|
||||
"bevy_transform::components::transform::Transform": (
|
||||
translation: (-12.0, 2.0, 0.0),
|
||||
rotation: (0.0, 0.0, 0.0, 1.0),
|
||||
scale: (1.0, 1.0, 1.0),
|
||||
),
|
||||
"shared::components::LevelObject": (),
|
||||
"shared::components::ActorKind": PostProcessVolume,
|
||||
"shared::components::PostProcessVolumeDesc": (
|
||||
"shared::components::ActorKind": PostProcessVolume,
|
||||
"shared::components::LevelObject": (),
|
||||
"shared::components::PostProcessVolumeDesc": (
|
||||
half_extents: (5.0, 2.0, 5.0),
|
||||
priority: 2,
|
||||
blend_distance: 2.0,
|
||||
@@ -68,7 +63,6 @@
|
||||
profile: None,
|
||||
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,
|
||||
),
|
||||
}),
|
||||
})
|
||||
@@ -1,12 +1,40 @@
|
||||
(
|
||||
schema_version: 1,
|
||||
label: "Concrete",
|
||||
shader: None,
|
||||
shader_ref: None,
|
||||
render_state: (
|
||||
alpha_mode: Opaque,
|
||||
alpha_cutoff: 0.5,
|
||||
double_sided: false,
|
||||
),
|
||||
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,
|
||||
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,
|
||||
emissive_texture: None,
|
||||
normal_map_texture: None,
|
||||
metallic_roughness_texture: None,
|
||||
material_asset_path: None,
|
||||
parameters: [],
|
||||
textures: [],
|
||||
),
|
||||
)
|
||||
)
|
||||
@@ -1,15 +1,40 @@
|
||||
(
|
||||
schema_version: 1,
|
||||
label: "Emissive Panel",
|
||||
shader: None,
|
||||
shader_ref: None,
|
||||
render_state: (
|
||||
alpha_mode: Opaque,
|
||||
alpha_cutoff: 0.5,
|
||||
double_sided: false,
|
||||
),
|
||||
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,
|
||||
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,
|
||||
base_color_texture: None,
|
||||
emissive_texture: None,
|
||||
normal_map_texture: None,
|
||||
metallic_roughness_texture: None,
|
||||
material_asset_path: None,
|
||||
parameters: [],
|
||||
textures: [],
|
||||
),
|
||||
)
|
||||
)
|
||||
@@ -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,5 +1,5 @@
|
||||
(
|
||||
schema_version: 1,
|
||||
schema_version: 3,
|
||||
asset_id: "b98ef565-3500-49e7-9935-f685fa9b2594",
|
||||
label: "painted_wooden_chair_02_2k",
|
||||
source: (
|
||||
@@ -30,7 +30,7 @@
|
||||
),
|
||||
parts: [
|
||||
(
|
||||
id: "mesh:mesh1000",
|
||||
id: "draw:scene0:node1:material0",
|
||||
name: "painted_wooden_chair_02 / Material 0",
|
||||
mesh_label: "Mesh1000",
|
||||
material_id: Some("material:material0"),
|
||||
@@ -44,6 +44,7 @@
|
||||
source_node: Some("Node1"),
|
||||
source_mesh: Some("Mesh1"),
|
||||
source_material: Some("painted_wooden_chair_02"),
|
||||
skinned: false,
|
||||
),
|
||||
],
|
||||
warnings: [],
|
||||
|
||||
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,
|
||||
),
|
||||
)
|
||||
@@ -1,19 +1,17 @@
|
||||
(schema_version: 2,
|
||||
resources: {},
|
||||
entities: {
|
||||
1: (
|
||||
components: {
|
||||
"bevy_ecs::name::Name": "Example Base Mesh",
|
||||
"bevy_transform::components::transform::Transform": (
|
||||
(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": (),
|
||||
},
|
||||
),
|
||||
},
|
||||
)
|
||||
"shared::components::ActorId": ("base-mesh"),
|
||||
"shared::components::ActorKind": Empty,
|
||||
"shared::components::EditorVisibility": (visible: true),
|
||||
"shared::components::LevelObject": (),
|
||||
}),
|
||||
},
|
||||
)
|
||||
@@ -1,23 +1,21 @@
|
||||
(schema_version: 2,
|
||||
resources: {},
|
||||
entities: {
|
||||
1: (
|
||||
components: {
|
||||
"bevy_ecs::name::Name": "Example Base Link",
|
||||
"bevy_transform::components::transform::Transform": (
|
||||
(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": (
|
||||
"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,
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
)
|
||||
}),
|
||||
},
|
||||
)
|
||||
@@ -1,23 +1,21 @@
|
||||
(schema_version: 2,
|
||||
resources: {},
|
||||
entities: {
|
||||
1: (
|
||||
components: {
|
||||
"bevy_ecs::name::Name": "Example Nested Variant Link",
|
||||
"bevy_transform::components::transform::Transform": (
|
||||
(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": (
|
||||
"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:[])"),
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
)
|
||||
}),
|
||||
},
|
||||
)
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -1,18 +1,73 @@
|
||||
(
|
||||
schema_version: 1,
|
||||
label: "Standard Lit",
|
||||
kind: StandardLit,
|
||||
wgsl_path: None,
|
||||
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: "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),
|
||||
(
|
||||
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: "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_textures: [],
|
||||
)
|
||||
)
|
||||
@@ -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: [],
|
||||
)
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,13 +1,37 @@
|
||||
(
|
||||
schema_version: 1,
|
||||
label: "Unlit",
|
||||
kind: Unlit,
|
||||
wgsl_path: None,
|
||||
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: "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",
|
||||
display_name: "Base Color",
|
||||
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_textures: [],
|
||||
)
|
||||
)
|
||||
@@ -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;
|
||||
}
|
||||
@@ -33,6 +33,7 @@ egui_phosphor_icons.workspace = true
|
||||
bevy_ufbx.workspace = true
|
||||
ufbx = "0.9"
|
||||
game.workspace = true
|
||||
polyanya.workspace = true
|
||||
game_hot.workspace = true
|
||||
hot-lib-reloader = { version = "0.8.2", optional = true }
|
||||
notify = { version = "6.1", optional = true }
|
||||
|
||||
@@ -210,6 +210,13 @@ fn build_gltf_manifest(
|
||||
});
|
||||
}
|
||||
|
||||
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
|
||||
@@ -232,6 +239,7 @@ fn build_gltf_manifest(
|
||||
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,
|
||||
@@ -313,15 +321,22 @@ fn build_fbx_manifest(
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let (runtime_supported, diagnostics) = fbx_runtime_support(
|
||||
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,
|
||||
@@ -335,6 +350,27 @@ fn build_fbx_manifest(
|
||||
})
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -696,7 +732,8 @@ mod tests {
|
||||
let second = build_animation_manifest(&record).unwrap();
|
||||
|
||||
assert_eq!(first, second);
|
||||
assert_eq!(first.schema_version, 2);
|
||||
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);
|
||||
@@ -717,6 +754,32 @@ mod tests {
|
||||
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();
|
||||
|
||||
@@ -27,8 +27,12 @@ impl Default for AssetId {
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq, Eq)]
|
||||
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,
|
||||
/// Instantiate the complete source scene as a generic imported model.
|
||||
SceneInstance,
|
||||
}
|
||||
|
||||
@@ -61,6 +65,10 @@ pub struct ImportSettings {
|
||||
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 {
|
||||
@@ -74,6 +82,7 @@ impl Default for ImportSettings {
|
||||
material_policy: MaterialImportPolicy::default(),
|
||||
static_mesh_manifest_path: None,
|
||||
animation_manifest_path: None,
|
||||
default_animation_clip_id: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -336,6 +345,7 @@ mod tests {
|
||||
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(),
|
||||
|
||||
@@ -524,6 +524,7 @@ fn empty_snapshot_for_asset(asset: &EditorAsset, translation: Vec3) -> EditorEnt
|
||||
primitive: None,
|
||||
brush: None,
|
||||
static_mesh_renderer: None,
|
||||
skinned_mesh_renderer: None,
|
||||
material: None,
|
||||
material_override: None,
|
||||
rigid_body: None,
|
||||
@@ -542,8 +543,18 @@ fn empty_snapshot_for_asset(asset: &EditorAsset, translation: Vec3) -> EditorEnt
|
||||
post_process_volume: None,
|
||||
team_spawn: None,
|
||||
objective: None,
|
||||
|
||||
navigation_bounds: None,
|
||||
|
||||
navigation_obstacle: None,
|
||||
|
||||
navigation_area: None,
|
||||
|
||||
navigation_link: None,
|
||||
hierarchy_sibling_index: 0,
|
||||
editor_visibility: EditorVisibility::default(),
|
||||
inspector_order: None,
|
||||
component_states: None,
|
||||
children: Vec::new(),
|
||||
}
|
||||
}
|
||||
@@ -672,17 +683,33 @@ pub fn spawn_asset_at(world: &mut World, asset: &EditorAsset, translation: Vec3)
|
||||
record.import_settings.placement_mode,
|
||||
ModelPlacementMode::StaticAsset
|
||||
) {
|
||||
if let Some(renderer) = static_mesh_renderer_for_asset(world, path) {
|
||||
let collider = record
|
||||
.import_settings
|
||||
.generate_collider
|
||||
.then(|| static_mesh_collider_for_renderer(&renderer));
|
||||
apply_static_mesh_placement_mode(
|
||||
&mut snapshot,
|
||||
renderer,
|
||||
collider,
|
||||
record.import_settings.hierarchy_mode,
|
||||
);
|
||||
if let Some((renderer, requires_skinned_renderer)) =
|
||||
static_mesh_renderer_for_asset(world, path)
|
||||
{
|
||||
if requires_skinned_renderer {
|
||||
apply_skinned_mesh_placement_mode_with_materials(
|
||||
&mut snapshot,
|
||||
renderer.materials.clone(),
|
||||
);
|
||||
match default_animation_controller_for_record(&record) {
|
||||
Ok(controller) => snapshot.animation_controller = controller,
|
||||
Err(error) => warn!(
|
||||
"Default animation was not applied while placing {}: {error}",
|
||||
record.path
|
||||
),
|
||||
}
|
||||
} else {
|
||||
let collider = record
|
||||
.import_settings
|
||||
.generate_collider
|
||||
.then(|| static_mesh_collider_for_renderer(&renderer));
|
||||
apply_static_mesh_placement_mode(
|
||||
&mut snapshot,
|
||||
renderer,
|
||||
collider,
|
||||
record.import_settings.hierarchy_mode,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
warn!(
|
||||
"Static mesh placement fell back to SceneRoot for {} because no renderer manifest was available",
|
||||
@@ -760,6 +787,11 @@ pub fn spawn_subasset_at(
|
||||
.parts
|
||||
.iter()
|
||||
.find(|part| part_effective_id_for_selection(part) == *sub_asset_id)?;
|
||||
let part_requires_skinned_renderer = manifest.metadata.animation_count > 0
|
||||
|| part.skinned
|
||||
|| (manifest.schema_version < 2
|
||||
&& crate::assets::gltf_skinned_primitive_labels(parent_path)
|
||||
.contains(&part.mesh_label));
|
||||
|
||||
let mesh_ref = shared::EditorAssetRef::new(
|
||||
manifest.asset_id.clone(),
|
||||
@@ -784,6 +816,10 @@ pub fn spawn_subasset_at(
|
||||
id: shared::ComponentInstanceId::new("slot:0"),
|
||||
name: label.clone(),
|
||||
mesh: mesh_ref.clone(),
|
||||
material_slot_id: shared::ComponentInstanceId::new(format!(
|
||||
"slot:{}",
|
||||
part_effective_id_for_selection(part)
|
||||
)),
|
||||
material,
|
||||
local_transform: part.local_transform,
|
||||
visible: true,
|
||||
@@ -800,6 +836,7 @@ pub fn spawn_subasset_at(
|
||||
primitive: None,
|
||||
brush: None,
|
||||
static_mesh_renderer: Some(shared::StaticMeshRenderer::single(slot)),
|
||||
skinned_mesh_renderer: None,
|
||||
material: None,
|
||||
material_override: None,
|
||||
rigid_body: None,
|
||||
@@ -818,11 +855,41 @@ pub fn spawn_subasset_at(
|
||||
post_process_volume: None,
|
||||
team_spawn: None,
|
||||
objective: None,
|
||||
|
||||
navigation_bounds: None,
|
||||
|
||||
navigation_obstacle: None,
|
||||
|
||||
navigation_area: None,
|
||||
|
||||
navigation_link: None,
|
||||
hierarchy_sibling_index: 0,
|
||||
editor_visibility: EditorVisibility::default(),
|
||||
inspector_order: None,
|
||||
component_states: None,
|
||||
children: Vec::new(),
|
||||
};
|
||||
snapshot.transform.scale *= record.import_settings.scale;
|
||||
if part_requires_skinned_renderer {
|
||||
snapshot.actor_kind = ActorKind::SkinnedMesh;
|
||||
snapshot.static_mesh_renderer = None;
|
||||
snapshot.skinned_mesh_renderer = Some(shared::SkinnedMeshRenderer {
|
||||
materials: crate::assets::static_mesh::renderer_materials_from_manifest(
|
||||
&manifest,
|
||||
&record.import_settings,
|
||||
),
|
||||
..shared::SkinnedMeshRenderer::new(parent_path.clone())
|
||||
.with_asset_id(record.id.as_string())
|
||||
});
|
||||
match default_animation_controller_for_record(&record) {
|
||||
Ok(controller) => snapshot.animation_controller = controller,
|
||||
Err(error) => warn!(
|
||||
"Default animation was not applied while placing {}: {error}",
|
||||
record.path
|
||||
),
|
||||
}
|
||||
return Some(spawn_with_history(world, snapshot));
|
||||
}
|
||||
if record.import_settings.generate_collider {
|
||||
snapshot.rigid_body = Some(RigidBodyDesc::default());
|
||||
snapshot.collider = Some(ColliderDesc::static_mesh(vec![mesh_ref]));
|
||||
@@ -840,6 +907,7 @@ pub struct AnimationClipAuthoringData {
|
||||
pub skeleton: shared::EditorAssetRef,
|
||||
pub skeleton_signature: shared::AnimationSkeletonSignature,
|
||||
pub state: shared::AnimationStateDesc,
|
||||
pub renderer_materials: shared::RendererMaterialSet,
|
||||
}
|
||||
|
||||
pub fn animation_clip_authoring_data(
|
||||
@@ -905,6 +973,18 @@ pub fn animation_clip_authoring_data(
|
||||
let clip_ref = shared::EditorAssetRef::new(asset_id, clip.id.clone(), clip.label.clone())
|
||||
.with_source_path(parent_path);
|
||||
let state_id = animation_state_id(&clip.label, clip.source_index);
|
||||
let renderer_materials = record
|
||||
.import_settings
|
||||
.static_mesh_manifest_path
|
||||
.as_deref()
|
||||
.and_then(|path| load_static_mesh_manifest(path).ok())
|
||||
.map(|render_manifest| {
|
||||
crate::assets::static_mesh::renderer_materials_from_manifest(
|
||||
&render_manifest,
|
||||
&record.import_settings,
|
||||
)
|
||||
})
|
||||
.unwrap_or_default();
|
||||
Ok(AnimationClipAuthoringData {
|
||||
model_asset_id: record.id.as_string(),
|
||||
model_path: parent_path.clone(),
|
||||
@@ -920,6 +1000,7 @@ pub fn animation_clip_authoring_data(
|
||||
speed: 1.0,
|
||||
range: shared::AnimationPlaybackRange::default(),
|
||||
},
|
||||
renderer_materials,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -957,7 +1038,7 @@ pub fn animation_skeleton_signature_for_ref(
|
||||
|
||||
pub fn compatible_animation_skeleton_for_model(
|
||||
world: &World,
|
||||
model: &ModelRef,
|
||||
model: &shared::SkinnedMeshRenderer,
|
||||
signature: &shared::AnimationSkeletonSignature,
|
||||
) -> Result<shared::EditorAssetRef, String> {
|
||||
let record = world
|
||||
@@ -1017,6 +1098,82 @@ fn animation_state_id(label: &str, source_index: usize) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
fn default_animation_controller_for_record(
|
||||
record: &crate::asset_db::AssetRecord,
|
||||
) -> Result<Option<shared::AnimationControllerDesc>, String> {
|
||||
let Some(manifest_path) = record.import_settings.animation_manifest_path.as_deref() else {
|
||||
return Ok(None);
|
||||
};
|
||||
let manifest = load_animation_manifest(manifest_path)?;
|
||||
if manifest.default_animation_clip_id != record.import_settings.default_animation_clip_id {
|
||||
return Err(
|
||||
"model import settings and generated animation manifest disagree; reimport the model"
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
let Some(default_clip_id) = manifest
|
||||
.default_animation_clip_id
|
||||
.as_deref()
|
||||
.filter(|id| !id.trim().is_empty())
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
if !manifest.runtime_supported {
|
||||
return Err(format!(
|
||||
"configured clip `{default_clip_id}` belongs to a model unsupported by the animation runtime"
|
||||
));
|
||||
}
|
||||
let clip = manifest
|
||||
.clips
|
||||
.iter()
|
||||
.find(|clip| clip.id == default_clip_id)
|
||||
.ok_or_else(|| {
|
||||
format!(
|
||||
"configured clip `{default_clip_id}` is missing from {manifest_path}; choose an existing clip or Imported rest pose"
|
||||
)
|
||||
})?;
|
||||
let signature = clip.target_skeleton_signature.as_ref().ok_or_else(|| {
|
||||
format!(
|
||||
"configured clip `{}` has no uniquely resolved target skeleton",
|
||||
clip.label
|
||||
)
|
||||
})?;
|
||||
let skeleton = manifest
|
||||
.skeletons
|
||||
.iter()
|
||||
.find(|skeleton| &skeleton.signature == signature)
|
||||
.ok_or_else(|| {
|
||||
format!(
|
||||
"configured clip `{}` targets skeleton `{}` but no exact match exists",
|
||||
clip.label, signature.0
|
||||
)
|
||||
})?;
|
||||
let state_id = animation_state_id(&clip.label, clip.source_index);
|
||||
let source_path = manifest.source.path.clone();
|
||||
let asset_id = manifest.asset_id.clone();
|
||||
Ok(Some(shared::AnimationControllerDesc {
|
||||
skeleton: Some(
|
||||
shared::EditorAssetRef::new(
|
||||
asset_id.clone(),
|
||||
skeleton.id.clone(),
|
||||
skeleton.label.clone(),
|
||||
)
|
||||
.with_source_path(&source_path),
|
||||
),
|
||||
states: vec![shared::AnimationStateDesc {
|
||||
id: state_id.clone(),
|
||||
label: clip.label.clone(),
|
||||
clip: shared::EditorAssetRef::new(asset_id, clip.id.clone(), clip.label.clone())
|
||||
.with_source_path(source_path),
|
||||
looping: true,
|
||||
speed: 1.0,
|
||||
range: shared::AnimationPlaybackRange::default(),
|
||||
}],
|
||||
default_state: state_id,
|
||||
..default()
|
||||
}))
|
||||
}
|
||||
|
||||
fn spawn_animation_clip_at(
|
||||
world: &mut World,
|
||||
selection: &AssetSelection,
|
||||
@@ -1035,7 +1192,7 @@ fn spawn_animation_clip_at(
|
||||
let default_state = authored.state.id.clone();
|
||||
let snapshot = EditorEntitySnapshot {
|
||||
actor_id: None,
|
||||
actor_kind: ActorKind::ImportedModel,
|
||||
actor_kind: ActorKind::SkinnedMesh,
|
||||
actor_name: None,
|
||||
name: Some(authored.model_label),
|
||||
transform: Transform {
|
||||
@@ -1046,6 +1203,11 @@ fn spawn_animation_clip_at(
|
||||
primitive: None,
|
||||
brush: None,
|
||||
static_mesh_renderer: None,
|
||||
skinned_mesh_renderer: Some(shared::SkinnedMeshRenderer {
|
||||
materials: authored.renderer_materials,
|
||||
..shared::SkinnedMeshRenderer::new(authored.model_path)
|
||||
.with_asset_id(authored.model_asset_id)
|
||||
}),
|
||||
material: None,
|
||||
material_override: None,
|
||||
rigid_body: None,
|
||||
@@ -1061,7 +1223,7 @@ fn spawn_animation_clip_at(
|
||||
audio_source: None,
|
||||
audio_listener: None,
|
||||
player_spawn: false,
|
||||
model: Some(ModelRef::new(authored.model_path).with_asset_id(authored.model_asset_id)),
|
||||
model: None,
|
||||
prefab: None,
|
||||
prefab_instance: None,
|
||||
weapon_spawn: None,
|
||||
@@ -1069,8 +1231,18 @@ fn spawn_animation_clip_at(
|
||||
post_process_volume: None,
|
||||
team_spawn: None,
|
||||
objective: None,
|
||||
|
||||
navigation_bounds: None,
|
||||
|
||||
navigation_obstacle: None,
|
||||
|
||||
navigation_area: None,
|
||||
|
||||
navigation_link: None,
|
||||
hierarchy_sibling_index: 0,
|
||||
editor_visibility: EditorVisibility::default(),
|
||||
inspector_order: None,
|
||||
component_states: None,
|
||||
children: Vec::new(),
|
||||
};
|
||||
Some(spawn_with_history(world, snapshot))
|
||||
@@ -1118,6 +1290,7 @@ fn apply_static_mesh_placement_mode(
|
||||
primitive: None,
|
||||
brush: None,
|
||||
static_mesh_renderer: Some(shared::StaticMeshRenderer::single(entry)),
|
||||
skinned_mesh_renderer: None,
|
||||
material: None,
|
||||
material_override: None,
|
||||
rigid_body: collider.as_ref().map(|_| RigidBodyDesc::default()),
|
||||
@@ -1136,8 +1309,18 @@ fn apply_static_mesh_placement_mode(
|
||||
post_process_volume: None,
|
||||
team_spawn: None,
|
||||
objective: None,
|
||||
|
||||
navigation_bounds: None,
|
||||
|
||||
navigation_obstacle: None,
|
||||
|
||||
navigation_area: None,
|
||||
|
||||
navigation_link: None,
|
||||
hierarchy_sibling_index: index as i32,
|
||||
editor_visibility: EditorVisibility::default(),
|
||||
inspector_order: None,
|
||||
component_states: None,
|
||||
children: Vec::new(),
|
||||
}
|
||||
})
|
||||
@@ -1146,6 +1329,35 @@ fn apply_static_mesh_placement_mode(
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn apply_skinned_mesh_placement_mode(snapshot: &mut EditorEntitySnapshot) {
|
||||
apply_skinned_mesh_placement_mode_with_materials(
|
||||
snapshot,
|
||||
shared::RendererMaterialSet::default(),
|
||||
);
|
||||
}
|
||||
|
||||
fn apply_skinned_mesh_placement_mode_with_materials(
|
||||
snapshot: &mut EditorEntitySnapshot,
|
||||
materials: shared::RendererMaterialSet,
|
||||
) {
|
||||
let Some(model) = snapshot.model.take() else {
|
||||
return;
|
||||
};
|
||||
snapshot.actor_kind = ActorKind::SkinnedMesh;
|
||||
snapshot.static_mesh_renderer = None;
|
||||
snapshot.skinned_mesh_renderer = Some(shared::SkinnedMeshRenderer {
|
||||
asset_id: model.asset_id,
|
||||
path: model.path,
|
||||
scene_index: model.scene_index,
|
||||
materials,
|
||||
});
|
||||
// Triangle-mesh colliders are a static-geometry concern. Animated collision must be authored
|
||||
// explicitly (capsules, hitboxes, or another gameplay-specific representation).
|
||||
snapshot.rigid_body = None;
|
||||
snapshot.collider = None;
|
||||
}
|
||||
|
||||
fn static_mesh_collider_for_renderer(renderer: &shared::StaticMeshRenderer) -> ColliderDesc {
|
||||
ColliderDesc::static_mesh(
|
||||
renderer
|
||||
@@ -1177,14 +1389,26 @@ fn part_effective_material_id_for_selection(
|
||||
fn static_mesh_renderer_for_asset(
|
||||
world: &mut World,
|
||||
path: &str,
|
||||
) -> Option<shared::StaticMeshRenderer> {
|
||||
) -> Option<(shared::StaticMeshRenderer, bool)> {
|
||||
let mut manifest_path = None;
|
||||
if let Some(mut registry) = world.get_resource_mut::<AssetRegistry>() {
|
||||
let mut renderer = None;
|
||||
if let Some(record) = find_asset_mut_by_path(&mut registry, path) {
|
||||
match super::refresh_model_artifacts(record) {
|
||||
Ok(manifest) => {
|
||||
renderer = Some(renderer_from_manifest(&manifest, &record.import_settings));
|
||||
let requires_skinned_renderer = manifest.metadata.animation_count > 0
|
||||
|| manifest.metadata.skin_count > 0
|
||||
|| manifest.parts.iter().any(|part| part.skinned);
|
||||
let mut authored_renderer =
|
||||
renderer_from_manifest(&manifest, &record.import_settings);
|
||||
if requires_skinned_renderer {
|
||||
authored_renderer.materials =
|
||||
crate::assets::static_mesh::renderer_materials_from_manifest(
|
||||
&manifest,
|
||||
&record.import_settings,
|
||||
);
|
||||
}
|
||||
renderer = Some((authored_renderer, requires_skinned_renderer));
|
||||
registry.index_dirty = true;
|
||||
}
|
||||
Err(error) => {
|
||||
@@ -1207,7 +1431,17 @@ fn static_mesh_renderer_for_asset(
|
||||
let registry = world.get_resource::<AssetRegistry>()?;
|
||||
let record = find_asset_by_path(registry, path)?;
|
||||
let manifest = load_static_mesh_manifest(&manifest_path).ok()?;
|
||||
Some(renderer_from_manifest(&manifest, &record.import_settings))
|
||||
let requires_skinned_renderer = manifest.metadata.animation_count > 0
|
||||
|| manifest.metadata.skin_count > 0
|
||||
|| manifest.parts.iter().any(|part| part.skinned);
|
||||
let mut renderer = renderer_from_manifest(&manifest, &record.import_settings);
|
||||
if requires_skinned_renderer {
|
||||
renderer.materials = crate::assets::static_mesh::renderer_materials_from_manifest(
|
||||
&manifest,
|
||||
&record.import_settings,
|
||||
);
|
||||
}
|
||||
Some((renderer, requires_skinned_renderer))
|
||||
}
|
||||
|
||||
pub fn import_external_assets(paths: &[PathBuf]) -> Result<usize, String> {
|
||||
@@ -1348,4 +1582,106 @@ mod tests {
|
||||
);
|
||||
assert!(world.resource::<crate::history::EditorHistory>().can_undo());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn skinned_model_placement_replaces_static_and_generic_model_renderers() {
|
||||
let asset = EditorAsset {
|
||||
label: "Hero".into(),
|
||||
path: Some("assets/models/hero.glb".into()),
|
||||
folder_path: "assets/models".into(),
|
||||
kind: EditorAssetKind::Model,
|
||||
};
|
||||
let mut snapshot = snapshot_for_asset(&asset, Vec3::ZERO).unwrap();
|
||||
snapshot.model.as_mut().unwrap().asset_id = "hero-id".into();
|
||||
snapshot.static_mesh_renderer = Some(shared::StaticMeshRenderer::default());
|
||||
snapshot.rigid_body = Some(RigidBodyDesc::default());
|
||||
snapshot.collider = Some(ColliderDesc::static_cuboid(Vec3::ONE));
|
||||
|
||||
apply_skinned_mesh_placement_mode(&mut snapshot);
|
||||
|
||||
assert_eq!(snapshot.actor_kind, ActorKind::SkinnedMesh);
|
||||
assert!(snapshot.model.is_none());
|
||||
assert!(snapshot.static_mesh_renderer.is_none());
|
||||
assert!(snapshot.rigid_body.is_none());
|
||||
assert!(snapshot.collider.is_none());
|
||||
assert_eq!(
|
||||
snapshot.skinned_mesh_renderer,
|
||||
Some(
|
||||
shared::SkinnedMeshRenderer::new("assets/models/hero.glb").with_asset_id("hero-id")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn model_default_clip_builds_one_explicit_controller_state() {
|
||||
let key = Uuid::new_v4();
|
||||
let manifest_path =
|
||||
std::env::temp_dir().join(format!("blacksite-default-animation-{key}.animation.ron"));
|
||||
let asset_id = key.to_string();
|
||||
let signature = shared::AnimationSkeletonSignature::new("rig-signature");
|
||||
let clip_id = shared::animation_clip_sub_asset_id(8, "Standing");
|
||||
let manifest = shared::AnimationManifest {
|
||||
schema_version: shared::ANIMATION_MANIFEST_SCHEMA_VERSION,
|
||||
asset_id: asset_id.clone(),
|
||||
label: "Robot".into(),
|
||||
default_animation_clip_id: Some(clip_id.clone()),
|
||||
source: shared::AnimationManifestSource {
|
||||
path: "assets/models/robot.glb".into(),
|
||||
format: "glb".into(),
|
||||
fingerprint: shared::AnimationSourceFingerprint {
|
||||
byte_len: 1,
|
||||
modified_unix_secs: 0,
|
||||
content_hash: "fixture".into(),
|
||||
},
|
||||
dependencies: Vec::new(),
|
||||
},
|
||||
runtime_supported: true,
|
||||
skeletons: vec![shared::AnimationSkeletonRecord {
|
||||
id: shared::animation_skeleton_sub_asset_id(0, "Rig"),
|
||||
label: "Rig".into(),
|
||||
source_index: 0,
|
||||
signature: signature.clone(),
|
||||
joint_paths: vec!["Root".into()],
|
||||
}],
|
||||
clips: vec![shared::AnimationClipRecord {
|
||||
id: clip_id.clone(),
|
||||
label: "Standing".into(),
|
||||
source_index: 8,
|
||||
duration_seconds: 0.4,
|
||||
target_skeleton_signature: Some(signature),
|
||||
events: 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: AssetId(key),
|
||||
path: "assets/models/robot.glb".into(),
|
||||
label: "Robot".into(),
|
||||
kind_tag: "Model".into(),
|
||||
import_settings: crate::asset_db::ImportSettings {
|
||||
animation_manifest_path: Some(manifest_path.to_string_lossy().into_owned()),
|
||||
default_animation_clip_id: Some(clip_id.clone()),
|
||||
..Default::default()
|
||||
},
|
||||
dependencies: Vec::new(),
|
||||
};
|
||||
|
||||
let controller = default_animation_controller_for_record(&record)
|
||||
.unwrap()
|
||||
.expect("explicit default should produce a controller");
|
||||
assert_eq!(controller.default_state, "standing");
|
||||
assert_eq!(controller.states.len(), 1);
|
||||
assert_eq!(controller.states[0].clip.sub_asset_id, clip_id);
|
||||
assert_eq!(
|
||||
controller.skeleton.unwrap().sub_asset_id,
|
||||
shared::animation_skeleton_sub_asset_id(0, "Rig")
|
||||
);
|
||||
|
||||
std::fs::remove_file(manifest_path).unwrap();
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
use bevy::prelude::*;
|
||||
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::history::set_material_group_with_history;
|
||||
use crate::history::{reflected_component_transaction, set_material_group_with_history};
|
||||
use crate::ui::inspector::property_row;
|
||||
|
||||
pub fn load_material_asset(catalog_path: &str) -> Result<MaterialAsset, String> {
|
||||
@@ -13,10 +16,7 @@ pub fn load_material_asset(catalog_path: &str) -> Result<MaterialAsset, String>
|
||||
}
|
||||
|
||||
pub fn material_desc_from_asset(catalog_path: &str) -> Result<MaterialDesc, String> {
|
||||
let asset = load_material_asset(catalog_path)?;
|
||||
let mut desc = asset.material;
|
||||
desc.material_asset_path = Some(catalog_path.to_string());
|
||||
Ok(desc)
|
||||
shared::load_resolved_material_from_path(catalog_path).map(|(desc, _)| desc)
|
||||
}
|
||||
|
||||
pub fn apply_material_asset_to_selection(
|
||||
@@ -28,18 +28,105 @@ pub fn apply_material_asset_to_selection(
|
||||
.path
|
||||
.clone()
|
||||
.ok_or_else(|| format!("Material has no source path: {}", asset.label))?;
|
||||
let desc = material_desc_from_asset(&path)?;
|
||||
let changes = crate::ui::helpers::selected_level_entities(world, selected)
|
||||
.into_iter()
|
||||
.filter(|entity| world.get::<LevelObject>(*entity).is_some())
|
||||
.map(|entity| (entity, desc.clone()))
|
||||
.collect::<Vec<_>>();
|
||||
set_material_group_with_history(world, changes);
|
||||
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 material_ref = MaterialRef::new(
|
||||
shared::EditorAssetRef::new(record.id.as_string(), sub_asset_id, asset.label.clone())
|
||||
.with_source_path(path.clone()),
|
||||
);
|
||||
let desc = material_desc_from_asset(&path).ok();
|
||||
let entities = crate::ui::helpers::selected_level_entities(world, selected);
|
||||
let mut renderer_changes = 0usize;
|
||||
let mut legacy_changes = Vec::new();
|
||||
for entity in entities {
|
||||
if world.get::<LevelObject>(entity).is_none() {
|
||||
continue;
|
||||
}
|
||||
if let Some(mut renderer) = world.get::<shared::StaticMeshRenderer>(entity).cloned() {
|
||||
ensure_static_material_slots(&mut renderer);
|
||||
for slot in &mut renderer.materials.slots {
|
||||
slot.material = Some(material_ref.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 =
|
||||
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(
|
||||
world: &mut World,
|
||||
ui: &mut egui::Ui,
|
||||
|
||||
@@ -13,8 +13,8 @@ pub mod thumbnails;
|
||||
pub use catalog::*;
|
||||
pub use thumbnails::{
|
||||
draw_asset_cell_with, gltf_skinned_primitive_labels, invalidate_on_catalog_refresh, kind_icon,
|
||||
prefetch_folder_thumbnails, 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.
|
||||
|
||||
@@ -119,10 +119,10 @@ pub fn assign_animation_clip_operator(
|
||||
selection: AssetSelection,
|
||||
entity: Entity,
|
||||
) -> bool {
|
||||
let availability = if world.get::<shared::ModelRef>(entity).is_some() {
|
||||
let availability = if world.get::<shared::SkinnedMeshRenderer>(entity).is_some() {
|
||||
OperatorAvailability::Ready
|
||||
} else {
|
||||
OperatorAvailability::Disabled("Select an authored imported-model actor".to_string())
|
||||
OperatorAvailability::Disabled("Select an authored skinned-mesh actor".to_string())
|
||||
};
|
||||
let label = format!("Assign Animation Clip {}", selection.display_label());
|
||||
run_immediate_operator(
|
||||
@@ -133,9 +133,9 @@ pub fn assign_animation_clip_operator(
|
||||
move |world| {
|
||||
let authored = animation_clip_authoring_data(world, &selection)?;
|
||||
let model = world
|
||||
.get::<shared::ModelRef>(entity)
|
||||
.get::<shared::SkinnedMeshRenderer>(entity)
|
||||
.cloned()
|
||||
.ok_or_else(|| "Selected actor has no ModelRef".to_string())?;
|
||||
.ok_or_else(|| "Selected actor has no SkinnedMeshRenderer".to_string())?;
|
||||
let mut controller = world
|
||||
.get::<shared::AnimationControllerDesc>(entity)
|
||||
.cloned()
|
||||
@@ -197,7 +197,7 @@ mod tests {
|
||||
animation_clip_sub_asset_id, animation_skeleton_sub_asset_id, ActorKind,
|
||||
AnimationClipRecord, AnimationControllerDesc, AnimationManifest, AnimationManifestSource,
|
||||
AnimationSkeletonRecord, AnimationSkeletonSignature, AnimationSourceFingerprint,
|
||||
AudioSourceDesc, LevelObject, MaterialDesc, ModelRef, PrimitiveShape,
|
||||
AudioSourceDesc, LevelObject, MaterialDesc, PrimitiveShape, SkinnedMeshRenderer,
|
||||
ANIMATION_MANIFEST_SCHEMA_VERSION,
|
||||
};
|
||||
|
||||
@@ -222,6 +222,7 @@ mod tests {
|
||||
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(),
|
||||
@@ -301,6 +302,43 @@ mod tests {
|
||||
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();
|
||||
@@ -363,8 +401,8 @@ mod tests {
|
||||
let entity = world
|
||||
.spawn((
|
||||
LevelObject,
|
||||
ActorKind::ImportedModel,
|
||||
ModelRef::new(model_path),
|
||||
ActorKind::SkinnedMesh,
|
||||
SkinnedMeshRenderer::new(model_path),
|
||||
))
|
||||
.id();
|
||||
let harness = OperatorInvariantHarness::capture(&mut world);
|
||||
|
||||
@@ -22,6 +22,7 @@ use crate::asset_db::{ensure_asset_record, AssetRegistry};
|
||||
use crate::history::{
|
||||
capture_prefab_edit_state, record_prefab_edit_state, record_prefab_source_apply,
|
||||
};
|
||||
use crate::native_dialog::NativeDialogBroker;
|
||||
use crate::ui::inspector::{
|
||||
apply_component_card_response, component_card, component_card_context, property_row,
|
||||
ComponentCardOptions,
|
||||
@@ -751,13 +752,44 @@ fn relink_prefab_source(world: &mut World, entity: Entity) {
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Some(path) = rfd::FileDialog::new()
|
||||
.set_directory(project_root.join("assets/prefabs"))
|
||||
.add_filter("Bevy prefab", &["scn.ron", "ron"])
|
||||
.pick_file()
|
||||
else {
|
||||
let directory = project_root.join("assets/prefabs");
|
||||
let result = world.resource::<NativeDialogBroker>().request(
|
||||
move || {
|
||||
rfd::FileDialog::new()
|
||||
.set_directory(directory)
|
||||
.add_filter("Bevy prefab", &["scn.ron", "ron"])
|
||||
.pick_file()
|
||||
},
|
||||
move |world, path| {
|
||||
let Some(path) = path else {
|
||||
world
|
||||
.resource_mut::<crate::scene_io::SceneIo>()
|
||||
.set_status("Prefab relink cancelled");
|
||||
return;
|
||||
};
|
||||
finish_relink_prefab_source(world, entity, project_root, path);
|
||||
},
|
||||
);
|
||||
world
|
||||
.resource_mut::<crate::scene_io::SceneIo>()
|
||||
.set_status(match result {
|
||||
Ok(()) => "Choose a prefab source".into(),
|
||||
Err(error) => format!("Prefab relink unavailable: {error}"),
|
||||
});
|
||||
}
|
||||
|
||||
fn finish_relink_prefab_source(
|
||||
world: &mut World,
|
||||
entity: Entity,
|
||||
project_root: PathBuf,
|
||||
path: PathBuf,
|
||||
) {
|
||||
if world.get_entity(entity).is_err() {
|
||||
world
|
||||
.resource_mut::<crate::scene_io::SceneIo>()
|
||||
.set_status("Prefab relink failed: the initiating actor no longer exists");
|
||||
return;
|
||||
};
|
||||
}
|
||||
let Ok(path) = path.canonicalize() else {
|
||||
return;
|
||||
};
|
||||
@@ -1248,6 +1280,10 @@ fn apply_prefab_scope_to_source(
|
||||
return;
|
||||
}
|
||||
};
|
||||
let before_snapshot = crate::collaboration::FileSnapshot::from_loaded_bytes(
|
||||
&source_path,
|
||||
before_source.as_bytes(),
|
||||
);
|
||||
let mut document = match SceneDocument::from_ron_text(&before_source) {
|
||||
Ok(document) => document,
|
||||
Err(error) => {
|
||||
@@ -1361,7 +1397,13 @@ fn apply_prefab_scope_to_source(
|
||||
}
|
||||
let after_source = document.to_ron_text()?;
|
||||
scene::validate_prefab_graph_text(&after_source, &source_path, &project_root)?;
|
||||
crate::scene::recovery::atomic_write(&source_path, after_source.as_bytes())?;
|
||||
crate::collaboration::publish_authored_file(
|
||||
world,
|
||||
&source_path,
|
||||
after_source.as_bytes(),
|
||||
&before_snapshot,
|
||||
crate::collaboration::FileWriteIntent::PrefabSource { instance_root },
|
||||
)?;
|
||||
Ok::<_, String>(after_source)
|
||||
})();
|
||||
let after_source = match apply_result {
|
||||
@@ -2607,6 +2649,22 @@ fn retry_prefab_source(world: &mut World, entity: Entity) {
|
||||
"Prefab source queued for reload".into();
|
||||
}
|
||||
|
||||
pub(crate) fn reload_prefab_source_after_file_conflict(
|
||||
world: &mut World,
|
||||
instance_root: Entity,
|
||||
) -> Result<String, String> {
|
||||
if world.get::<PrefabInstance>(instance_root).is_none() {
|
||||
return Err("the prefab instance no longer exists".into());
|
||||
}
|
||||
retry_prefab_source(world, instance_root);
|
||||
let status = world.resource::<crate::scene_io::SceneIo>().status.clone();
|
||||
if status.starts_with("Prefab retry failed") {
|
||||
Err(status)
|
||||
} else {
|
||||
Ok(status)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn prefab_member_inspector_ui(world: &mut World, ui: &mut egui::Ui, entity: Entity) {
|
||||
let Some((instance_root, target)) = prefab_member_override_target(world, entity) else {
|
||||
ui.label(egui::RichText::new("Prefab target unavailable").color(ERROR));
|
||||
@@ -3258,6 +3316,38 @@ mod tests {
|
||||
assert_eq!(read_overrides(&instance), PrefabOverrides::default());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn collaboration_reload_restarts_prefab_hydration_without_dropping_overrides() {
|
||||
let root = std::env::temp_dir().join(format!(
|
||||
"blacksite-prefab-collaboration-reload-{}",
|
||||
uuid::Uuid::new_v4()
|
||||
));
|
||||
let source_path = root.join("assets/prefabs/base.scn.ron");
|
||||
std::fs::create_dir_all(source_path.parent().unwrap()).unwrap();
|
||||
std::fs::write(&source_path, prefab_source("mesh", None)).unwrap();
|
||||
let mut world = prefab_test_world(&root);
|
||||
let mut instance = PrefabInstance::new("base", "assets/prefabs/base.scn.ron");
|
||||
instance.overrides_ron = encode_prefab_overrides(&PrefabOverrides {
|
||||
source_revision: Some("previous".into()),
|
||||
..Default::default()
|
||||
})
|
||||
.unwrap();
|
||||
let instance_root = world.spawn((instance.clone(), HydratedPrefabReady)).id();
|
||||
|
||||
let status = reload_prefab_source_after_file_conflict(&mut world, instance_root).unwrap();
|
||||
|
||||
assert_eq!(status, "Prefab source queued for reload");
|
||||
assert_eq!(
|
||||
world
|
||||
.get::<PrefabInstance>(instance_root)
|
||||
.map(|current| ¤t.overrides_ron),
|
||||
Some(&instance.overrides_ron)
|
||||
);
|
||||
assert!(world.get::<HydratedPrefabReady>(instance_root).is_none());
|
||||
assert!(world.get::<PrefabRef>(instance_root).is_some());
|
||||
std::fs::remove_dir_all(root).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nested_unpack_fold_is_transactional_when_a_later_link_is_invalid() {
|
||||
let mut world = World::new();
|
||||
|
||||
@@ -14,9 +14,12 @@ use serde::{Deserialize, Serialize};
|
||||
use crate::asset_db::{
|
||||
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";
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
@@ -80,6 +83,10 @@ pub struct StaticMeshPart {
|
||||
pub source_node: Option<String>,
|
||||
pub source_mesh: 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 {
|
||||
@@ -94,6 +101,17 @@ pub fn material_id_from_label(label: &str) -> String {
|
||||
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 {
|
||||
let mut slug = String::new();
|
||||
for ch in label.chars() {
|
||||
@@ -151,38 +169,106 @@ pub fn renderer_from_manifest(
|
||||
MaterialImportPolicy::SourceMaterials
|
||||
);
|
||||
|
||||
StaticMeshRenderer {
|
||||
let parts: Vec<_> = manifest
|
||||
.parts
|
||||
.iter()
|
||||
.filter(|part| !part.skinned && manifest.metadata.animation_count == 0)
|
||||
.map(|part| StaticMeshRendererEntry {
|
||||
id: ComponentInstanceId::new(part_effective_id(part)),
|
||||
name: part.name.clone(),
|
||||
mesh: EditorAssetRef::new(
|
||||
manifest.asset_id.clone(),
|
||||
part_effective_id(part),
|
||||
part.name.clone(),
|
||||
),
|
||||
material_slot_id: ComponentInstanceId::new(material_slot_id(part)),
|
||||
material: use_source_materials
|
||||
.then(|| {
|
||||
part_effective_material_id(part).map(|id| {
|
||||
EditorAssetRef::new(
|
||||
manifest.asset_id.clone(),
|
||||
id,
|
||||
part.material_slot_name.clone(),
|
||||
)
|
||||
})
|
||||
})
|
||||
.flatten(),
|
||||
local_transform: part.local_transform,
|
||||
visible: true,
|
||||
cast_shadows: true,
|
||||
receive_shadows: true,
|
||||
})
|
||||
.collect();
|
||||
let materials = RendererMaterialSet {
|
||||
slots: manifest
|
||||
.parts
|
||||
.iter()
|
||||
.map(|part| StaticMeshRendererEntry {
|
||||
id: ComponentInstanceId::new(part_effective_id(part)),
|
||||
name: part.name.clone(),
|
||||
mesh: EditorAssetRef::new(
|
||||
manifest.asset_id.clone(),
|
||||
part_effective_id(part),
|
||||
part.name.clone(),
|
||||
),
|
||||
material: use_source_materials
|
||||
.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| {
|
||||
EditorAssetRef::new(
|
||||
MaterialRef::new(EditorAssetRef::new(
|
||||
manifest.asset_id.clone(),
|
||||
id,
|
||||
part.material_slot_name.clone(),
|
||||
)
|
||||
))
|
||||
})
|
||||
})
|
||||
.flatten(),
|
||||
local_transform: part.local_transform,
|
||||
visible: true,
|
||||
cast_shadows: true,
|
||||
receive_shadows: true,
|
||||
material: None,
|
||||
})
|
||||
.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 {
|
||||
if part.id.trim().is_empty() {
|
||||
part_id_from_label(&part.mesh_label)
|
||||
@@ -255,23 +341,23 @@ fn build_gltf_manifest(
|
||||
.or_else(|| gltf.document.scenes().next())
|
||||
{
|
||||
for node in scene.nodes() {
|
||||
collect_gltf_node_parts(node, Mat4::IDENTITY, &mut parts);
|
||||
collect_gltf_node_parts(node, Mat4::IDENTITY, "", &mut parts);
|
||||
}
|
||||
} else {
|
||||
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 {
|
||||
warnings.push(
|
||||
"Animations are recorded as metadata; use Scene Instance placement for playback."
|
||||
"Animations are recorded as metadata; animated placement uses SkinnedMeshRenderer."
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
if gltf.document.skins().count() > 0 {
|
||||
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(),
|
||||
);
|
||||
}
|
||||
@@ -306,29 +392,44 @@ fn build_gltf_manifest(
|
||||
fn collect_gltf_node_parts(
|
||||
node: gltf::Node<'_>,
|
||||
parent_transform: Mat4,
|
||||
parent_path: &str,
|
||||
parts: &mut Vec<StaticMeshPart>,
|
||||
) {
|
||||
let local = Mat4::from_cols_array_2d(&node.transform().matrix());
|
||||
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() {
|
||||
collect_gltf_mesh_parts(
|
||||
node.name().map(str::to_string),
|
||||
Some(node.index()),
|
||||
Some(node_path.clone()),
|
||||
mesh,
|
||||
world_transform,
|
||||
skinned,
|
||||
parts,
|
||||
);
|
||||
}
|
||||
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(
|
||||
node_name: Option<String>,
|
||||
node_index: Option<usize>,
|
||||
node_path: Option<String>,
|
||||
mesh: gltf::Mesh<'_>,
|
||||
transform: Mat4,
|
||||
skinned: bool,
|
||||
parts: &mut Vec<StaticMeshPart>,
|
||||
) {
|
||||
let mesh_index = mesh.index();
|
||||
@@ -359,9 +460,11 @@ fn collect_gltf_mesh_parts(
|
||||
.clone()
|
||||
.or_else(|| mesh_name.clone())
|
||||
.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 {
|
||||
id: part_id_from_label(&mesh_label),
|
||||
id: gltf_draw_id(node_index, mesh_index, primitive_index),
|
||||
name: format!("{name} / Primitive {primitive_index}"),
|
||||
material_id: material_label
|
||||
.as_ref()
|
||||
@@ -373,6 +476,7 @@ fn collect_gltf_mesh_parts(
|
||||
source_node,
|
||||
source_mesh: Some(format!("Mesh{mesh_index}")),
|
||||
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() {
|
||||
continue;
|
||||
}
|
||||
let skinned = !mesh.skin_deformers.as_ref().is_empty();
|
||||
|
||||
let mut groups: Vec<(usize, Vec<u32>)> =
|
||||
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();
|
||||
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}"),
|
||||
material_id: material_label
|
||||
.as_ref()
|
||||
@@ -440,19 +545,20 @@ fn build_fbx_manifest(
|
||||
source_node: Some(format!("Node{node_index}")),
|
||||
source_mesh: Some(format!("Mesh{node_index}")),
|
||||
source_material: Some(material_name),
|
||||
skinned,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if !scene.anim_stacks.as_ref().is_empty() {
|
||||
warnings.push(
|
||||
"Animations are recorded as metadata; use Scene Instance placement for playback."
|
||||
"Animations are recorded as metadata; animated placement uses SkinnedMeshRenderer."
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
if !scene.skin_deformers.as_ref().is_empty() {
|
||||
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(),
|
||||
);
|
||||
}
|
||||
@@ -554,6 +660,7 @@ fn resolve_dependency(source_path: &str, uri: &str) -> String {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::asset_db::AssetId;
|
||||
|
||||
fn test_manifest() -> StaticMeshManifest {
|
||||
StaticMeshManifest {
|
||||
@@ -597,6 +704,7 @@ mod tests {
|
||||
source_node: Some("Node0".into()),
|
||||
source_mesh: Some("Mesh0".into()),
|
||||
source_material: Some("Wood".into()),
|
||||
skinned: false,
|
||||
}],
|
||||
warnings: Vec::new(),
|
||||
}
|
||||
@@ -645,4 +753,48 @@ mod tests {
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -188,18 +188,24 @@ impl AssetThumbnailCache {
|
||||
{
|
||||
return;
|
||||
}
|
||||
let material = match shared::MaterialAsset::load_from_path(&path) {
|
||||
Ok(asset) => asset,
|
||||
let material = match shared::load_resolved_material_from_path(&path) {
|
||||
Ok((material, _)) => material,
|
||||
Err(error) => {
|
||||
self.mark_studio_failed(&key, &error, true);
|
||||
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(
|
||||
key.clone(),
|
||||
ThumbnailJobSource::MaterialAsset {
|
||||
label: material.label.clone(),
|
||||
material: Box::new(material.material),
|
||||
label,
|
||||
material: Box::new(material),
|
||||
},
|
||||
) {
|
||||
self.studio_pending.insert(key);
|
||||
@@ -482,6 +488,37 @@ pub fn prefetch_folder_thumbnails(world: &mut World, folder: &str) {
|
||||
.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) {
|
||||
world.resource_mut::<AssetThumbnailCache>().invalidate_all();
|
||||
if !world.contains_resource::<ThumbnailStudio>() {
|
||||
|
||||
@@ -8,8 +8,9 @@ mod sources;
|
||||
mod studio;
|
||||
|
||||
pub use cache::{
|
||||
draw_asset_cell_with, invalidate_on_catalog_refresh, kind_icon, prefetch_folder_thumbnails,
|
||||
AssetThumbnailCache, AssetThumbnailsPlugin, ThumbnailCacheSnapshot, ThumbnailState,
|
||||
draw_asset_cell_with, invalidate_on_catalog_refresh, kind_icon, prefetch_asset_thumbnails,
|
||||
prefetch_folder_thumbnails, AssetThumbnailCache, AssetThumbnailsPlugin, ThumbnailCacheSnapshot,
|
||||
ThumbnailState,
|
||||
};
|
||||
pub use job::{ThumbnailJob, ThumbnailJobSource};
|
||||
pub use sources::{
|
||||
|
||||
@@ -21,6 +21,10 @@ use crate::infra::EditorOnly;
|
||||
|
||||
pub(crate) const THUMB_SIZE: u32 = 128;
|
||||
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 POST_ATTACH_FRAMES: u8 = 8;
|
||||
const RENDER_FRAMES: u8 = 3;
|
||||
@@ -61,6 +65,25 @@ struct ActiveModelThumbnail {
|
||||
framed: bool,
|
||||
frames_remaining: u8,
|
||||
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;
|
||||
@@ -143,7 +166,7 @@ fn setup_thumbnail_studio(mut commands: Commands, mut images: ResMut<Assets<Imag
|
||||
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),
|
||||
Projection::Perspective(PerspectiveProjection {
|
||||
fov: 40.0_f32.to_radians(),
|
||||
fov: THUMBNAIL_VERTICAL_FOV,
|
||||
..default()
|
||||
}),
|
||||
))
|
||||
@@ -229,6 +252,7 @@ fn process_thumbnail_studio(
|
||||
&mesh3d,
|
||||
&mesh_storage,
|
||||
&mut camera_transforms,
|
||||
active.framing,
|
||||
) {
|
||||
active.framed = true;
|
||||
active.post_attach_frames = 0;
|
||||
@@ -322,6 +346,7 @@ fn process_thumbnail_studio(
|
||||
.id();
|
||||
|
||||
let label = job.source.label().to_string();
|
||||
let framing = ThumbnailFraming::for_source(&job.source);
|
||||
let content_spawned = spawn_thumbnail_job_content(
|
||||
&mut commands,
|
||||
&mut mesh_storage,
|
||||
@@ -350,6 +375,7 @@ fn process_thumbnail_studio(
|
||||
framed: false,
|
||||
frames_remaining: 0,
|
||||
wait_frames: 0,
|
||||
framing,
|
||||
},
|
||||
"no renderable meshes",
|
||||
true,
|
||||
@@ -369,6 +395,7 @@ fn process_thumbnail_studio(
|
||||
framed: false,
|
||||
frames_remaining: 0,
|
||||
wait_frames: 0,
|
||||
framing,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -588,6 +615,7 @@ fn frame_thumbnail_scene(
|
||||
meshes: &Query<&Mesh3d>,
|
||||
mesh_assets: &Assets<Mesh>,
|
||||
camera_transforms: &mut Query<&mut Transform, With<ThumbnailStudioCamera>>,
|
||||
framing: ThumbnailFraming,
|
||||
) -> bool {
|
||||
let mut entities = Vec::new();
|
||||
collect_descendants(root, children, &mut entities);
|
||||
@@ -633,8 +661,7 @@ fn frame_thumbnail_scene(
|
||||
}
|
||||
|
||||
let center = (min + max) * 0.5;
|
||||
let radius = (max - min).length().max(0.25) * 0.5;
|
||||
let distance = radius / (20.0_f32.to_radians()).tan() * 1.35;
|
||||
let distance = thumbnail_camera_distance(min, max, framing);
|
||||
let eye = center + Vec3::new(1.0, 0.75, 1.0).normalize() * distance;
|
||||
|
||||
if let Ok(mut transform) = camera_transforms.single_mut() {
|
||||
@@ -644,6 +671,20 @@ fn frame_thumbnail_scene(
|
||||
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>) {
|
||||
out.push(entity);
|
||||
let Ok(child_list) = children.get(entity) else {
|
||||
@@ -673,3 +714,24 @@ fn aabb_corners(aabb: &Aabb3d) -> [Vec3; 8] {
|
||||
pub fn model_file_exists(catalog_path: &str) -> bool {
|
||||
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));
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,10 @@ use std::path::PathBuf;
|
||||
use bevy::prelude::*;
|
||||
use shared::{
|
||||
ActorId, ActorKind, ActorName, AnimationControllerDesc, AudioListenerDesc, AudioSourceDesc,
|
||||
BrushDesc, ColliderDesc, EditorVisibility, InspectorOrder, LightDesc, MaterialDesc,
|
||||
MaterialOverride, ModelRef, ObjectiveMarker, PhysicsBody, PostProcessVolumeDesc,
|
||||
PrefabInstance, PrefabRef, Primitive, RigidBodyDesc, SceneComposition, StaticMeshRenderer,
|
||||
AuthoringComponentStates, BrushDesc, ColliderDesc, EditorVisibility, InspectorOrder, LightDesc,
|
||||
MaterialDesc, MaterialOverride, ModelRef, NavigationArea, NavigationBounds, NavigationLink,
|
||||
NavigationObstacle, ObjectiveMarker, PhysicsBody, PostProcessVolumeDesc, PrefabInstance,
|
||||
PrefabRef, Primitive, RigidBodyDesc, SceneComposition, SkinnedMeshRenderer, StaticMeshRenderer,
|
||||
TeamSpawn, TriggerVolume, WeaponSpawn,
|
||||
};
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -18,6 +19,7 @@ pub struct EditorEntitySnapshot {
|
||||
pub primitive: Option<Primitive>,
|
||||
pub brush: Option<BrushDesc>,
|
||||
pub static_mesh_renderer: Option<StaticMeshRenderer>,
|
||||
pub skinned_mesh_renderer: Option<SkinnedMeshRenderer>,
|
||||
pub material: Option<MaterialDesc>,
|
||||
pub material_override: Option<MaterialOverride>,
|
||||
pub rigid_body: Option<RigidBodyDesc>,
|
||||
@@ -36,11 +38,52 @@ pub struct EditorEntitySnapshot {
|
||||
pub post_process_volume: Option<PostProcessVolumeDesc>,
|
||||
pub team_spawn: Option<TeamSpawn>,
|
||||
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 editor_visibility: EditorVisibility,
|
||||
pub inspector_order: Option<InspectorOrder>,
|
||||
pub component_states: Option<AuthoringComponentStates>,
|
||||
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)]
|
||||
pub struct SiblingChange {
|
||||
pub entity: Entity,
|
||||
@@ -174,6 +217,11 @@ pub enum EditorCommand {
|
||||
old: Option<PostProcessVolumeDesc>,
|
||||
new: PostProcessVolumeDesc,
|
||||
},
|
||||
SetNavigation {
|
||||
entity: Entity,
|
||||
old: NavigationComponentState,
|
||||
new: NavigationComponentState,
|
||||
},
|
||||
SetTransformGroup {
|
||||
entities: Vec<Entity>,
|
||||
olds: Vec<Transform>,
|
||||
@@ -239,6 +287,7 @@ pub enum EditorCommand {
|
||||
entity: Entity,
|
||||
snapshot: EditorEntitySnapshot,
|
||||
},
|
||||
ComponentTransaction(ComponentTransaction),
|
||||
}
|
||||
|
||||
impl EditorCommand {
|
||||
@@ -266,6 +315,7 @@ impl EditorCommand {
|
||||
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",
|
||||
@@ -283,6 +333,7 @@ impl EditorCommand {
|
||||
} => "Unpack Prefab Layer",
|
||||
EditorCommand::AddComponent { .. } => "Add Component",
|
||||
EditorCommand::RemoveComponent { .. } => "Remove Component",
|
||||
EditorCommand::ComponentTransaction(transaction) => transaction.label,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,20 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
use bevy::ecs::reflect::ReflectComponent;
|
||||
use bevy::prelude::*;
|
||||
use bevy::reflect::serde::{TypedReflectDeserializer, TypedReflectSerializer};
|
||||
use bevy::reflect::std_traits::ReflectDefault;
|
||||
use bevy::world_serialization::WorldInstance;
|
||||
use serde::de::DeserializeSeed;
|
||||
use shared::{
|
||||
infer_actor_kind, ActorId, ActorKind, ActorName, AnimationControllerDesc, AudioListenerDesc,
|
||||
AudioSourceDesc, BrushDesc, ColliderDesc, EditorVisibility, HierarchySiblingIndex,
|
||||
HydratedPrefabMember, HydratedPrefabReady, InspectorOrder, LevelObject, LightDesc,
|
||||
MaterialDesc, MaterialOverride, ModelRef, ObjectiveMarker, PhysicsBody, PlayerSpawn,
|
||||
AudioSourceDesc, AuthoringComponentStates, BrushDesc, ColliderDesc, EditorVisibility,
|
||||
HierarchySiblingIndex, HydratedPrefabMember, HydratedPrefabReady, InspectorOrder, LevelObject,
|
||||
LightDesc, MaterialDesc, MaterialOverride, ModelRef, NavigationArea, NavigationBounds,
|
||||
NavigationLink, NavigationObstacle, ObjectiveMarker, PhysicsBody, PlayerSpawn,
|
||||
PostProcessVolumeDesc, PrefabHydrationBlocked, PrefabInstance, PrefabRef, Primitive,
|
||||
RigidBodyDesc, SceneComposition, StaticMeshRenderer, TeamSpawn, TriggerVolume, WeaponSpawn,
|
||||
RigidBodyDesc, SceneComposition, SkinnedMeshRenderer, StaticMeshRenderer, TeamSpawn,
|
||||
TriggerVolume, WeaponSpawn,
|
||||
};
|
||||
|
||||
use crate::scene_io::{SceneIo, SceneIoRequest};
|
||||
@@ -22,7 +28,10 @@ use crate::ui::selection_ops::is_mutable_level_object;
|
||||
use crate::ui::{egui_captures_keyboard_from_world, UiState};
|
||||
|
||||
mod commands;
|
||||
pub use commands::{EditorCommand, EditorEntitySnapshot, PrefabEditState, SiblingChange};
|
||||
pub use commands::{
|
||||
ComponentDelta, ComponentTransaction, EditorCommand, EditorEntitySnapshot,
|
||||
NavigationComponentState, PrefabEditState, ReflectedComponentValue, SiblingChange,
|
||||
};
|
||||
|
||||
#[derive(Resource, Debug, Default)]
|
||||
pub struct EditorHistory {
|
||||
@@ -138,6 +147,7 @@ pub fn snapshot_entity(world: &World, entity: Entity) -> Option<EditorEntitySnap
|
||||
primitive: entity_ref.get::<Primitive>().cloned(),
|
||||
brush: entity_ref.get::<BrushDesc>().cloned(),
|
||||
static_mesh_renderer: entity_ref.get::<StaticMeshRenderer>().cloned(),
|
||||
skinned_mesh_renderer: entity_ref.get::<SkinnedMeshRenderer>().cloned(),
|
||||
material: entity_ref.get::<MaterialDesc>().cloned(),
|
||||
material_override: entity_ref.get::<MaterialOverride>().cloned(),
|
||||
rigid_body: entity_ref.get::<RigidBodyDesc>().cloned(),
|
||||
@@ -156,6 +166,10 @@ pub fn snapshot_entity(world: &World, entity: Entity) -> Option<EditorEntitySnap
|
||||
post_process_volume: entity_ref.get::<PostProcessVolumeDesc>().cloned(),
|
||||
team_spawn: entity_ref.get::<TeamSpawn>().cloned(),
|
||||
objective: entity_ref.get::<ObjectiveMarker>().cloned(),
|
||||
navigation_bounds: entity_ref.get::<NavigationBounds>().cloned(),
|
||||
navigation_obstacle: entity_ref.get::<NavigationObstacle>().cloned(),
|
||||
navigation_area: entity_ref.get::<NavigationArea>().cloned(),
|
||||
navigation_link: entity_ref.get::<NavigationLink>().cloned(),
|
||||
hierarchy_sibling_index: entity_ref
|
||||
.get::<HierarchySiblingIndex>()
|
||||
.map(|index| index.0)
|
||||
@@ -164,6 +178,8 @@ pub fn snapshot_entity(world: &World, entity: Entity) -> Option<EditorEntitySnap
|
||||
.get::<EditorVisibility>()
|
||||
.copied()
|
||||
.unwrap_or_default(),
|
||||
inspector_order: entity_ref.get::<InspectorOrder>().cloned(),
|
||||
component_states: entity_ref.get::<AuthoringComponentStates>().cloned(),
|
||||
children,
|
||||
})
|
||||
}
|
||||
@@ -204,6 +220,9 @@ fn spawn_snapshot_with_parent(
|
||||
if let Some(renderer) = &snapshot.static_mesh_renderer {
|
||||
entity_mut.insert(renderer.clone());
|
||||
}
|
||||
if let Some(renderer) = &snapshot.skinned_mesh_renderer {
|
||||
entity_mut.insert(renderer.clone());
|
||||
}
|
||||
if let Some(material) = &snapshot.material {
|
||||
entity_mut.insert(material.clone());
|
||||
}
|
||||
@@ -258,8 +277,26 @@ fn spawn_snapshot_with_parent(
|
||||
if let Some(objective) = &snapshot.objective {
|
||||
entity_mut.insert(objective.clone());
|
||||
}
|
||||
if let Some(bounds) = &snapshot.navigation_bounds {
|
||||
entity_mut.insert(bounds.clone());
|
||||
}
|
||||
if let Some(obstacle) = &snapshot.navigation_obstacle {
|
||||
entity_mut.insert(obstacle.clone());
|
||||
}
|
||||
if let Some(area) = &snapshot.navigation_area {
|
||||
entity_mut.insert(area.clone());
|
||||
}
|
||||
if let Some(link) = &snapshot.navigation_link {
|
||||
entity_mut.insert(link.clone());
|
||||
}
|
||||
entity_mut.insert(HierarchySiblingIndex(snapshot.hierarchy_sibling_index));
|
||||
entity_mut.insert(snapshot.editor_visibility);
|
||||
if let Some(order) = &snapshot.inspector_order {
|
||||
entity_mut.insert(order.clone());
|
||||
}
|
||||
if let Some(states) = &snapshot.component_states {
|
||||
entity_mut.insert(states.clone());
|
||||
}
|
||||
if let Some(parent) = parent {
|
||||
entity_mut.insert(ChildOf(parent));
|
||||
}
|
||||
@@ -282,6 +319,7 @@ pub fn clear_level_objects(world: &mut World) {
|
||||
}
|
||||
|
||||
pub fn spawn_with_history(world: &mut World, mut snapshot: EditorEntitySnapshot) -> Entity {
|
||||
assign_missing_actor_ids(&mut snapshot);
|
||||
snapshot.hierarchy_sibling_index = next_sibling_index(world, None);
|
||||
let entity = spawn_snapshot(world, &snapshot);
|
||||
push_history(
|
||||
@@ -303,6 +341,9 @@ pub fn spawn_many_with_history(
|
||||
if snapshots.is_empty() {
|
||||
return Vec::new();
|
||||
}
|
||||
for snapshot in &mut snapshots {
|
||||
assign_missing_actor_ids(snapshot);
|
||||
}
|
||||
for (sibling_index, snapshot) in (next_sibling_index(world, None)..).zip(snapshots.iter_mut()) {
|
||||
snapshot.hierarchy_sibling_index = sibling_index;
|
||||
}
|
||||
@@ -384,12 +425,37 @@ pub fn duplicate_entities_with_history(world: &mut World, entities: &[Entity]) {
|
||||
}
|
||||
|
||||
fn assign_fresh_actor_ids(snapshot: &mut EditorEntitySnapshot) {
|
||||
snapshot.actor_id = Some(new_actor_id());
|
||||
let actor_id = new_actor_id();
|
||||
if let Some(bounds) = &mut snapshot.navigation_bounds {
|
||||
bounds.artifact_path = shared::navigation_artifact_path_for_actor(&actor_id.0);
|
||||
}
|
||||
snapshot.actor_id = Some(actor_id);
|
||||
for child in &mut snapshot.children {
|
||||
assign_fresh_actor_ids(child);
|
||||
}
|
||||
}
|
||||
|
||||
fn assign_missing_actor_ids(snapshot: &mut EditorEntitySnapshot) {
|
||||
let existing_actor_id = snapshot
|
||||
.actor_id
|
||||
.clone()
|
||||
.filter(|id| !id.0.trim().is_empty());
|
||||
let assigned_new_id = existing_actor_id.is_none();
|
||||
let actor_id = existing_actor_id.unwrap_or_else(new_actor_id);
|
||||
if let Some(bounds) = &mut snapshot.navigation_bounds {
|
||||
if assigned_new_id
|
||||
|| bounds.artifact_path == NavigationBounds::default().artifact_path
|
||||
|| shared::navigation_generated_artifact_path(&bounds.artifact_path).is_err()
|
||||
{
|
||||
bounds.artifact_path = shared::navigation_artifact_path_for_actor(&actor_id.0);
|
||||
}
|
||||
}
|
||||
snapshot.actor_id = Some(actor_id);
|
||||
for child in &mut snapshot.children {
|
||||
assign_missing_actor_ids(child);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rename_entity_with_history(world: &mut World, entity: Entity, new_name: String) {
|
||||
if !is_mutable_level_object(world, entity) {
|
||||
return;
|
||||
@@ -561,6 +627,31 @@ pub fn set_post_process_volume_with_history(
|
||||
);
|
||||
}
|
||||
|
||||
pub fn navigation_component_state(world: &World, entity: Entity) -> NavigationComponentState {
|
||||
NavigationComponentState {
|
||||
bounds: world.get::<NavigationBounds>(entity).cloned(),
|
||||
obstacle: world.get::<NavigationObstacle>(entity).cloned(),
|
||||
area: world.get::<NavigationArea>(entity).cloned(),
|
||||
link: world.get::<NavigationLink>(entity).cloned(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_navigation_with_history(
|
||||
world: &mut World,
|
||||
entity: Entity,
|
||||
new: NavigationComponentState,
|
||||
) {
|
||||
if !is_mutable_level_object(world, entity) {
|
||||
return;
|
||||
}
|
||||
let old = navigation_component_state(world, entity);
|
||||
if old == new {
|
||||
return;
|
||||
}
|
||||
apply_navigation_state(world, entity, &new);
|
||||
push_history(world, EditorCommand::SetNavigation { entity, old, new });
|
||||
}
|
||||
|
||||
pub fn set_physics_with_history(world: &mut World, entity: Entity, new: PhysicsBody) {
|
||||
if !is_mutable_level_object(world, entity) {
|
||||
return;
|
||||
@@ -818,6 +909,7 @@ pub fn group_selection_with_history(world: &mut World, entities: &[Entity]) {
|
||||
primitive: None,
|
||||
brush: None,
|
||||
static_mesh_renderer: None,
|
||||
skinned_mesh_renderer: None,
|
||||
material: None,
|
||||
material_override: None,
|
||||
rigid_body: None,
|
||||
@@ -836,8 +928,18 @@ pub fn group_selection_with_history(world: &mut World, entities: &[Entity]) {
|
||||
post_process_volume: None,
|
||||
team_spawn: None,
|
||||
objective: None,
|
||||
|
||||
navigation_bounds: None,
|
||||
|
||||
navigation_obstacle: None,
|
||||
|
||||
navigation_area: None,
|
||||
|
||||
navigation_link: None,
|
||||
hierarchy_sibling_index: next_sibling_index(world, None),
|
||||
editor_visibility: EditorVisibility::default(),
|
||||
inspector_order: None,
|
||||
component_states: None,
|
||||
children: Vec::new(),
|
||||
};
|
||||
let group = spawn_snapshot(world, &snapshot);
|
||||
@@ -868,6 +970,7 @@ pub fn create_empty_child_with_history(world: &mut World, parent: Entity) {
|
||||
primitive: None,
|
||||
brush: None,
|
||||
static_mesh_renderer: None,
|
||||
skinned_mesh_renderer: None,
|
||||
material: None,
|
||||
material_override: None,
|
||||
rigid_body: None,
|
||||
@@ -886,8 +989,18 @@ pub fn create_empty_child_with_history(world: &mut World, parent: Entity) {
|
||||
post_process_volume: None,
|
||||
team_spawn: None,
|
||||
objective: None,
|
||||
|
||||
navigation_bounds: None,
|
||||
|
||||
navigation_obstacle: None,
|
||||
|
||||
navigation_area: None,
|
||||
|
||||
navigation_link: None,
|
||||
hierarchy_sibling_index: next_sibling_index(world, Some(parent)),
|
||||
editor_visibility: EditorVisibility::default(),
|
||||
inspector_order: None,
|
||||
component_states: None,
|
||||
children: Vec::new(),
|
||||
};
|
||||
let entity = spawn_snapshot_with_parent(world, &snapshot, Some(parent));
|
||||
@@ -1235,6 +1348,207 @@ pub fn apply_actor_kind(world: &mut World, entity: Entity, kind: ActorKind) {
|
||||
}
|
||||
}
|
||||
|
||||
pub const ACTOR_KIND_COMPONENT_ID: &str = "core.actor_kind";
|
||||
pub const ACTOR_KIND_TYPE_PATH: &str = "shared::components::ActorKind";
|
||||
|
||||
/// Captures any reflected component without adding a typed history branch.
|
||||
pub fn capture_reflected_component(
|
||||
world: &World,
|
||||
entity: Entity,
|
||||
component_id: &str,
|
||||
type_path: &str,
|
||||
) -> Result<Option<ReflectedComponentValue>, String> {
|
||||
let entity_ref = world
|
||||
.get_entity(entity)
|
||||
.map_err(|_| format!("entity {entity:?} no longer exists"))?;
|
||||
let app_registry = world
|
||||
.get_resource::<AppTypeRegistry>()
|
||||
.ok_or_else(|| "AppTypeRegistry is unavailable".to_string())?;
|
||||
let type_registry = app_registry.read();
|
||||
let registration = type_registry
|
||||
.get_with_type_path(type_path)
|
||||
.ok_or_else(|| format!("component type `{type_path}` is not registered"))?;
|
||||
let reflect_component = registration
|
||||
.data::<ReflectComponent>()
|
||||
.ok_or_else(|| format!("component `{type_path}` has no ReflectComponent adapter"))?;
|
||||
let Some(value) = reflect_component.reflect(entity_ref) else {
|
||||
return Ok(None);
|
||||
};
|
||||
let ron = ron::ser::to_string(&TypedReflectSerializer::new(value, &type_registry))
|
||||
.map_err(|error| format!("could not serialize `{type_path}`: {error}"))?;
|
||||
Ok(Some(ReflectedComponentValue {
|
||||
component_id: component_id.to_string(),
|
||||
type_path: type_path.to_string(),
|
||||
ron,
|
||||
}))
|
||||
}
|
||||
|
||||
/// Applies or removes one reflected component value.
|
||||
pub fn apply_reflected_component(
|
||||
world: &mut World,
|
||||
entity: Entity,
|
||||
type_path: &str,
|
||||
value: Option<&ReflectedComponentValue>,
|
||||
) -> Result<(), String> {
|
||||
if world.get_entity(entity).is_err() {
|
||||
return Err(format!("entity {entity:?} no longer exists"));
|
||||
}
|
||||
world.resource_scope(|world, app_registry: Mut<AppTypeRegistry>| {
|
||||
let type_registry = app_registry.read();
|
||||
let registration = type_registry
|
||||
.get_with_type_path(type_path)
|
||||
.ok_or_else(|| format!("component type `{type_path}` is not registered"))?;
|
||||
let reflect_component = registration
|
||||
.data::<ReflectComponent>()
|
||||
.cloned()
|
||||
.ok_or_else(|| format!("component `{type_path}` has no ReflectComponent adapter"))?;
|
||||
match value {
|
||||
Some(value) => {
|
||||
if value.type_path != type_path {
|
||||
return Err(format!(
|
||||
"clipboard type `{}` does not match `{type_path}`",
|
||||
value.type_path
|
||||
));
|
||||
}
|
||||
let mut deserializer = ron::de::Deserializer::from_str(&value.ron)
|
||||
.map_err(|error| error.to_string())?;
|
||||
let reflected = TypedReflectDeserializer::new(registration, &type_registry)
|
||||
.deserialize(&mut deserializer)
|
||||
.map_err(|error| error.to_string())?;
|
||||
// Reflected `apply` merges list fields and cannot restore a shorter snapshot.
|
||||
// Inserting the captured concrete component replaces the value atomically.
|
||||
reflect_component.insert(
|
||||
&mut world.entity_mut(entity),
|
||||
reflected.as_ref(),
|
||||
&type_registry,
|
||||
);
|
||||
}
|
||||
None => reflect_component.remove(&mut world.entity_mut(entity)),
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
/// Inserts the reflected `Default` for a registered authoring component.
|
||||
pub fn apply_reflected_default(
|
||||
world: &mut World,
|
||||
entity: Entity,
|
||||
type_path: &str,
|
||||
) -> Result<(), String> {
|
||||
world.resource_scope(|world, app_registry: Mut<AppTypeRegistry>| {
|
||||
let type_registry = app_registry.read();
|
||||
let registration = type_registry
|
||||
.get_with_type_path(type_path)
|
||||
.ok_or_else(|| format!("component type `{type_path}` is not registered"))?;
|
||||
let reflect_component = registration
|
||||
.data::<ReflectComponent>()
|
||||
.cloned()
|
||||
.ok_or_else(|| format!("component `{type_path}` has no ReflectComponent adapter"))?;
|
||||
let default = registration
|
||||
.data::<ReflectDefault>()
|
||||
.ok_or_else(|| format!("component `{type_path}` has no reflected Default"))?
|
||||
.default();
|
||||
reflect_component.insert(
|
||||
&mut world.entity_mut(entity),
|
||||
default.as_ref(),
|
||||
&type_registry,
|
||||
);
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
||||
pub fn sync_actor_kind_hint(world: &mut World, entity: Entity) {
|
||||
let kind = world
|
||||
.get_entity(entity)
|
||||
.ok()
|
||||
.and_then(infer_actor_kind)
|
||||
.unwrap_or(ActorKind::Empty);
|
||||
if let Ok(mut entity_mut) = world.get_entity_mut(entity) {
|
||||
entity_mut.insert(kind);
|
||||
}
|
||||
}
|
||||
|
||||
/// Executes one atomic reflected component edit and records all changed values,
|
||||
/// including the derived ActorKind presentation hint, as a single history item.
|
||||
pub fn reflected_component_transaction(
|
||||
world: &mut World,
|
||||
entity: Entity,
|
||||
label: &'static str,
|
||||
component_id: &str,
|
||||
type_path: &str,
|
||||
edit: impl FnOnce(&mut World, Entity) -> Result<(), String>,
|
||||
) -> Result<(), String> {
|
||||
if !is_mutable_level_object(world, entity) {
|
||||
return Err("actor is not editable".to_string());
|
||||
}
|
||||
let tracked = [
|
||||
(component_id, type_path),
|
||||
(ACTOR_KIND_COMPONENT_ID, ACTOR_KIND_TYPE_PATH),
|
||||
];
|
||||
let before = tracked
|
||||
.iter()
|
||||
.map(|(id, path)| capture_reflected_component(world, entity, id, path))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
if let Err(error) = edit(world, entity) {
|
||||
for ((_, path), value) in tracked.iter().zip(before.iter()) {
|
||||
let _ = apply_reflected_component(world, entity, path, value.as_ref());
|
||||
}
|
||||
return Err(error);
|
||||
}
|
||||
sync_actor_kind_hint(world, entity);
|
||||
let after = tracked
|
||||
.iter()
|
||||
.map(|(id, path)| capture_reflected_component(world, entity, id, path))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
let deltas = tracked
|
||||
.iter()
|
||||
.zip(before)
|
||||
.zip(after)
|
||||
.filter_map(|(((id, path), before), after)| {
|
||||
(before != after).then(|| ComponentDelta {
|
||||
component_id: (*id).to_string(),
|
||||
type_path: (*path).to_string(),
|
||||
before,
|
||||
after,
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
if !deltas.is_empty() {
|
||||
push_history(
|
||||
world,
|
||||
EditorCommand::ComponentTransaction(ComponentTransaction {
|
||||
entity,
|
||||
label,
|
||||
deltas,
|
||||
}),
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn apply_component_transaction(
|
||||
world: &mut World,
|
||||
transaction: &ComponentTransaction,
|
||||
use_after: bool,
|
||||
) {
|
||||
for delta in &transaction.deltas {
|
||||
let value = if use_after {
|
||||
delta.after.as_ref()
|
||||
} else {
|
||||
delta.before.as_ref()
|
||||
};
|
||||
if let Err(error) =
|
||||
apply_reflected_component(world, transaction.entity, &delta.type_path, value)
|
||||
{
|
||||
world.resource_mut::<EditorHistory>().status = format!(
|
||||
"{} partially failed for {}: {error}",
|
||||
transaction.label, delta.component_id
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_scene_composition_with_history(world: &mut World, new: SceneComposition) {
|
||||
let old = world.resource::<SceneComposition>().clone();
|
||||
if old == new {
|
||||
@@ -1248,7 +1562,7 @@ pub fn set_scene_composition_with_history(world: &mut World, new: SceneCompositi
|
||||
pub fn apply_command_undo(world: &mut World) {
|
||||
let candidate = world.resource::<EditorHistory>().undo_stack.last().cloned();
|
||||
if let Some(candidate) = candidate {
|
||||
if let Err(error) = prepare_prefab_source_history(&candidate, true) {
|
||||
if let Err(error) = prepare_prefab_source_history(world, &candidate, true) {
|
||||
world.resource_mut::<EditorHistory>().status = format!("Undo blocked: {error}");
|
||||
world
|
||||
.resource_mut::<SceneIo>()
|
||||
@@ -1269,7 +1583,7 @@ pub fn apply_command_undo(world: &mut World) {
|
||||
pub fn apply_command_redo(world: &mut World) {
|
||||
let candidate = world.resource::<EditorHistory>().redo_stack.last().cloned();
|
||||
if let Some(candidate) = candidate {
|
||||
if let Err(error) = prepare_prefab_source_history(&candidate, false) {
|
||||
if let Err(error) = prepare_prefab_source_history(world, &candidate, false) {
|
||||
world.resource_mut::<EditorHistory>().status = format!("Redo blocked: {error}");
|
||||
world
|
||||
.resource_mut::<SceneIo>()
|
||||
@@ -1287,8 +1601,13 @@ pub fn apply_command_redo(world: &mut World) {
|
||||
mark_dirty(world);
|
||||
}
|
||||
|
||||
fn prepare_prefab_source_history(command: &EditorCommand, undo: bool) -> Result<(), String> {
|
||||
fn prepare_prefab_source_history(
|
||||
world: &mut World,
|
||||
command: &EditorCommand,
|
||||
undo: bool,
|
||||
) -> Result<(), String> {
|
||||
let EditorCommand::ApplyPrefabToSource {
|
||||
entity,
|
||||
source_path,
|
||||
before_source,
|
||||
after_source,
|
||||
@@ -1302,15 +1621,18 @@ fn prepare_prefab_source_history(command: &EditorCommand, undo: bool) -> Result<
|
||||
} else {
|
||||
(before_source, after_source)
|
||||
};
|
||||
let current = std::fs::read_to_string(source_path)
|
||||
.map_err(|error| format!("could not read {}: {error}", source_path.display()))?;
|
||||
if ¤t != expected {
|
||||
return Err(format!(
|
||||
"{} changed outside this history command",
|
||||
source_path.display()
|
||||
));
|
||||
}
|
||||
crate::scene::recovery::atomic_write(source_path, replacement.as_bytes())
|
||||
let expected =
|
||||
crate::collaboration::FileSnapshot::from_loaded_bytes(source_path, expected.as_bytes());
|
||||
crate::collaboration::publish_authored_file(
|
||||
world,
|
||||
source_path,
|
||||
replacement.as_bytes(),
|
||||
&expected,
|
||||
crate::collaboration::FileWriteIntent::PrefabSourceHistory {
|
||||
instance_root: *entity,
|
||||
},
|
||||
)
|
||||
.map(|_| ())
|
||||
}
|
||||
|
||||
fn undo_command(world: &mut World, command: &mut EditorCommand) {
|
||||
@@ -1372,6 +1694,9 @@ fn undo_command(world: &mut World, command: &mut EditorCommand) {
|
||||
EditorCommand::SetPostProcessVolume { entity, old, .. } => {
|
||||
apply_post_process_volume(world, *entity, old);
|
||||
}
|
||||
EditorCommand::SetNavigation { entity, old, .. } => {
|
||||
apply_navigation_state(world, *entity, old);
|
||||
}
|
||||
EditorCommand::SetPhysics { entity, old, .. } => {
|
||||
apply_physics(world, *entity, old);
|
||||
}
|
||||
@@ -1485,6 +1810,9 @@ fn undo_command(world: &mut World, command: &mut EditorCommand) {
|
||||
EditorCommand::RemoveComponent { entity, snapshot } => {
|
||||
apply_authored_components(world, *entity, snapshot);
|
||||
}
|
||||
EditorCommand::ComponentTransaction(transaction) => {
|
||||
apply_component_transaction(world, transaction, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1573,6 +1901,9 @@ fn redo_command(world: &mut World, command: &mut EditorCommand) {
|
||||
entity_mut.insert(new.clone());
|
||||
}
|
||||
}
|
||||
EditorCommand::SetNavigation { entity, new, .. } => {
|
||||
apply_navigation_state(world, *entity, new);
|
||||
}
|
||||
EditorCommand::SetPhysics { entity, new, .. } => {
|
||||
if let Ok(mut entity_mut) = world.get_entity_mut(*entity) {
|
||||
entity_mut.insert(new.clone());
|
||||
@@ -1706,6 +2037,9 @@ fn redo_command(world: &mut World, command: &mut EditorCommand) {
|
||||
EditorCommand::RemoveComponent { entity, snapshot } => {
|
||||
remove_authored_components(world, *entity, snapshot);
|
||||
}
|
||||
EditorCommand::ComponentTransaction(transaction) => {
|
||||
apply_component_transaction(world, transaction, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1862,6 +2196,45 @@ fn apply_post_process_volume(
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_navigation_state(world: &mut World, entity: Entity, state: &NavigationComponentState) {
|
||||
let has_navigation = state.bounds.is_some()
|
||||
|| state.obstacle.is_some()
|
||||
|| state.area.is_some()
|
||||
|| state.link.is_some();
|
||||
if let Ok(mut entity_mut) = world.get_entity_mut(entity) {
|
||||
entity_mut
|
||||
.remove::<NavigationBounds>()
|
||||
.remove::<NavigationObstacle>()
|
||||
.remove::<NavigationArea>()
|
||||
.remove::<NavigationLink>();
|
||||
if let Some(value) = &state.bounds {
|
||||
entity_mut.insert(value.clone());
|
||||
}
|
||||
if let Some(value) = &state.obstacle {
|
||||
entity_mut.insert(value.clone());
|
||||
}
|
||||
if let Some(value) = &state.area {
|
||||
entity_mut.insert(value.clone());
|
||||
}
|
||||
if let Some(value) = &state.link {
|
||||
entity_mut.insert(value.clone());
|
||||
}
|
||||
if has_navigation {
|
||||
entity_mut.insert(ActorKind::Navigation);
|
||||
}
|
||||
}
|
||||
if !has_navigation {
|
||||
let fallback = world
|
||||
.get_entity(entity)
|
||||
.ok()
|
||||
.and_then(infer_actor_kind)
|
||||
.unwrap_or(ActorKind::Empty);
|
||||
if let Ok(mut entity_mut) = world.get_entity_mut(entity) {
|
||||
entity_mut.insert(fallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_physics(world: &mut World, entity: Entity, physics: &Option<PhysicsBody>) {
|
||||
if let Ok(mut entity_mut) = world.get_entity_mut(entity) {
|
||||
match physics {
|
||||
@@ -1986,6 +2359,9 @@ fn apply_authored_components(world: &mut World, entity: Entity, snapshot: &Edito
|
||||
if let Some(v) = &snapshot.static_mesh_renderer {
|
||||
entity_mut.insert(v.clone());
|
||||
}
|
||||
if let Some(v) = &snapshot.skinned_mesh_renderer {
|
||||
entity_mut.insert(v.clone());
|
||||
}
|
||||
if let Some(v) = &snapshot.material {
|
||||
entity_mut.insert(v.clone());
|
||||
}
|
||||
@@ -2040,6 +2416,24 @@ fn apply_authored_components(world: &mut World, entity: Entity, snapshot: &Edito
|
||||
if let Some(v) = &snapshot.objective {
|
||||
entity_mut.insert(v.clone());
|
||||
}
|
||||
if let Some(v) = &snapshot.navigation_bounds {
|
||||
entity_mut.insert(v.clone());
|
||||
}
|
||||
if let Some(v) = &snapshot.navigation_obstacle {
|
||||
entity_mut.insert(v.clone());
|
||||
}
|
||||
if let Some(v) = &snapshot.navigation_area {
|
||||
entity_mut.insert(v.clone());
|
||||
}
|
||||
if let Some(v) = &snapshot.navigation_link {
|
||||
entity_mut.insert(v.clone());
|
||||
}
|
||||
if let Some(v) = &snapshot.inspector_order {
|
||||
entity_mut.insert(v.clone());
|
||||
}
|
||||
if let Some(v) = &snapshot.component_states {
|
||||
entity_mut.insert(v.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2061,6 +2455,9 @@ fn remove_authored_components(world: &mut World, entity: Entity, snapshot: &Edit
|
||||
if snapshot.static_mesh_renderer.is_some() {
|
||||
entity_mut.remove::<StaticMeshRenderer>();
|
||||
}
|
||||
if snapshot.skinned_mesh_renderer.is_some() {
|
||||
entity_mut.remove::<SkinnedMeshRenderer>();
|
||||
}
|
||||
if snapshot.material.is_some() {
|
||||
entity_mut.remove::<MaterialDesc>();
|
||||
}
|
||||
@@ -2115,6 +2512,24 @@ fn remove_authored_components(world: &mut World, entity: Entity, snapshot: &Edit
|
||||
if snapshot.objective.is_some() {
|
||||
entity_mut.remove::<ObjectiveMarker>();
|
||||
}
|
||||
if snapshot.navigation_bounds.is_some() {
|
||||
entity_mut.remove::<NavigationBounds>();
|
||||
}
|
||||
if snapshot.navigation_obstacle.is_some() {
|
||||
entity_mut.remove::<NavigationObstacle>();
|
||||
}
|
||||
if snapshot.navigation_area.is_some() {
|
||||
entity_mut.remove::<NavigationArea>();
|
||||
}
|
||||
if snapshot.navigation_link.is_some() {
|
||||
entity_mut.remove::<NavigationLink>();
|
||||
}
|
||||
if snapshot.inspector_order.is_some() {
|
||||
entity_mut.remove::<InspectorOrder>();
|
||||
}
|
||||
if snapshot.component_states.is_some() {
|
||||
entity_mut.remove::<AuthoringComponentStates>();
|
||||
}
|
||||
}
|
||||
if removed_dedicated_audio_kind {
|
||||
let fallback = world
|
||||
@@ -2383,6 +2798,90 @@ mod tests {
|
||||
use crate::operators::test_harness::{assert_undo_redo_round_trip, OperatorInvariantHarness};
|
||||
use crate::operators::{ActiveOperator, OperatorPhase, OperatorStatus};
|
||||
|
||||
#[derive(Component, Reflect, Default, Debug, Clone, PartialEq)]
|
||||
#[reflect(Component, Default)]
|
||||
struct StaticExtensionFixture {
|
||||
value: u32,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reflected_extension_component_transaction_round_trips_atomically() {
|
||||
let mut app = App::new();
|
||||
app.register_type::<ActorKind>()
|
||||
.register_type::<StaticExtensionFixture>();
|
||||
let world = app.world_mut();
|
||||
world.init_resource::<EditorHistory>();
|
||||
world.init_resource::<SceneIo>();
|
||||
let entity = world
|
||||
.spawn((LevelObject, ActorKind::Light, Transform::default()))
|
||||
.id();
|
||||
let type_path = std::any::type_name::<StaticExtensionFixture>();
|
||||
|
||||
reflected_component_transaction(
|
||||
world,
|
||||
entity,
|
||||
"Add Fixture",
|
||||
"game.static_extension_fixture",
|
||||
type_path,
|
||||
|world, entity| {
|
||||
world
|
||||
.entity_mut(entity)
|
||||
.insert(StaticExtensionFixture { value: 42 });
|
||||
Ok(())
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
world.get::<StaticExtensionFixture>(entity).unwrap().value,
|
||||
42
|
||||
);
|
||||
assert_eq!(world.get::<ActorKind>(entity), Some(&ActorKind::Empty));
|
||||
assert_eq!(world.resource::<EditorHistory>().undo_depth(), 1);
|
||||
|
||||
apply_command_undo(world);
|
||||
assert!(world.get::<StaticExtensionFixture>(entity).is_none());
|
||||
assert_eq!(world.get::<ActorKind>(entity), Some(&ActorKind::Light));
|
||||
|
||||
apply_command_redo(world);
|
||||
assert_eq!(
|
||||
world.get::<StaticExtensionFixture>(entity).unwrap().value,
|
||||
42
|
||||
);
|
||||
assert_eq!(world.get::<ActorKind>(entity), Some(&ActorKind::Empty));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn snapshots_preserve_component_order_and_independent_active_state() {
|
||||
let mut world = World::new();
|
||||
let order = InspectorOrder {
|
||||
component_ids: vec![shared::AUTHORING_COMPONENT_LIGHT.to_string()],
|
||||
..Default::default()
|
||||
};
|
||||
let mut states = AuthoringComponentStates::default();
|
||||
states.set_component_active(shared::COMPONENT_LIGHT_DESC, false);
|
||||
let entity = world
|
||||
.spawn((
|
||||
LevelObject,
|
||||
ActorKind::Light,
|
||||
Transform::default(),
|
||||
LightDesc::default(),
|
||||
order.clone(),
|
||||
states.clone(),
|
||||
))
|
||||
.id();
|
||||
|
||||
let snapshot = snapshot_entity(&world, entity).unwrap();
|
||||
world.entity_mut(entity).despawn();
|
||||
let restored = spawn_snapshot(&mut world, &snapshot);
|
||||
|
||||
assert_eq!(world.get::<InspectorOrder>(restored), Some(&order));
|
||||
assert_eq!(
|
||||
world.get::<AuthoringComponentStates>(restored),
|
||||
Some(&states)
|
||||
);
|
||||
}
|
||||
|
||||
fn animation_controller(state_id: &str, crossfade_seconds: f32) -> AnimationControllerDesc {
|
||||
AnimationControllerDesc {
|
||||
skeleton: Some(
|
||||
@@ -2420,7 +2919,7 @@ mod tests {
|
||||
let entity = world
|
||||
.spawn((
|
||||
LevelObject,
|
||||
ActorKind::ImportedModel,
|
||||
ActorKind::SkinnedMesh,
|
||||
Transform::IDENTITY,
|
||||
old.clone(),
|
||||
))
|
||||
@@ -2439,6 +2938,36 @@ mod tests {
|
||||
assert_eq!(world.get::<AnimationControllerDesc>(entity), Some(&new));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn navigation_component_history_round_trips_and_preserves_kind() {
|
||||
let mut world = World::new();
|
||||
world.init_resource::<EditorHistory>();
|
||||
world.init_resource::<SceneIo>();
|
||||
let entity = world
|
||||
.spawn((LevelObject, ActorKind::Empty, Transform::IDENTITY))
|
||||
.id();
|
||||
let bounds = NavigationBounds::default();
|
||||
|
||||
set_navigation_with_history(
|
||||
&mut world,
|
||||
entity,
|
||||
NavigationComponentState {
|
||||
bounds: Some(bounds.clone()),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
assert_eq!(world.get::<NavigationBounds>(entity), Some(&bounds));
|
||||
assert_eq!(world.get::<ActorKind>(entity), Some(&ActorKind::Navigation));
|
||||
|
||||
apply_command_undo(&mut world);
|
||||
assert!(world.get::<NavigationBounds>(entity).is_none());
|
||||
assert_eq!(world.get::<ActorKind>(entity), Some(&ActorKind::Empty));
|
||||
|
||||
apply_command_redo(&mut world);
|
||||
assert_eq!(world.get::<NavigationBounds>(entity), Some(&bounds));
|
||||
assert_eq!(world.get::<ActorKind>(entity), Some(&ActorKind::Navigation));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn undoing_a_new_animation_controller_removes_the_component() {
|
||||
let mut world = World::new();
|
||||
@@ -2446,7 +2975,7 @@ mod tests {
|
||||
world.init_resource::<SceneIo>();
|
||||
let controller = animation_controller("idle", 0.2);
|
||||
let entity = world
|
||||
.spawn((LevelObject, ActorKind::ImportedModel, Transform::IDENTITY))
|
||||
.spawn((LevelObject, ActorKind::SkinnedMesh, Transform::IDENTITY))
|
||||
.id();
|
||||
|
||||
set_animation_controller_with_history(&mut world, entity, controller.clone());
|
||||
@@ -2467,9 +2996,10 @@ mod tests {
|
||||
let source = world
|
||||
.spawn((
|
||||
LevelObject,
|
||||
ActorKind::ImportedModel,
|
||||
ActorKind::SkinnedMesh,
|
||||
Name::new("Animated Robot"),
|
||||
Transform::from_xyz(1.0, 2.0, 3.0),
|
||||
SkinnedMeshRenderer::new("assets/models/robot.glb").with_asset_id("robot-asset"),
|
||||
controller.clone(),
|
||||
))
|
||||
.id();
|
||||
@@ -2486,6 +3016,10 @@ mod tests {
|
||||
world.get::<Name>(respawned).map(Name::as_str),
|
||||
Some("Animated Robot")
|
||||
);
|
||||
assert_eq!(
|
||||
world.get::<SkinnedMeshRenderer>(respawned),
|
||||
Some(&SkinnedMeshRenderer::new("assets/models/robot.glb").with_asset_id("robot-asset"))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -3013,6 +3547,73 @@ mod tests {
|
||||
assert_eq!(unique.len(), ids.len(), "duplicated actors need fresh IDs");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn duplicate_navigation_bounds_gets_actor_owned_artifact_path() {
|
||||
let mut world = World::new();
|
||||
world.init_resource::<EditorHistory>();
|
||||
world.init_resource::<SceneIo>();
|
||||
world.init_resource::<SelectedEntity>();
|
||||
let original_id = ActorId::new("navigation-bounds-original");
|
||||
let original_bounds = NavigationBounds::for_actor(&original_id.0);
|
||||
let original = world
|
||||
.spawn((
|
||||
LevelObject,
|
||||
ActorKind::Navigation,
|
||||
original_id,
|
||||
Transform::IDENTITY,
|
||||
original_bounds.clone(),
|
||||
))
|
||||
.id();
|
||||
|
||||
duplicate_entities_with_history(&mut world, &[original]);
|
||||
|
||||
let (duplicate_id, duplicate_bounds) = world
|
||||
.query::<(Entity, &ActorId, &NavigationBounds)>()
|
||||
.iter(&world)
|
||||
.find_map(|(entity, actor_id, bounds)| {
|
||||
(entity != original).then_some((actor_id.clone(), bounds.clone()))
|
||||
})
|
||||
.expect("duplicated navigation bounds should exist");
|
||||
assert_ne!(
|
||||
duplicate_bounds.artifact_path,
|
||||
original_bounds.artifact_path
|
||||
);
|
||||
assert_eq!(
|
||||
duplicate_bounds.artifact_path,
|
||||
shared::navigation_artifact_path_for_actor(&duplicate_id.0)
|
||||
);
|
||||
|
||||
apply_command_undo(&mut world);
|
||||
apply_command_redo(&mut world);
|
||||
let redone = world
|
||||
.query::<(&ActorId, &NavigationBounds)>()
|
||||
.iter(&world)
|
||||
.find(|(actor_id, _)| **actor_id == duplicate_id)
|
||||
.expect("redo should preserve the duplicate actor identity");
|
||||
assert_eq!(redone.1, &duplicate_bounds);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn existing_navigation_snapshot_keeps_deliberate_generated_path() {
|
||||
let mut world = World::new();
|
||||
let mut bounds = NavigationBounds::for_actor("bounds-existing");
|
||||
bounds.artifact_path = "assets/navigation/generated/custom-zone.nav.ron".into();
|
||||
let entity = world
|
||||
.spawn((
|
||||
LevelObject,
|
||||
ActorKind::Navigation,
|
||||
ActorId::new("bounds-existing"),
|
||||
Transform::IDENTITY,
|
||||
bounds.clone(),
|
||||
))
|
||||
.id();
|
||||
let mut snapshot = snapshot_entity(&world, entity).unwrap();
|
||||
|
||||
assign_missing_actor_ids(&mut snapshot);
|
||||
|
||||
assert_eq!(snapshot.navigation_bounds.as_ref(), Some(&bounds));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn linked_members_reject_direct_history_mutations() {
|
||||
let mut world = World::new();
|
||||
|
||||
@@ -22,8 +22,10 @@ pub use ext::extensibility;
|
||||
pub use ext::hot_reload;
|
||||
pub use play::net_editor;
|
||||
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::session;
|
||||
pub use project::settings_ui;
|
||||
@@ -36,10 +38,13 @@ pub use viewport::brush_edit;
|
||||
pub use viewport::brush_tool;
|
||||
pub use viewport::camera;
|
||||
pub use viewport::gizmos;
|
||||
pub use viewport::material_drop;
|
||||
pub use viewport::render_view;
|
||||
pub use viewport::rendering_diagnostics;
|
||||
pub use viewport::selection;
|
||||
pub use viewport::selection_outline;
|
||||
pub use viewport::terrain_paint;
|
||||
pub use viewport::terrain_sculpt;
|
||||
pub use viewport::visualizers;
|
||||
|
||||
use bevy::app::PluginGroupBuilder;
|
||||
@@ -61,9 +66,12 @@ use extensibility::ExtensibilityPlugin;
|
||||
use gizmos::EditorGizmoPlugin;
|
||||
use history::EditorHistoryPlugin;
|
||||
use infra::EditorInfraPlugin;
|
||||
use material_drop::MaterialDropPlugin;
|
||||
use operators::OperatorPlugin;
|
||||
use play::audio_preview::AudioPreviewPlugin;
|
||||
use play::PlaySessionPlugin;
|
||||
use project::collaboration::CollaborationPlugin;
|
||||
use project::native_dialog::NativeDialogPlugin;
|
||||
use project_io::ProjectIoPlugin;
|
||||
use render_view::RenderViewPlugin;
|
||||
use scene_io::SceneIoPlugin;
|
||||
@@ -73,6 +81,8 @@ use selection_outline::SelectionOutlinePlugin;
|
||||
use session::EditorSessionPlugin;
|
||||
use settings_ui::SettingsUiPlugin;
|
||||
use state::EditorStatePlugin;
|
||||
use terrain_paint::TerrainPaintPlugin;
|
||||
use terrain_sculpt::TerrainSculptPlugin;
|
||||
use ui::EditorUiPlugin;
|
||||
use viewport::ViewportPlugin;
|
||||
use visualizers::EditorVisualizersPlugin;
|
||||
@@ -86,6 +96,7 @@ impl PluginGroup for EditorPluginGroup {
|
||||
let group = PluginGroupBuilder::start::<Self>()
|
||||
.add(EditorInfraPlugin)
|
||||
.add(ProjectIoPlugin)
|
||||
.add(NativeDialogPlugin)
|
||||
.add(scene_schema::SceneSchemaPlugin)
|
||||
.add(net_editor::NetEditorPlugin)
|
||||
.add(AssetDbPlugin)
|
||||
@@ -102,15 +113,19 @@ impl PluginGroup for EditorPluginGroup {
|
||||
.add(BrushCsgPlugin)
|
||||
.add(BrushEditPlugin)
|
||||
.add(BrushToolPlugin)
|
||||
.add(TerrainSculptPlugin)
|
||||
.add(TerrainPaintPlugin)
|
||||
.add(EditorCameraPlugin)
|
||||
.add(AudioPreviewPlugin)
|
||||
.add(ActorIconsPlugin)
|
||||
.add(MaterialDropPlugin)
|
||||
.add(EditorSelectionPlugin)
|
||||
.add(SelectionOutlinePlugin)
|
||||
.add(EditorGizmoPlugin)
|
||||
.add(EditorVisualizersPlugin)
|
||||
.add(EditorHistoryPlugin)
|
||||
.add(SceneIoPlugin)
|
||||
.add(CollaborationPlugin)
|
||||
.add(EditorUiPlugin)
|
||||
.add(EditorSessionPlugin)
|
||||
.add(brp::BrpPlugin);
|
||||
|
||||
@@ -6,7 +6,10 @@ use bevy::window::WindowRef;
|
||||
use game::player::PlayerCamera;
|
||||
use protocol::PlayerInputIntent;
|
||||
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 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()));
|
||||
|
||||
let spawn = world
|
||||
.query_filtered::<(&Transform, Option<&InspectorOrder>), With<PlayerSpawn>>()
|
||||
.query_filtered::<(
|
||||
&Transform,
|
||||
Option<&AuthoringComponentStates>,
|
||||
Option<&InspectorOrder>,
|
||||
), With<PlayerSpawn>>()
|
||||
.iter(world)
|
||||
.filter(|(_, order)| inspector_component_active(*order, COMPONENT_PLAYER_SPAWN))
|
||||
.map(|(transform, _)| transform)
|
||||
.filter(|(_, states, legacy_order)| {
|
||||
authoring_component_active(*states, *legacy_order, COMPONENT_PLAYER_SPAWN)
|
||||
})
|
||||
.map(|(transform, _, _)| transform)
|
||||
.next()
|
||||
.copied()
|
||||
.unwrap_or_else(default_player_spawn);
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -13,6 +13,7 @@ use settings::{
|
||||
PROJECT_TEMPLATE_VERSION,
|
||||
};
|
||||
|
||||
use crate::native_dialog::{NativeDialogBroker, NativeDialogPlugin};
|
||||
use crate::project_io::UserPreferences;
|
||||
use crate::scene::recovery::atomic_write;
|
||||
use crate::ui::theme::{
|
||||
@@ -91,6 +92,7 @@ pub fn run_project_launcher() {
|
||||
..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);
|
||||
@@ -208,9 +210,24 @@ fn launcher_actions(world: &mut World, ui: &mut egui::Ui, state: &mut ProjectLau
|
||||
egui::RichText::new("Select a root containing assets/project.ron").color(TEXT_DIM),
|
||||
);
|
||||
ui.add_space(8.0);
|
||||
if ui.button("Browse Existing...").clicked() {
|
||||
if let Some(root) = rfd::FileDialog::new().pick_folder() {
|
||||
open_project_from_launcher(world, state, root);
|
||||
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}"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,8 +256,23 @@ fn launcher_actions(world: &mut World, ui: &mut egui::Ui, state: &mut ProjectLau
|
||||
)
|
||||
.truncate(),
|
||||
);
|
||||
if ui.button("Choose Empty Folder...").clicked() {
|
||||
state.sandbox_destination = rfd::FileDialog::new().pick_folder();
|
||||
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();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
//! Project workspace I/O, settings UI, and recent-level sync.
|
||||
|
||||
pub mod collaboration;
|
||||
pub mod diagnostics_bundle;
|
||||
pub mod launcher;
|
||||
pub mod native_dialog;
|
||||
pub mod project_io;
|
||||
pub mod session;
|
||||
pub mod settings_ui;
|
||||
@@ -0,0 +1,171 @@
|
||||
//! Non-blocking bridge between native dialogs and main-thread editor workflows.
|
||||
|
||||
use std::sync::mpsc::{self, Receiver, Sender};
|
||||
use std::sync::{
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
Arc, Mutex,
|
||||
};
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
type MainThreadCompletion = Box<dyn FnOnce(&mut World) + Send + 'static>;
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct NativeDialogBroker {
|
||||
sender: Sender<MainThreadCompletion>,
|
||||
receiver: Mutex<Receiver<MainThreadCompletion>>,
|
||||
pending: Arc<AtomicUsize>,
|
||||
}
|
||||
|
||||
impl Default for NativeDialogBroker {
|
||||
fn default() -> Self {
|
||||
let (sender, receiver) = mpsc::channel();
|
||||
Self {
|
||||
sender,
|
||||
receiver: Mutex::new(receiver),
|
||||
pending: Arc::new(AtomicUsize::new(0)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl NativeDialogBroker {
|
||||
pub fn is_pending(&self) -> bool {
|
||||
self.pending.load(Ordering::Acquire) > 0
|
||||
}
|
||||
|
||||
pub fn request<T, D, C>(&self, dialog: D, completion: C) -> Result<(), &'static str>
|
||||
where
|
||||
T: Send + 'static,
|
||||
D: FnOnce() -> T + Send + 'static,
|
||||
C: FnOnce(&mut World, T) + Send + 'static,
|
||||
{
|
||||
if self
|
||||
.pending
|
||||
.compare_exchange(0, 1, Ordering::AcqRel, Ordering::Acquire)
|
||||
.is_err()
|
||||
{
|
||||
return Err("another native dialog is already open");
|
||||
}
|
||||
|
||||
let sender = self.sender.clone();
|
||||
let pending = Arc::clone(&self.pending);
|
||||
std::thread::spawn(move || {
|
||||
let result = dialog();
|
||||
let callback: MainThreadCompletion = Box::new(move |world| completion(world, result));
|
||||
if sender.send(callback).is_err() {
|
||||
pending.store(0, Ordering::Release);
|
||||
}
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct NativeDialogPlugin;
|
||||
|
||||
impl Plugin for NativeDialogPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.init_resource::<NativeDialogBroker>()
|
||||
.add_systems(Update, drain_native_dialog_results);
|
||||
}
|
||||
}
|
||||
|
||||
fn drain_native_dialog_results(world: &mut World) {
|
||||
let callbacks: Vec<_> = {
|
||||
let broker = world.resource::<NativeDialogBroker>();
|
||||
broker
|
||||
.receiver
|
||||
.lock()
|
||||
.expect("native dialog receiver poisoned")
|
||||
.try_iter()
|
||||
.collect()
|
||||
};
|
||||
for callback in callbacks {
|
||||
world
|
||||
.resource::<NativeDialogBroker>()
|
||||
.pending
|
||||
.store(0, Ordering::Release);
|
||||
callback(world);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[derive(Resource, Default)]
|
||||
struct ResultValue(Option<u32>);
|
||||
|
||||
#[derive(Resource, Default)]
|
||||
struct FrameCount(u32);
|
||||
|
||||
#[test]
|
||||
fn request_is_exclusive_and_completion_runs_once() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(NativeDialogPlugin)
|
||||
.init_resource::<ResultValue>();
|
||||
app.world()
|
||||
.resource::<NativeDialogBroker>()
|
||||
.request(
|
||||
|| 42,
|
||||
|world, value| world.resource_mut::<ResultValue>().0 = Some(value),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(app
|
||||
.world()
|
||||
.resource::<NativeDialogBroker>()
|
||||
.request(|| 7, |_, _| {})
|
||||
.is_err());
|
||||
|
||||
for _ in 0..100 {
|
||||
app.update();
|
||||
if app.world().resource::<ResultValue>().0.is_some() {
|
||||
break;
|
||||
}
|
||||
std::thread::yield_now();
|
||||
}
|
||||
assert_eq!(app.world().resource::<ResultValue>().0, Some(42));
|
||||
app.update();
|
||||
assert_eq!(app.world().resource::<ResultValue>().0, Some(42));
|
||||
assert!(!app.world().resource::<NativeDialogBroker>().is_pending());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn blocked_dialog_worker_does_not_block_app_frames() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(NativeDialogPlugin)
|
||||
.init_resource::<ResultValue>()
|
||||
.init_resource::<FrameCount>()
|
||||
.add_systems(Update, |mut frames: ResMut<FrameCount>| frames.0 += 1);
|
||||
let (release_sender, release_receiver) = mpsc::channel();
|
||||
app.world()
|
||||
.resource::<NativeDialogBroker>()
|
||||
.request(
|
||||
move || {
|
||||
release_receiver
|
||||
.recv()
|
||||
.expect("test release sender dropped")
|
||||
},
|
||||
|world, value| world.resource_mut::<ResultValue>().0 = Some(value),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
for _ in 0..8 {
|
||||
app.update();
|
||||
}
|
||||
assert_eq!(app.world().resource::<FrameCount>().0, 8);
|
||||
assert_eq!(app.world().resource::<ResultValue>().0, None);
|
||||
assert!(app.world().resource::<NativeDialogBroker>().is_pending());
|
||||
|
||||
release_sender.send(73).unwrap();
|
||||
for _ in 0..100 {
|
||||
app.update();
|
||||
if app.world().resource::<ResultValue>().0.is_some() {
|
||||
break;
|
||||
}
|
||||
std::thread::yield_now();
|
||||
}
|
||||
assert_eq!(app.world().resource::<ResultValue>().0, Some(73));
|
||||
assert!(app.world().resource::<FrameCount>().0 > 8);
|
||||
assert!(!app.world().resource::<NativeDialogBroker>().is_pending());
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,28 @@
|
||||
//! Editor-only Project Settings panel (egui). Data lives in the `settings` crate.
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_egui::egui;
|
||||
use game_hot::sync_project_sun_from_settings;
|
||||
use settings::{
|
||||
load_project_settings_from_path, save_project_settings, sync_sim_tuning, ExposureMode,
|
||||
ProjectSettings, ProjectSettingsChanged, ProjectSettingsIo,
|
||||
save_project_settings_to_string, sync_sim_tuning, ExposureMode, ProjectSettings,
|
||||
ProjectSettingsChanged, ProjectSettingsIo,
|
||||
};
|
||||
|
||||
use crate::project::collaboration::{
|
||||
file_status_indicator_ui, publish_authored_file, CollaborationState, FileSnapshot,
|
||||
FileWriteIntent,
|
||||
};
|
||||
use crate::scene_io::SceneIo;
|
||||
|
||||
/// Whether the Project Settings window is visible (editor UI state only).
|
||||
#[derive(Resource, Debug, Default)]
|
||||
pub struct ProjectSettingsPanel {
|
||||
pub open: bool,
|
||||
pub draft: Option<ProjectSettings>,
|
||||
disk_snapshot: Option<FileSnapshot>,
|
||||
save_error: Option<String>,
|
||||
}
|
||||
|
||||
pub struct SettingsUiPlugin;
|
||||
@@ -39,11 +49,23 @@ pub fn project_settings_window(
|
||||
) {
|
||||
if !panel.open {
|
||||
panel.draft = None;
|
||||
panel.disk_snapshot = None;
|
||||
panel.save_error = None;
|
||||
return;
|
||||
}
|
||||
|
||||
if panel.draft.is_none() {
|
||||
panel.draft = Some(world.resource::<ProjectSettings>().clone());
|
||||
let io = world.resource::<ProjectSettingsIo>();
|
||||
panel.disk_snapshot = Some(
|
||||
io.loaded_source
|
||||
.as_deref()
|
||||
.map(|source| {
|
||||
FileSnapshot::from_loaded_bytes(Path::new(&io.path), source.as_bytes())
|
||||
})
|
||||
.unwrap_or_else(FileSnapshot::missing),
|
||||
);
|
||||
panel.save_error = None;
|
||||
}
|
||||
|
||||
let mut open = panel.open;
|
||||
@@ -51,17 +73,33 @@ pub fn project_settings_window(
|
||||
.open(&mut open)
|
||||
.default_width(420.0)
|
||||
.show(ctx, |ui| {
|
||||
let Some(draft) = panel.draft.as_mut() else {
|
||||
let ProjectSettingsPanel {
|
||||
draft: Some(draft),
|
||||
disk_snapshot,
|
||||
save_error,
|
||||
..
|
||||
} = panel
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let io_path = world.resource::<ProjectSettingsIo>().path.clone();
|
||||
let mut io_dirty = world.resource::<ProjectSettingsIo>().dirty;
|
||||
draw_project_settings_form(world, ui, draft, &io_path, &mut io_dirty);
|
||||
draw_project_settings_form(
|
||||
world,
|
||||
ui,
|
||||
draft,
|
||||
&io_path,
|
||||
&mut io_dirty,
|
||||
disk_snapshot,
|
||||
save_error,
|
||||
);
|
||||
world.resource_mut::<ProjectSettingsIo>().dirty = io_dirty;
|
||||
});
|
||||
panel.open = open;
|
||||
if !open {
|
||||
panel.draft = None;
|
||||
panel.disk_snapshot = None;
|
||||
panel.save_error = None;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,12 +109,26 @@ fn draw_project_settings_form(
|
||||
draft: &mut ProjectSettings,
|
||||
io_path: &str,
|
||||
io_dirty: &mut bool,
|
||||
disk_snapshot: &mut Option<FileSnapshot>,
|
||||
save_error: &mut Option<String>,
|
||||
) {
|
||||
let caps = world
|
||||
.get_resource::<settings::RenderingCapabilities>()
|
||||
.cloned()
|
||||
.unwrap_or_default();
|
||||
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.small(egui::RichText::new(io_path).monospace());
|
||||
if let Some(state) = world.get_resource::<CollaborationState>() {
|
||||
let status = state.file_status(Path::new(io_path));
|
||||
let _ = file_status_indicator_ui(ui, &status, Path::new(io_path));
|
||||
}
|
||||
});
|
||||
if let Some(error) = save_error.as_deref() {
|
||||
ui.colored_label(crate::ui::theme::ERROR, error);
|
||||
}
|
||||
ui.separator();
|
||||
|
||||
ui.collapsing("Global Illumination", |ui| {
|
||||
egui::ComboBox::from_label("GiMode")
|
||||
.selected_text(format!("{:?}", draft.rendering.gi_mode))
|
||||
@@ -335,25 +387,116 @@ fn draw_project_settings_form(
|
||||
.clicked()
|
||||
{
|
||||
commit_project_settings(world, draft);
|
||||
*io_dirty = true;
|
||||
let settings = world.resource::<ProjectSettings>().clone();
|
||||
let mut io = world.resource_mut::<ProjectSettingsIo>();
|
||||
if let Err(error) = save_project_settings(&settings, &mut io) {
|
||||
warn!("Save project settings failed: {error}");
|
||||
} else {
|
||||
*io_dirty = false;
|
||||
let Some(expected) = disk_snapshot.clone() else {
|
||||
let error = "Project settings disk baseline is unavailable; reload before saving";
|
||||
*save_error = Some(error.into());
|
||||
world.resource_mut::<SceneIo>().set_status(error);
|
||||
return;
|
||||
};
|
||||
match persist_project_settings(world, &settings, &expected) {
|
||||
Ok((snapshot, source)) => {
|
||||
let mut io = world.resource_mut::<ProjectSettingsIo>();
|
||||
io.dirty = false;
|
||||
io.loaded_source = Some(source);
|
||||
*disk_snapshot = Some(snapshot);
|
||||
*save_error = None;
|
||||
*io_dirty = false;
|
||||
world
|
||||
.resource_mut::<SceneIo>()
|
||||
.set_status(format!("Saved project settings to {io_path}"));
|
||||
}
|
||||
Err(error) => {
|
||||
warn!("Save project settings failed: {error}");
|
||||
*save_error = Some(error.clone());
|
||||
world
|
||||
.resource_mut::<SceneIo>()
|
||||
.set_status(format!("Save project settings failed: {error}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ui.button("Revert from disk").clicked() {
|
||||
*draft = load_project_settings_from_path(io_path);
|
||||
commit_project_settings(world, draft);
|
||||
world.resource_mut::<ProjectSettingsIo>().dirty = false;
|
||||
*io_dirty = false;
|
||||
match read_project_settings_document(Path::new(io_path)) {
|
||||
Ok((settings, source, snapshot)) => {
|
||||
*draft = settings;
|
||||
commit_project_settings(world, draft);
|
||||
let mut io = world.resource_mut::<ProjectSettingsIo>();
|
||||
io.dirty = false;
|
||||
io.loaded_source = Some(source);
|
||||
*disk_snapshot = Some(snapshot);
|
||||
*save_error = None;
|
||||
*io_dirty = false;
|
||||
}
|
||||
Err(error) => {
|
||||
*save_error = Some(error.clone());
|
||||
world
|
||||
.resource_mut::<SceneIo>()
|
||||
.set_status(format!("Revert project settings failed: {error}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if *io_dirty {
|
||||
ui.label(egui::RichText::new("Unsaved changes").color(egui::Color32::YELLOW));
|
||||
}
|
||||
}
|
||||
|
||||
fn persist_project_settings(
|
||||
world: &mut World,
|
||||
settings: &ProjectSettings,
|
||||
expected: &FileSnapshot,
|
||||
) -> Result<(FileSnapshot, String), String> {
|
||||
let path = world.resource::<ProjectSettingsIo>().path.clone();
|
||||
let source = save_project_settings_to_string(settings).map_err(|error| error.to_string())?;
|
||||
let snapshot = publish_authored_file(
|
||||
world,
|
||||
Path::new(&path),
|
||||
source.as_bytes(),
|
||||
expected,
|
||||
FileWriteIntent::ProjectSettings,
|
||||
)?;
|
||||
Ok((snapshot, source))
|
||||
}
|
||||
|
||||
fn read_project_settings_document(
|
||||
path: &Path,
|
||||
) -> Result<(ProjectSettings, String, FileSnapshot), String> {
|
||||
let source = std::fs::read_to_string(path)
|
||||
.map_err(|error| format!("could not read {}: {error}", path.display()))?;
|
||||
let settings: ProjectSettings = ron::from_str(&source)
|
||||
.map_err(|error| format!("invalid project settings in {}: {error}", path.display()))?;
|
||||
let snapshot = FileSnapshot::from_loaded_bytes(path, source.as_bytes());
|
||||
Ok((settings, source, snapshot))
|
||||
}
|
||||
|
||||
pub(crate) fn reload_project_settings_after_file_conflict(
|
||||
world: &mut World,
|
||||
path: &Path,
|
||||
) -> Result<String, String> {
|
||||
let active_path = world.resource::<ProjectSettingsIo>().path.clone();
|
||||
if Path::new(&active_path) != path {
|
||||
return Err("the project settings conflict no longer matches the active manifest".into());
|
||||
}
|
||||
let (settings, source, snapshot) = read_project_settings_document(path)?;
|
||||
commit_project_settings(world, &settings);
|
||||
{
|
||||
let mut io = world.resource_mut::<ProjectSettingsIo>();
|
||||
io.dirty = false;
|
||||
io.loaded_source = Some(source);
|
||||
}
|
||||
{
|
||||
let mut panel = world.resource_mut::<ProjectSettingsPanel>();
|
||||
panel.draft = Some(settings);
|
||||
panel.disk_snapshot = Some(snapshot);
|
||||
panel.save_error = None;
|
||||
}
|
||||
Ok(format!("Reloaded project settings from {}", path.display()))
|
||||
}
|
||||
|
||||
pub(crate) fn project_settings_conflict_copy_saved(world: &mut World) {
|
||||
world.resource_mut::<ProjectSettingsPanel>().save_error = None;
|
||||
}
|
||||
|
||||
fn commit_project_settings(world: &mut World, draft: &ProjectSettings) {
|
||||
let previous = world.resource::<ProjectSettings>().rendering.gi_mode;
|
||||
*world.resource_mut::<ProjectSettings>() = draft.clone();
|
||||
@@ -377,7 +520,11 @@ fn apply_project_settings_changes(
|
||||
settings: Res<ProjectSettings>,
|
||||
tuning: ResMut<settings::SimTuning>,
|
||||
scene_suns: Query<
|
||||
(&shared::LightDesc, Option<&shared::InspectorOrder>),
|
||||
(
|
||||
&shared::LightDesc,
|
||||
Option<&shared::AuthoringComponentStates>,
|
||||
Option<&shared::InspectorOrder>,
|
||||
),
|
||||
With<shared::LevelObject>,
|
||||
>,
|
||||
project_suns: Query<(&mut DirectionalLight, &mut Visibility), With<shared::ProjectSun>>,
|
||||
@@ -402,3 +549,35 @@ fn apply_project_settings_changes(
|
||||
// Full stack refresh runs next frame via `render_view::sync_project_render_view`
|
||||
// when `ProjectSettings` changes.
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn project_settings_save_refuses_an_external_revision() {
|
||||
let root = std::env::temp_dir().join(format!(
|
||||
"blacksite-project-settings-external-write-{}",
|
||||
uuid::Uuid::new_v4()
|
||||
));
|
||||
let path = root.join("assets/project.ron");
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
let loaded = save_project_settings_to_string(&ProjectSettings::default()).unwrap();
|
||||
std::fs::write(&path, &loaded).unwrap();
|
||||
let expected = FileSnapshot::from_loaded_bytes(&path, loaded.as_bytes());
|
||||
let mut world = World::new();
|
||||
world.insert_resource(ProjectSettingsIo {
|
||||
path: path.to_string_lossy().into_owned(),
|
||||
loaded_source: Some(loaded),
|
||||
..Default::default()
|
||||
});
|
||||
world.insert_resource(SceneIo::default());
|
||||
std::fs::write(&path, b"external").unwrap();
|
||||
|
||||
let result = persist_project_settings(&mut world, &ProjectSettings::default(), &expected);
|
||||
|
||||
assert!(result.unwrap_err().contains("changed outside Blacksite"));
|
||||
assert_eq!(std::fs::read(&path).unwrap(), b"external");
|
||||
std::fs::remove_dir_all(root).unwrap();
|
||||
}
|
||||
}
|
||||
@@ -13,17 +13,20 @@ pub(crate) fn atomic_write(path: &Path, bytes: &[u8]) -> Result<(), String> {
|
||||
atomic_write_with_pre_rename(path, bytes, || Ok(()))
|
||||
}
|
||||
|
||||
fn atomic_write_with_pre_rename(
|
||||
pub(crate) fn atomic_write_with_pre_rename<E>(
|
||||
path: &Path,
|
||||
bytes: &[u8],
|
||||
before_rename: impl FnOnce() -> Result<(), String>,
|
||||
) -> Result<(), String> {
|
||||
before_rename: impl FnOnce() -> Result<(), E>,
|
||||
) -> Result<(), E>
|
||||
where
|
||||
E: From<String>,
|
||||
{
|
||||
let parent = path
|
||||
.parent()
|
||||
.filter(|parent| !parent.as_os_str().is_empty())
|
||||
.unwrap_or_else(|| Path::new("."));
|
||||
fs::create_dir_all(parent)
|
||||
.map_err(|error| format!("could not create {}: {error}", parent.display()))?;
|
||||
.map_err(|error| E::from(format!("could not create {}: {error}", parent.display())))?;
|
||||
|
||||
let file_name = path
|
||||
.file_name()
|
||||
@@ -40,18 +43,21 @@ fn atomic_write_with_pre_rename(
|
||||
.create_new(true)
|
||||
.write(true)
|
||||
.open(&temporary)
|
||||
.map_err(|error| format!("could not create {}: {error}", temporary.display()))?;
|
||||
file.write_all(bytes)
|
||||
.map_err(|error| format!("could not write {}: {error}", temporary.display()))?;
|
||||
.map_err(|error| {
|
||||
E::from(format!("could not create {}: {error}", temporary.display()))
|
||||
})?;
|
||||
file.write_all(bytes).map_err(|error| {
|
||||
E::from(format!("could not write {}: {error}", temporary.display()))
|
||||
})?;
|
||||
file.sync_all()
|
||||
.map_err(|error| format!("could not sync {}: {error}", temporary.display()))?;
|
||||
.map_err(|error| E::from(format!("could not sync {}: {error}", temporary.display())))?;
|
||||
before_rename()?;
|
||||
fs::rename(&temporary, path).map_err(|error| {
|
||||
format!(
|
||||
E::from(format!(
|
||||
"could not replace {} with {}: {error}",
|
||||
path.display(),
|
||||
temporary.display()
|
||||
)
|
||||
))
|
||||
})?;
|
||||
sync_parent_directory(parent);
|
||||
Ok(())
|
||||
|
||||
+659
-199
File diff suppressed because it is too large.
Load diff
@@ -5,7 +5,7 @@ mod transform;
|
||||
use bevy::prelude::*;
|
||||
use bevy_egui::egui;
|
||||
use egui_phosphor_icons::icons;
|
||||
use shared::{ActorId, ActorKind, ActorName, HydratedPrefabMember, LevelObject};
|
||||
use shared::{infer_actor_kind, ActorId, ActorKind, ActorName, HydratedPrefabMember, LevelObject};
|
||||
|
||||
use crate::ext::extensibility::ActorInspectorSectionRegistry;
|
||||
use crate::ui::inspector;
|
||||
@@ -29,9 +29,8 @@ pub fn draw_actor_inspector(world: &mut World, ui: &mut egui::Ui, entity: Entity
|
||||
return;
|
||||
}
|
||||
|
||||
let kind = entity_ref
|
||||
.get::<ActorKind>()
|
||||
.copied()
|
||||
let kind = infer_actor_kind(entity_ref)
|
||||
.or_else(|| entity_ref.get::<ActorKind>().copied())
|
||||
.unwrap_or(ActorKind::Empty);
|
||||
|
||||
egui::Frame::new()
|
||||
@@ -111,7 +110,9 @@ pub fn draw_actor_inspector(world: &mut World, ui: &mut egui::Ui, entity: Entity
|
||||
|
||||
match kind {
|
||||
ActorKind::StaticMesh
|
||||
| ActorKind::SkinnedMesh
|
||||
| ActorKind::Brush
|
||||
| ActorKind::Terrain
|
||||
| ActorKind::ImportedModel
|
||||
| ActorKind::Light
|
||||
| ActorKind::Empty
|
||||
@@ -123,7 +124,8 @@ pub fn draw_actor_inspector(world: &mut World, ui: &mut egui::Ui, entity: Entity
|
||||
| ActorKind::TeamSpawn
|
||||
| ActorKind::Objective
|
||||
| ActorKind::AudioSource
|
||||
| ActorKind::AudioListener => {
|
||||
| ActorKind::AudioListener
|
||||
| ActorKind::Navigation => {
|
||||
inspector::authoring_inspector_ui(world, ui, entity);
|
||||
}
|
||||
}
|
||||
@@ -139,7 +141,11 @@ pub fn draw_actor_inspector(world: &mut World, ui: &mut egui::Ui, entity: Entity
|
||||
|
||||
fn actor_icon(kind: ActorKind) -> egui_phosphor_icons::Icon {
|
||||
match kind {
|
||||
ActorKind::StaticMesh | ActorKind::Brush | ActorKind::ImportedModel => icons::CUBE,
|
||||
ActorKind::StaticMesh
|
||||
| ActorKind::SkinnedMesh
|
||||
| ActorKind::Brush
|
||||
| ActorKind::Terrain
|
||||
| ActorKind::ImportedModel => icons::CUBE,
|
||||
ActorKind::Light => icons::LIGHTBULB,
|
||||
ActorKind::PrefabAnchor => icons::PACKAGE,
|
||||
ActorKind::PlayerSpawn => icons::PERSON_SIMPLE_RUN,
|
||||
@@ -149,6 +155,7 @@ fn actor_icon(kind: ActorKind) -> egui_phosphor_icons::Icon {
|
||||
ActorKind::TeamSpawn | ActorKind::Objective => icons::FLAG,
|
||||
ActorKind::AudioSource => icons::SPEAKER_HIGH,
|
||||
ActorKind::AudioListener => icons::HEADPHONES,
|
||||
ActorKind::Navigation => icons::PATH,
|
||||
ActorKind::Empty => icons::CIRCLE,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use bevy_egui::egui;
|
||||
use egui_phosphor_icons::icons;
|
||||
use shared::{
|
||||
AnimationClipRecord, AnimationControllerDesc, AnimationManifest, AnimationSkeletonRecord,
|
||||
AnimationStateDesc, EditorAssetRef, ModelRef, COMPONENT_ANIMATION_CONTROLLER_DESC,
|
||||
AnimationStateDesc, EditorAssetRef, SkinnedMeshRenderer, COMPONENT_ANIMATION_CONTROLLER_DESC,
|
||||
};
|
||||
|
||||
use crate::assets::animation::load_animation_manifest;
|
||||
@@ -656,8 +656,8 @@ fn manifest_summary(ui: &mut egui::Ui, manifest: &Result<AnimationManifest, Stri
|
||||
|
||||
fn manifest_for_actor(world: &World, entity: Entity) -> Result<AnimationManifest, String> {
|
||||
let model = world
|
||||
.get::<ModelRef>(entity)
|
||||
.ok_or_else(|| "actor has no ModelRef".to_string())?;
|
||||
.get::<SkinnedMeshRenderer>(entity)
|
||||
.ok_or_else(|| "actor has no SkinnedMeshRenderer".to_string())?;
|
||||
let registry = world
|
||||
.get_resource::<AssetRegistry>()
|
||||
.ok_or_else(|| "asset registry is unavailable".to_string())?;
|
||||
@@ -878,6 +878,7 @@ mod tests {
|
||||
schema_version: 1,
|
||||
asset_id: "model-id".into(),
|
||||
label: "Robot".into(),
|
||||
default_animation_clip_id: None,
|
||||
source: AnimationManifestSource {
|
||||
path: "assets/models/robot.glb".into(),
|
||||
format: "glb".into(),
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,10 +3,11 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use shared::MaterialAsset;
|
||||
use shared::{MaterialAsset, MaterialInstanceAsset};
|
||||
|
||||
use crate::asset_db::ImportSettings;
|
||||
use crate::assets::{AssetSelection, ASSETS_ROOT, BUILTINS_FOLDER};
|
||||
use crate::project::collaboration::FileSnapshot;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum AssetBrowserView {
|
||||
@@ -48,6 +49,7 @@ pub struct AssetBrowserUiState {
|
||||
pub(crate) pending_delete: Option<AssetDeleteRequest>,
|
||||
pub(crate) import_draft: Option<ImportSettingsDraft>,
|
||||
pub(crate) material_draft: Option<MaterialAssetDraft>,
|
||||
pub(crate) material_instance_draft: Option<MaterialInstanceAssetDraft>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -68,6 +70,15 @@ pub(crate) struct ImportSettingsDraft {
|
||||
pub(crate) struct MaterialAssetDraft {
|
||||
pub(crate) path: String,
|
||||
pub(crate) asset: MaterialAsset,
|
||||
pub(crate) disk_snapshot: FileSnapshot,
|
||||
pub(crate) error: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct MaterialInstanceAssetDraft {
|
||||
pub(crate) path: String,
|
||||
pub(crate) asset: MaterialInstanceAsset,
|
||||
pub(crate) disk_snapshot: FileSnapshot,
|
||||
pub(crate) error: Option<String>,
|
||||
}
|
||||
|
||||
@@ -89,6 +100,7 @@ impl Default for AssetBrowserUiState {
|
||||
pending_delete: None,
|
||||
import_draft: None,
|
||||
material_draft: None,
|
||||
material_instance_draft: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,12 @@
|
||||
//! Editor-visible component registry for actor inspector palettes.
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use bevy::ecs::reflect::ReflectComponent;
|
||||
use bevy::prelude::*;
|
||||
use bevy::reflect::std_traits::ReflectDefault;
|
||||
use bevy::reflect::GetTypeRegistration;
|
||||
use bevy_egui::egui;
|
||||
use egui_phosphor_icons::icons;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
@@ -9,6 +15,7 @@ pub enum EditorComponentCategory {
|
||||
Rendering,
|
||||
Animation,
|
||||
Audio,
|
||||
Navigation,
|
||||
Physics,
|
||||
Gameplay,
|
||||
Volumes,
|
||||
@@ -17,6 +24,8 @@ pub enum EditorComponentCategory {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EditorComponentDescriptor {
|
||||
/// Stable editor/protocol identity. This must not be a Rust type path.
|
||||
pub id: &'static str,
|
||||
pub type_name: &'static str,
|
||||
pub display_name: &'static str,
|
||||
pub category: EditorComponentCategory,
|
||||
@@ -35,6 +44,266 @@ pub struct EditorComponentDescriptor {
|
||||
#[derive(Resource, Debug, Clone)]
|
||||
pub struct EditorComponentRegistry {
|
||||
pub descriptors: Vec<EditorComponentDescriptor>,
|
||||
inspectors: HashMap<&'static str, ComponentInspectorFn>,
|
||||
}
|
||||
|
||||
pub type ComponentInspectorFn = fn(&mut World, &mut egui::Ui, Entity);
|
||||
|
||||
impl EditorComponentRegistry {
|
||||
/// Registers a statically linked component extension.
|
||||
///
|
||||
/// Stable ids and reflected type paths are both unique. Returning an error
|
||||
/// here prevents a game/editor extension from silently shadowing a built-in.
|
||||
pub fn register(&mut self, descriptor: EditorComponentDescriptor) -> Result<(), String> {
|
||||
if self
|
||||
.descriptors
|
||||
.iter()
|
||||
.any(|existing| existing.id == descriptor.id)
|
||||
{
|
||||
return Err(format!(
|
||||
"duplicate authoring component id `{}`",
|
||||
descriptor.id
|
||||
));
|
||||
}
|
||||
if self
|
||||
.descriptors
|
||||
.iter()
|
||||
.any(|existing| existing.type_name == descriptor.type_name)
|
||||
{
|
||||
return Err(format!(
|
||||
"component type `{}` is already registered",
|
||||
descriptor.type_name
|
||||
));
|
||||
}
|
||||
self.descriptors.push(descriptor);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn register_with_inspector(
|
||||
&mut self,
|
||||
descriptor: EditorComponentDescriptor,
|
||||
inspector: ComponentInspectorFn,
|
||||
) -> Result<(), String> {
|
||||
let type_name = descriptor.type_name;
|
||||
self.register(descriptor)?;
|
||||
self.inspectors.insert(type_name, inspector);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn inspector(&self, type_name: &str) -> Option<ComponentInspectorFn> {
|
||||
self.inspectors.get(type_name).copied()
|
||||
}
|
||||
|
||||
/// Hard lifecycle requirements keyed by stable component IDs. Keeping this
|
||||
/// lookup in the registry removes requirement policy from inspector code.
|
||||
pub fn required_component_ids(
|
||||
&self,
|
||||
descriptor: &EditorComponentDescriptor,
|
||||
) -> &'static [&'static str] {
|
||||
match descriptor.id {
|
||||
shared::AUTHORING_COMPONENT_ANIMATION_CONTROLLER => {
|
||||
&[shared::AUTHORING_COMPONENT_SKINNED_MESH_RENDERER]
|
||||
}
|
||||
_ => &[],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn present_dependents(
|
||||
&self,
|
||||
world: &World,
|
||||
entity: Entity,
|
||||
required_id: &str,
|
||||
) -> Vec<&EditorComponentDescriptor> {
|
||||
self.descriptors
|
||||
.iter()
|
||||
.filter(|descriptor| {
|
||||
self.required_component_ids(descriptor)
|
||||
.contains(&required_id)
|
||||
&& self.component_present(world, entity, descriptor.type_name)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn by_id(&self, id: &str) -> Option<&EditorComponentDescriptor> {
|
||||
self.descriptors
|
||||
.iter()
|
||||
.find(|descriptor| descriptor.id == id)
|
||||
}
|
||||
|
||||
pub fn by_type_name(&self, type_name: &str) -> Option<&EditorComponentDescriptor> {
|
||||
self.descriptors
|
||||
.iter()
|
||||
.find(|descriptor| descriptor.type_name == type_name)
|
||||
}
|
||||
|
||||
pub fn stable_id_for_type<'a>(&self, type_name: &'a str) -> &'a str {
|
||||
self.by_type_name(type_name)
|
||||
.map(|descriptor| descriptor.id)
|
||||
.unwrap_or(type_name)
|
||||
}
|
||||
|
||||
pub fn ensure_component_order(&self, order: &mut shared::InspectorOrder, present: &[&str]) {
|
||||
for type_name in present {
|
||||
let component_id = self.stable_id_for_type(type_name);
|
||||
if !order
|
||||
.component_ids
|
||||
.iter()
|
||||
.any(|existing| existing == component_id)
|
||||
{
|
||||
order.component_ids.push(component_id.to_string());
|
||||
}
|
||||
}
|
||||
order.component_type_names.clear();
|
||||
}
|
||||
|
||||
pub fn ordered_components<'a>(
|
||||
&self,
|
||||
order: &shared::InspectorOrder,
|
||||
present: &[&'a str],
|
||||
) -> Vec<&'a str> {
|
||||
let mut ordered = Vec::new();
|
||||
for component_id in &order.component_ids {
|
||||
if let Some(type_name) = present
|
||||
.iter()
|
||||
.find(|type_name| self.stable_id_for_type(type_name) == component_id)
|
||||
{
|
||||
ordered.push(*type_name);
|
||||
}
|
||||
}
|
||||
for legacy_type_name in &order.component_type_names {
|
||||
if let Some(type_name) = present
|
||||
.iter()
|
||||
.find(|type_name| **type_name == legacy_type_name)
|
||||
{
|
||||
if !ordered.contains(type_name) {
|
||||
ordered.push(*type_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
for type_name in present {
|
||||
if !ordered.contains(type_name) {
|
||||
ordered.push(*type_name);
|
||||
}
|
||||
}
|
||||
ordered
|
||||
}
|
||||
|
||||
pub fn move_component(
|
||||
&self,
|
||||
order: &mut shared::InspectorOrder,
|
||||
type_name: &str,
|
||||
offset: isize,
|
||||
present: &[&str],
|
||||
) -> bool {
|
||||
self.ensure_component_order(order, present);
|
||||
let component_id = self.stable_id_for_type(type_name);
|
||||
let Some(index) = order
|
||||
.component_ids
|
||||
.iter()
|
||||
.position(|existing| existing == component_id)
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
let target =
|
||||
(index as isize + offset).clamp(0, order.component_ids.len() as isize - 1) as usize;
|
||||
if index == target {
|
||||
return false;
|
||||
}
|
||||
let item = order.component_ids.remove(index);
|
||||
order.component_ids.insert(target, item);
|
||||
true
|
||||
}
|
||||
|
||||
pub fn component_present(&self, world: &World, entity: Entity, type_name: &str) -> bool {
|
||||
let Ok(entity_ref) = world.get_entity(entity) else {
|
||||
return false;
|
||||
};
|
||||
let Some(app_registry) = world.get_resource::<AppTypeRegistry>() else {
|
||||
return false;
|
||||
};
|
||||
let type_registry = app_registry.read();
|
||||
type_registry
|
||||
.get_with_type_path(type_name)
|
||||
.and_then(|registration| registration.data::<ReflectComponent>())
|
||||
.is_some_and(|component| component.contains(entity_ref))
|
||||
}
|
||||
|
||||
/// Validates registry metadata against Bevy reflection before the first
|
||||
/// inspector frame. This is also the contract test used by extensions.
|
||||
pub fn validate(&self, world: &World) -> Result<(), Vec<String>> {
|
||||
let Some(app_registry) = world.get_resource::<AppTypeRegistry>() else {
|
||||
return Err(vec!["AppTypeRegistry is unavailable".to_string()]);
|
||||
};
|
||||
let type_registry = app_registry.read();
|
||||
let mut errors = Vec::new();
|
||||
let mut ids = HashSet::new();
|
||||
let mut type_names = HashSet::new();
|
||||
for descriptor in &self.descriptors {
|
||||
if descriptor.id.trim().is_empty() {
|
||||
errors.push(format!(
|
||||
"{} has an empty stable id",
|
||||
descriptor.display_name
|
||||
));
|
||||
} else if !ids.insert(descriptor.id) {
|
||||
errors.push(format!("duplicate stable id `{}`", descriptor.id));
|
||||
}
|
||||
if !type_names.insert(descriptor.type_name) {
|
||||
errors.push(format!(
|
||||
"duplicate reflected type `{}`",
|
||||
descriptor.type_name
|
||||
));
|
||||
}
|
||||
match type_registry.get_with_type_path(descriptor.type_name) {
|
||||
Some(registration) if registration.data::<ReflectComponent>().is_none() => errors
|
||||
.push(format!(
|
||||
"`{}` is registered without ReflectComponent",
|
||||
descriptor.type_name
|
||||
)),
|
||||
None => errors.push(format!(
|
||||
"reflected component `{}` is not registered",
|
||||
descriptor.type_name
|
||||
)),
|
||||
Some(registration)
|
||||
if descriptor.addable && registration.data::<ReflectDefault>().is_none() =>
|
||||
{
|
||||
errors.push(format!(
|
||||
"addable component `{}` has no reflected Default",
|
||||
descriptor.type_name
|
||||
));
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
for relation in descriptor
|
||||
.recommended
|
||||
.iter()
|
||||
.chain(descriptor.conflicts_with.iter())
|
||||
{
|
||||
if !self
|
||||
.descriptors
|
||||
.iter()
|
||||
.any(|candidate| candidate.type_name == *relation)
|
||||
{
|
||||
errors.push(format!(
|
||||
"{} references unregistered component `{relation}`",
|
||||
descriptor.id
|
||||
));
|
||||
}
|
||||
}
|
||||
for required_id in self.required_component_ids(descriptor) {
|
||||
if self.by_id(required_id).is_none() {
|
||||
errors.push(format!(
|
||||
"{} requires unknown stable component id `{required_id}`",
|
||||
descriptor.id
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
if errors.is_empty() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(errors)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for EditorComponentRegistry {
|
||||
@@ -42,6 +311,7 @@ impl Default for EditorComponentRegistry {
|
||||
Self {
|
||||
descriptors: vec![
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_STATIC_MESH_RENDERER,
|
||||
type_name: "shared::components::StaticMeshRenderer",
|
||||
display_name: "Static Mesh Renderer",
|
||||
category: EditorComponentCategory::Rendering,
|
||||
@@ -56,11 +326,35 @@ impl Default for EditorComponentRegistry {
|
||||
conflicts_with: &[
|
||||
"shared::components::Primitive",
|
||||
"shared::components::BrushDesc",
|
||||
"shared::animation::SkinnedMeshRenderer",
|
||||
],
|
||||
hydration_effect:
|
||||
"Hydrates into generated mesh children and material bindings.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_SKINNED_MESH_RENDERER,
|
||||
type_name: "shared::animation::SkinnedMeshRenderer",
|
||||
display_name: "Skinned Mesh Renderer",
|
||||
category: EditorComponentCategory::Rendering,
|
||||
addable: false,
|
||||
removable: true,
|
||||
reorderable: true,
|
||||
hidden: false,
|
||||
icon: icons::PERSON_SIMPLE_RUN.as_str(),
|
||||
description:
|
||||
"Renders rigged geometry while preserving its imported joints and skin bindings.",
|
||||
search_terms: &["mesh", "renderer", "skinned", "skeletal", "rigged", "joints"],
|
||||
recommended: &["shared::animation::AnimationControllerDesc"],
|
||||
conflicts_with: &[
|
||||
"shared::components::Primitive",
|
||||
"shared::components::BrushDesc",
|
||||
"shared::components::StaticMeshRenderer",
|
||||
],
|
||||
hydration_effect:
|
||||
"Hydrates through a dedicated scene root containing Bevy skinned meshes and joints.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_BRUSH,
|
||||
type_name: "shared::components::BrushDesc",
|
||||
display_name: "Brush",
|
||||
category: EditorComponentCategory::Authoring,
|
||||
@@ -75,10 +369,33 @@ impl Default for EditorComponentRegistry {
|
||||
conflicts_with: &[
|
||||
"shared::components::Primitive",
|
||||
"shared::components::StaticMeshRenderer",
|
||||
"shared::animation::SkinnedMeshRenderer",
|
||||
],
|
||||
hydration_effect: "Hydrates into generated brush mesh children.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_TERRAIN,
|
||||
type_name: "shared::components::TerrainDesc",
|
||||
display_name: "Terrain",
|
||||
category: EditorComponentCategory::Authoring,
|
||||
addable: true,
|
||||
removable: true,
|
||||
reorderable: true,
|
||||
hidden: false,
|
||||
icon: icons::MOUNTAINS.as_str(),
|
||||
description: "Creates chunked height-grid terrain with optional collision.",
|
||||
search_terms: &["terrain", "landscape", "heightmap", "ground", "chunk"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[
|
||||
"shared::components::Primitive",
|
||||
"shared::components::BrushDesc",
|
||||
"shared::components::StaticMeshRenderer",
|
||||
"shared::animation::SkinnedMeshRenderer",
|
||||
],
|
||||
hydration_effect: "Hydrates into generated render and collider chunks.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_MATERIAL,
|
||||
type_name: "shared::components::MaterialDesc",
|
||||
display_name: "Authoring Material",
|
||||
category: EditorComponentCategory::Rendering,
|
||||
@@ -94,6 +411,7 @@ impl Default for EditorComponentRegistry {
|
||||
hydration_effect: "Hydrates into Bevy material assets for renderable actors.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_RIGID_BODY,
|
||||
type_name: "shared::components::RigidBodyDesc",
|
||||
display_name: "Rigid Body",
|
||||
category: EditorComponentCategory::Physics,
|
||||
@@ -109,6 +427,7 @@ impl Default for EditorComponentRegistry {
|
||||
hydration_effect: "Hydrates into runtime Avian rigid-body state.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_COLLIDER,
|
||||
type_name: "shared::components::ColliderDesc",
|
||||
display_name: "Collider",
|
||||
category: EditorComponentCategory::Physics,
|
||||
@@ -124,6 +443,7 @@ impl Default for EditorComponentRegistry {
|
||||
hydration_effect: "Hydrates into runtime Avian collider state.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_LIGHT,
|
||||
type_name: "shared::components::LightDesc",
|
||||
display_name: "Light",
|
||||
category: EditorComponentCategory::Rendering,
|
||||
@@ -139,6 +459,7 @@ impl Default for EditorComponentRegistry {
|
||||
hydration_effect: "Hydrates into runtime Bevy light components.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_ANIMATION_CONTROLLER,
|
||||
type_name: "shared::animation::AnimationControllerDesc",
|
||||
display_name: "Animation Controller",
|
||||
category: EditorComponentCategory::Animation,
|
||||
@@ -149,12 +470,13 @@ impl Default for EditorComponentRegistry {
|
||||
icon: icons::FILM_SLATE.as_str(),
|
||||
description: "Authors named animation states for an imported model rig.",
|
||||
search_terms: &["animation", "controller", "state", "clip", "skeleton", "rig"],
|
||||
recommended: &[],
|
||||
recommended: &["shared::animation::SkinnedMeshRenderer"],
|
||||
conflicts_with: &[],
|
||||
hydration_effect:
|
||||
"Hydrates into a Bevy animation graph and player bound to the imported model.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_AUDIO_SOURCE,
|
||||
type_name: "shared::components::AudioSourceDesc",
|
||||
display_name: "Audio Source",
|
||||
category: EditorComponentCategory::Audio,
|
||||
@@ -171,6 +493,7 @@ impl Default for EditorComponentRegistry {
|
||||
"Hydrates into runtime Bevy audio voices with bus and attenuation control.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_AUDIO_LISTENER,
|
||||
type_name: "shared::components::AudioListenerDesc",
|
||||
display_name: "Audio Listener",
|
||||
category: EditorComponentCategory::Audio,
|
||||
@@ -187,6 +510,7 @@ impl Default for EditorComponentRegistry {
|
||||
"The highest-priority enabled listener becomes the runtime listener.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_PRIMITIVE,
|
||||
type_name: "shared::components::Primitive",
|
||||
display_name: "Primitive",
|
||||
category: EditorComponentCategory::Authoring,
|
||||
@@ -201,11 +525,13 @@ impl Default for EditorComponentRegistry {
|
||||
conflicts_with: &[
|
||||
"shared::components::StaticMeshRenderer",
|
||||
"shared::components::BrushDesc",
|
||||
"shared::animation::SkinnedMeshRenderer",
|
||||
],
|
||||
hydration_effect:
|
||||
"Hydrates into generated primitive render and collision data.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_PLAYER_SPAWN,
|
||||
type_name: "shared::components::PlayerSpawn",
|
||||
display_name: "Player Spawn",
|
||||
category: EditorComponentCategory::Gameplay,
|
||||
@@ -222,6 +548,7 @@ impl Default for EditorComponentRegistry {
|
||||
"Used by PIE/session startup; no saved runtime player is created.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_WEAPON_SPAWN,
|
||||
type_name: "shared::components::WeaponSpawn",
|
||||
display_name: "Weapon Spawn",
|
||||
category: EditorComponentCategory::Gameplay,
|
||||
@@ -237,6 +564,7 @@ impl Default for EditorComponentRegistry {
|
||||
hydration_effect: "Hydrates into gameplay spawn metadata.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_TRIGGER_VOLUME,
|
||||
type_name: "shared::components::TriggerVolume",
|
||||
display_name: "Trigger Volume",
|
||||
category: EditorComponentCategory::Volumes,
|
||||
@@ -252,6 +580,7 @@ impl Default for EditorComponentRegistry {
|
||||
hydration_effect: "Hydrates into gameplay trigger queries and visualizers.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_TEAM_SPAWN,
|
||||
type_name: "shared::components::TeamSpawn",
|
||||
display_name: "Team Spawn",
|
||||
category: EditorComponentCategory::Gameplay,
|
||||
@@ -267,6 +596,7 @@ impl Default for EditorComponentRegistry {
|
||||
hydration_effect: "Hydrates into gameplay spawn metadata.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_OBJECTIVE,
|
||||
type_name: "shared::components::ObjectiveMarker",
|
||||
display_name: "Objective Marker",
|
||||
category: EditorComponentCategory::Gameplay,
|
||||
@@ -282,6 +612,7 @@ impl Default for EditorComponentRegistry {
|
||||
hydration_effect: "Hydrates into gameplay objective metadata.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_POST_PROCESS_VOLUME,
|
||||
type_name: "shared::components::PostProcessVolumeDesc",
|
||||
display_name: "Post-Process Volume",
|
||||
category: EditorComponentCategory::Volumes,
|
||||
@@ -298,6 +629,215 @@ impl Default for EditorComponentRegistry {
|
||||
"Affects active camera rendering when the camera is inside the volume.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_NAVIGATION_BOUNDS,
|
||||
type_name: "shared::navigation::NavigationBounds",
|
||||
display_name: "Navigation Bounds",
|
||||
category: EditorComponentCategory::Navigation,
|
||||
addable: true,
|
||||
removable: true,
|
||||
reorderable: true,
|
||||
hidden: false,
|
||||
icon: icons::PATH.as_str(),
|
||||
description: "Defines the world region and agent profile for a navigation bake.",
|
||||
search_terms: &["navigation", "navmesh", "bounds", "agent", "bake"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[
|
||||
"shared::navigation::NavigationObstacle",
|
||||
"shared::navigation::NavigationArea",
|
||||
"shared::navigation::NavigationLink",
|
||||
],
|
||||
hydration_effect: "Feeds the generated navigation artifact; no render component is hydrated.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_NAVIGATION_OBSTACLE,
|
||||
type_name: "shared::navigation::NavigationObstacle",
|
||||
display_name: "Navigation Obstacle",
|
||||
category: EditorComponentCategory::Navigation,
|
||||
addable: true,
|
||||
removable: true,
|
||||
reorderable: true,
|
||||
hidden: false,
|
||||
icon: icons::SELECTION_SLASH.as_str(),
|
||||
description: "Carves an axis-aligned blocked volume from overlapping bakes.",
|
||||
search_terms: &["navigation", "navmesh", "obstacle", "block", "carve"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[
|
||||
"shared::navigation::NavigationBounds",
|
||||
"shared::navigation::NavigationArea",
|
||||
"shared::navigation::NavigationLink",
|
||||
],
|
||||
hydration_effect: "Contributes a deterministic unwalkable volume during bake.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_NAVIGATION_AREA,
|
||||
type_name: "shared::navigation::NavigationArea",
|
||||
display_name: "Navigation Area",
|
||||
category: EditorComponentCategory::Navigation,
|
||||
addable: true,
|
||||
removable: true,
|
||||
reorderable: true,
|
||||
hidden: false,
|
||||
icon: icons::POLYGON.as_str(),
|
||||
description: "Labels a walkable or blocked navigation area and traversal cost.",
|
||||
search_terms: &["navigation", "navmesh", "area", "cost", "walkable"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[
|
||||
"shared::navigation::NavigationBounds",
|
||||
"shared::navigation::NavigationObstacle",
|
||||
"shared::navigation::NavigationLink",
|
||||
],
|
||||
hydration_effect: "Stores area metadata and blocked-volume contribution in the bake artifact.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_NAVIGATION_LINK,
|
||||
type_name: "shared::navigation::NavigationLink",
|
||||
display_name: "Navigation Link",
|
||||
category: EditorComponentCategory::Navigation,
|
||||
addable: true,
|
||||
removable: true,
|
||||
reorderable: true,
|
||||
hidden: false,
|
||||
icon: icons::LINK.as_str(),
|
||||
description: "Connects otherwise isolated navigation regions with an explicit traversal.",
|
||||
search_terms: &["navigation", "navmesh", "link", "jump", "door", "ladder"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[
|
||||
"shared::navigation::NavigationBounds",
|
||||
"shared::navigation::NavigationObstacle",
|
||||
"shared::navigation::NavigationArea",
|
||||
],
|
||||
hydration_effect: "Adds a validated directed or bidirectional runtime path connection.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: shared::AUTHORING_COMPONENT_LEGACY_PHYSICS_BODY,
|
||||
type_name: "shared::components::PhysicsBody",
|
||||
display_name: "Legacy Physics Body",
|
||||
category: EditorComponentCategory::Physics,
|
||||
addable: false,
|
||||
removable: true,
|
||||
reorderable: true,
|
||||
hidden: false,
|
||||
icon: icons::SPHERE.as_str(),
|
||||
description: "Legacy combined physics authoring retained for scene compatibility.",
|
||||
search_terms: &["legacy", "physics", "body"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[],
|
||||
hydration_effect: "Hydrates through the compatibility physics path.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: "prefab.instance",
|
||||
type_name: "shared::components::PrefabInstance",
|
||||
display_name: "Prefab Instance",
|
||||
category: EditorComponentCategory::Authoring,
|
||||
addable: false,
|
||||
removable: false,
|
||||
reorderable: true,
|
||||
hidden: false,
|
||||
icon: icons::PACKAGE.as_str(),
|
||||
description: "Stores a linked prefab instance and its overrides.",
|
||||
search_terms: &["prefab", "instance", "link"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[],
|
||||
hydration_effect: "Hydrates linked prefab members beneath this anchor.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: "prefab.reference",
|
||||
type_name: "shared::components::PrefabRef",
|
||||
display_name: "Prefab Reference",
|
||||
category: EditorComponentCategory::Authoring,
|
||||
addable: false,
|
||||
removable: false,
|
||||
reorderable: false,
|
||||
hidden: true,
|
||||
icon: icons::PACKAGE.as_str(),
|
||||
description: "Stable source reference owned by a prefab anchor.",
|
||||
search_terms: &["prefab", "reference"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[],
|
||||
hydration_effect: "Resolves the prefab source asset.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: "render.imported_model",
|
||||
type_name: "shared::components::ModelRef",
|
||||
display_name: "Imported Model Reference",
|
||||
category: EditorComponentCategory::Rendering,
|
||||
addable: false,
|
||||
removable: false,
|
||||
reorderable: false,
|
||||
hidden: true,
|
||||
icon: icons::CUBE_TRANSPARENT.as_str(),
|
||||
description: "Legacy full-scene imported model reference.",
|
||||
search_terms: &["model", "imported", "scene"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[],
|
||||
hydration_effect: "Hydrates the referenced imported model scene.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: "render.material_override_legacy",
|
||||
type_name: "shared::components::MaterialOverride",
|
||||
display_name: "Legacy Material Override",
|
||||
category: EditorComponentCategory::Rendering,
|
||||
addable: false,
|
||||
removable: false,
|
||||
reorderable: false,
|
||||
hidden: true,
|
||||
icon: icons::PALETTE.as_str(),
|
||||
description: "Legacy renderer material slot overrides retained for migration.",
|
||||
search_terms: &["material", "override", "legacy"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[],
|
||||
hydration_effect: "Applies compatibility material overrides.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: "render.project_sun",
|
||||
type_name: "shared::components::ProjectSun",
|
||||
display_name: "Project Sun",
|
||||
category: EditorComponentCategory::Rendering,
|
||||
addable: false,
|
||||
removable: false,
|
||||
reorderable: true,
|
||||
hidden: false,
|
||||
icon: icons::SUN.as_str(),
|
||||
description: "Marks the scene light that overrides the project sun.",
|
||||
search_terms: &["sun", "directional", "project"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[],
|
||||
hydration_effect: "Selects the authored directional project light.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: "core.actor_kind",
|
||||
type_name: "shared::components::ActorKind",
|
||||
display_name: "Actor Kind Hint",
|
||||
category: EditorComponentCategory::Editor,
|
||||
addable: false,
|
||||
removable: false,
|
||||
reorderable: false,
|
||||
hidden: true,
|
||||
icon: icons::TAG.as_str(),
|
||||
description: "Compatibility and presentation hint derived from primary components.",
|
||||
search_terms: &["actor", "kind", "hint"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[],
|
||||
hydration_effect: "No runtime effect; validation uses component composition.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: "editor.component_states",
|
||||
type_name: "shared::components::AuthoringComponentStates",
|
||||
display_name: "Authoring Component States",
|
||||
category: EditorComponentCategory::Editor,
|
||||
addable: false,
|
||||
removable: false,
|
||||
reorderable: false,
|
||||
hidden: true,
|
||||
icon: icons::TOGGLE_LEFT.as_str(),
|
||||
description: "Stores persisted component enable state independently of inspector layout.",
|
||||
search_terms: &["editor", "active", "enabled"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[],
|
||||
hydration_effect: "Controls whether opted-in authoring components hydrate.",
|
||||
},
|
||||
EditorComponentDescriptor {
|
||||
id: "editor.inspector_order",
|
||||
type_name: "shared::components::InspectorOrder",
|
||||
display_name: "Inspector Order",
|
||||
category: EditorComponentCategory::Editor,
|
||||
@@ -306,14 +846,62 @@ impl Default for EditorComponentRegistry {
|
||||
reorderable: false,
|
||||
hidden: true,
|
||||
icon: icons::LIST_BULLETS.as_str(),
|
||||
description: "Stores editor-only component ordering and active-state metadata.",
|
||||
description: "Stores editor-only component card ordering.",
|
||||
search_terms: &["editor", "order"],
|
||||
recommended: &[],
|
||||
conflicts_with: &[],
|
||||
hydration_effect:
|
||||
"Controls editor presentation and authoring component active state.",
|
||||
hydration_effect: "Controls editor presentation only; runtime active state is stored separately.",
|
||||
},
|
||||
],
|
||||
inspectors: HashMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Registers one statically linked game/editor component with reflection,
|
||||
/// lifecycle metadata, and its editor inspector in a single call.
|
||||
pub fn register_authoring_component<T>(
|
||||
app: &mut App,
|
||||
descriptor: EditorComponentDescriptor,
|
||||
inspector: ComponentInspectorFn,
|
||||
) -> Result<(), String>
|
||||
where
|
||||
T: Component + Reflect + GetTypeRegistration,
|
||||
{
|
||||
app.register_type::<T>();
|
||||
if !app.world().contains_resource::<EditorComponentRegistry>() {
|
||||
app.init_resource::<EditorComponentRegistry>();
|
||||
}
|
||||
app.world_mut()
|
||||
.resource_mut::<EditorComponentRegistry>()
|
||||
.register_with_inspector(descriptor, inspector)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn built_in_registry_is_unique_and_reflectable() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins(shared::SharedTypesPlugin)
|
||||
.init_resource::<EditorComponentRegistry>();
|
||||
|
||||
app.world()
|
||||
.resource::<EditorComponentRegistry>()
|
||||
.validate(app.world())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn static_extensions_cannot_shadow_stable_ids_or_types() {
|
||||
let mut registry = EditorComponentRegistry::default();
|
||||
let mut duplicate = registry.descriptors[0].clone();
|
||||
duplicate.type_name = "game::editor_ext::StaticFixture";
|
||||
assert!(registry.register(duplicate).is_err());
|
||||
|
||||
let mut duplicate = registry.descriptors[0].clone();
|
||||
duplicate.id = "game.static_fixture";
|
||||
assert!(registry.register(duplicate).is_err());
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,10 @@ impl PanelNodes {
|
||||
EditorTab::Viewport | EditorTab::GameView => self.main_view(),
|
||||
EditorTab::Hierarchy => self.hierarchy(),
|
||||
EditorTab::Inspector => self.inspector(),
|
||||
EditorTab::AssetBrowser | EditorTab::Build | EditorTab::Toolbar => self.bottom(),
|
||||
EditorTab::AssetBrowser
|
||||
| EditorTab::MaterialLibrary
|
||||
| EditorTab::Build
|
||||
| EditorTab::Toolbar => self.bottom(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,20 +54,22 @@ impl PanelNodes {
|
||||
EditorTab::Viewport | EditorTab::GameView => nodes.main_view = path.node.0,
|
||||
EditorTab::Hierarchy => nodes.hierarchy = path.node.0,
|
||||
EditorTab::Inspector => nodes.inspector = path.node.0,
|
||||
EditorTab::AssetBrowser | EditorTab::Build | EditorTab::Toolbar => {
|
||||
nodes.bottom = path.node.0
|
||||
}
|
||||
EditorTab::AssetBrowser
|
||||
| EditorTab::MaterialLibrary
|
||||
| EditorTab::Build
|
||||
| EditorTab::Toolbar => nodes.bottom = path.node.0,
|
||||
}
|
||||
}
|
||||
nodes
|
||||
}
|
||||
}
|
||||
|
||||
pub const PANEL_TABS: [EditorTab; 5] = [
|
||||
pub const PANEL_TABS: [EditorTab; 6] = [
|
||||
EditorTab::Viewport,
|
||||
EditorTab::Hierarchy,
|
||||
EditorTab::Inspector,
|
||||
EditorTab::AssetBrowser,
|
||||
EditorTab::MaterialLibrary,
|
||||
EditorTab::Build,
|
||||
];
|
||||
|
||||
@@ -74,6 +79,7 @@ pub fn tab_label(tab: &EditorTab) -> &'static str {
|
||||
EditorTab::Hierarchy => "Hierarchy",
|
||||
EditorTab::Inspector => "Inspector",
|
||||
EditorTab::AssetBrowser => "Asset Browser",
|
||||
EditorTab::MaterialLibrary => "Material Library",
|
||||
EditorTab::Build => "Build",
|
||||
EditorTab::Toolbar => "Toolbar (legacy)",
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ pub fn light_snapshot(name: &str, translation: Vec3) -> EditorEntitySnapshot {
|
||||
primitive: None,
|
||||
brush: None,
|
||||
static_mesh_renderer: None,
|
||||
skinned_mesh_renderer: None,
|
||||
material: None,
|
||||
material_override: None,
|
||||
rigid_body: None,
|
||||
@@ -109,8 +110,18 @@ pub fn light_snapshot(name: &str, translation: Vec3) -> EditorEntitySnapshot {
|
||||
post_process_volume: None,
|
||||
team_spawn: None,
|
||||
objective: None,
|
||||
|
||||
navigation_bounds: None,
|
||||
|
||||
navigation_obstacle: None,
|
||||
|
||||
navigation_area: None,
|
||||
|
||||
navigation_link: None,
|
||||
hierarchy_sibling_index: 0,
|
||||
editor_visibility: shared::EditorVisibility::default(),
|
||||
inspector_order: None,
|
||||
component_states: None,
|
||||
children: Vec::new(),
|
||||
}
|
||||
}
|
||||
@@ -142,6 +153,7 @@ pub fn ensure_player_spawn_for_edit(world: &mut World) -> Entity {
|
||||
primitive: None,
|
||||
brush: None,
|
||||
static_mesh_renderer: None,
|
||||
skinned_mesh_renderer: None,
|
||||
material: None,
|
||||
material_override: None,
|
||||
rigid_body: None,
|
||||
@@ -160,8 +172,18 @@ pub fn ensure_player_spawn_for_edit(world: &mut World) -> Entity {
|
||||
post_process_volume: None,
|
||||
team_spawn: None,
|
||||
objective: None,
|
||||
|
||||
navigation_bounds: None,
|
||||
|
||||
navigation_obstacle: None,
|
||||
|
||||
navigation_area: None,
|
||||
|
||||
navigation_link: None,
|
||||
hierarchy_sibling_index: 0,
|
||||
editor_visibility: shared::EditorVisibility::default(),
|
||||
inspector_order: None,
|
||||
component_states: None,
|
||||
children: Vec::new(),
|
||||
},
|
||||
)
|
||||
@@ -233,6 +255,7 @@ pub fn create_scene_sun_override_from_project_settings(world: &mut World) -> Ent
|
||||
primitive: None,
|
||||
brush: None,
|
||||
static_mesh_renderer: None,
|
||||
skinned_mesh_renderer: None,
|
||||
material: None,
|
||||
material_override: None,
|
||||
rigid_body: None,
|
||||
@@ -251,8 +274,18 @@ pub fn create_scene_sun_override_from_project_settings(world: &mut World) -> Ent
|
||||
post_process_volume: None,
|
||||
team_spawn: None,
|
||||
objective: None,
|
||||
|
||||
navigation_bounds: None,
|
||||
|
||||
navigation_obstacle: None,
|
||||
|
||||
navigation_area: None,
|
||||
|
||||
navigation_link: None,
|
||||
hierarchy_sibling_index: 0,
|
||||
editor_visibility: shared::EditorVisibility::default(),
|
||||
inspector_order: None,
|
||||
component_states: None,
|
||||
children: Vec::new(),
|
||||
},
|
||||
)
|
||||
|
||||
@@ -4,6 +4,7 @@ use bevy::prelude::*;
|
||||
use shared::{
|
||||
ActorKind, AuthoringLightKind, EditorVisibility, HierarchySiblingIndex, HydratedPrefabMember,
|
||||
LevelObject, LightDesc, ModelRef, PhysicsBody, PlayerSpawn, PrefabInstance,
|
||||
SkinnedMeshRenderer,
|
||||
};
|
||||
|
||||
use super::helpers::{entity_name, is_level_object, HierarchyNodeKind};
|
||||
@@ -203,7 +204,11 @@ fn actor_kind_sort_key(world: &World, entity: Entity) -> u8 {
|
||||
.copied()
|
||||
.map(|kind| match kind {
|
||||
ActorKind::Empty => 0,
|
||||
ActorKind::Brush | ActorKind::StaticMesh | ActorKind::ImportedModel => 1,
|
||||
ActorKind::Brush
|
||||
| ActorKind::Terrain
|
||||
| ActorKind::StaticMesh
|
||||
| ActorKind::SkinnedMesh
|
||||
| ActorKind::ImportedModel => 1,
|
||||
ActorKind::Light => 2,
|
||||
ActorKind::AudioSource | ActorKind::AudioListener => 3,
|
||||
ActorKind::PrefabAnchor => 3,
|
||||
@@ -213,6 +218,7 @@ fn actor_kind_sort_key(world: &World, entity: Entity) -> u8 {
|
||||
ActorKind::PostProcessVolume => 6,
|
||||
ActorKind::TeamSpawn => 7,
|
||||
ActorKind::Objective => 8,
|
||||
ActorKind::Navigation => 6,
|
||||
})
|
||||
.unwrap_or(9)
|
||||
}
|
||||
@@ -463,7 +469,9 @@ pub fn actor_kind_icon(kind: ActorKind) -> &'static str {
|
||||
match kind {
|
||||
ActorKind::Empty => icons::FOLDER.as_str(),
|
||||
ActorKind::Brush => icons::CUBE.as_str(),
|
||||
ActorKind::Terrain => icons::MOUNTAINS.as_str(),
|
||||
ActorKind::StaticMesh => icons::CUBE.as_str(),
|
||||
ActorKind::SkinnedMesh => icons::PERSON_SIMPLE_RUN.as_str(),
|
||||
ActorKind::ImportedModel => icons::CUBE_TRANSPARENT.as_str(),
|
||||
ActorKind::Light => icons::LIGHTBULB.as_str(),
|
||||
ActorKind::AudioSource => icons::SPEAKER_HIGH.as_str(),
|
||||
@@ -475,6 +483,7 @@ pub fn actor_kind_icon(kind: ActorKind) -> &'static str {
|
||||
ActorKind::PostProcessVolume => icons::CAMERA.as_str(),
|
||||
ActorKind::TeamSpawn => icons::FLAG.as_str(),
|
||||
ActorKind::Objective => icons::TARGET.as_str(),
|
||||
ActorKind::Navigation => icons::PATH.as_str(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,6 +543,10 @@ pub fn entity_matches_filter(world: &World, entity: Entity, filter_lower: &str)
|
||||
.is_some()
|
||||
.then_some("spawn"),
|
||||
world.get::<ModelRef>(entity).is_some().then_some("model"),
|
||||
world
|
||||
.get::<SkinnedMeshRenderer>(entity)
|
||||
.is_some()
|
||||
.then_some("skinned model"),
|
||||
world
|
||||
.get::<PhysicsBody>(entity)
|
||||
.is_some()
|
||||
|
||||
+1066
-96
File diff suppressed because it is too large.
Load diff
@@ -32,8 +32,11 @@ pub fn default_dock_layout() -> DockLayoutSnapshot {
|
||||
tree.split_right(NodeIndex::root(), 0.76, vec![EditorTab::Inspector]);
|
||||
let [main_view_node, hierarchy_node] =
|
||||
tree.split_left(main_view_node, 0.2, vec![EditorTab::Hierarchy]);
|
||||
let [main_view_node, bottom_node] =
|
||||
tree.split_below(main_view_node, 0.88, vec![EditorTab::AssetBrowser]);
|
||||
let [main_view_node, bottom_node] = tree.split_below(
|
||||
main_view_node,
|
||||
0.88,
|
||||
vec![EditorTab::AssetBrowser, EditorTab::MaterialLibrary],
|
||||
);
|
||||
|
||||
let panel_nodes = PanelNodes {
|
||||
main_view: main_view_node.0,
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -158,6 +158,44 @@ pub fn top_menu_bar(
|
||||
crate::rendering_diagnostics::spawn_post_process_volume_at_camera(world);
|
||||
ui.close();
|
||||
}
|
||||
ui.separator();
|
||||
ui.menu_button("Navigation", |ui| {
|
||||
use super::navigation_inspector::{
|
||||
spawn_navigation_actor, NavigationActorType,
|
||||
};
|
||||
for (label, actor_type) in [
|
||||
("Create Bounds", NavigationActorType::Bounds),
|
||||
("Create Obstacle", NavigationActorType::Obstacle),
|
||||
("Create Area", NavigationActorType::Area),
|
||||
("Create Link", NavigationActorType::Link),
|
||||
] {
|
||||
if menu_item(ui, label, None, true).clicked() {
|
||||
spawn_navigation_actor(world, actor_type);
|
||||
ui.close();
|
||||
}
|
||||
}
|
||||
ui.separator();
|
||||
let selected_bounds =
|
||||
selected.as_slice().iter().copied().find(|entity| {
|
||||
world.get::<shared::NavigationBounds>(*entity).is_some()
|
||||
});
|
||||
if menu_item(ui, "Bake Selected Bounds", None, selected_bounds.is_some())
|
||||
.clicked()
|
||||
{
|
||||
if let Some(entity) = selected_bounds {
|
||||
super::navigation_inspector::bake_bounds(world, entity);
|
||||
}
|
||||
ui.close();
|
||||
}
|
||||
if menu_item(ui, "Test Selected Path", None, selected_bounds.is_some())
|
||||
.clicked()
|
||||
{
|
||||
if let Some(entity) = selected_bounds {
|
||||
super::navigation_inspector::query_preview(world, entity);
|
||||
}
|
||||
ui.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ui.menu_button("Build", |ui| {
|
||||
|
||||
@@ -3,7 +3,7 @@ mod animation_inspector;
|
||||
mod asset_browser;
|
||||
mod audio_inspector;
|
||||
mod build;
|
||||
mod component_registry;
|
||||
pub mod component_registry;
|
||||
mod diagnostics;
|
||||
mod dock_tabs;
|
||||
mod fonts;
|
||||
@@ -13,7 +13,9 @@ pub mod hierarchy_ops;
|
||||
pub mod hierarchy_state;
|
||||
pub(crate) mod inspector;
|
||||
mod layout;
|
||||
mod material_library;
|
||||
mod menu;
|
||||
pub(crate) mod navigation_inspector;
|
||||
mod play_controls;
|
||||
mod post_process_volume_ui;
|
||||
mod scene_tabs;
|
||||
@@ -38,6 +40,10 @@ use crate::project_io::UserPreferences;
|
||||
use crate::selection::SelectedEntity;
|
||||
use crate::state::EditorMode;
|
||||
|
||||
pub(crate) use asset_browser::{
|
||||
adopt_material_conflict_save_as, reload_material_after_file_conflict,
|
||||
validate_material_conflict_destination,
|
||||
};
|
||||
pub use build::BuildPanel;
|
||||
pub use diagnostics::{BrushDiagnosticsPanel, DiagnosticsPanel};
|
||||
pub use layout::LayoutSaveTimer;
|
||||
@@ -70,6 +76,9 @@ pub struct UiState {
|
||||
last_mode_tab: Option<EditorMode>,
|
||||
}
|
||||
|
||||
#[derive(Resource, Default)]
|
||||
struct DockTabRequest(Option<EditorTab>);
|
||||
|
||||
pub fn egui_captures_keyboard(ctx: &egui::Context) -> bool {
|
||||
ctx.egui_wants_keyboard_input()
|
||||
}
|
||||
@@ -182,6 +191,10 @@ impl UiState {
|
||||
.show_inside(root_ui, &mut viewer);
|
||||
});
|
||||
|
||||
if let Some(tab) = world.resource_mut::<DockTabRequest>().0.take() {
|
||||
dock_tabs::open_and_focus_tab(&mut self.dock_state, tab, &self.panel_nodes);
|
||||
}
|
||||
|
||||
self.panel_nodes = PanelNodes::discover(&self.dock_state, self.panel_nodes);
|
||||
|
||||
mark_layout_dirty_if_changed(
|
||||
@@ -214,6 +227,8 @@ impl UiState {
|
||||
project_settings_window(world, ctx, &mut panel);
|
||||
});
|
||||
|
||||
crate::collaboration::file_conflict_modal(world, ctx);
|
||||
|
||||
if ctx.input(|input| input.key_pressed(egui::Key::F1)) {
|
||||
world.resource_mut::<ViewportUiState>().shortcuts_open = true;
|
||||
}
|
||||
@@ -276,6 +291,7 @@ pub enum EditorTab {
|
||||
Inspector,
|
||||
Toolbar,
|
||||
AssetBrowser,
|
||||
MaterialLibrary,
|
||||
Build,
|
||||
}
|
||||
|
||||
@@ -291,9 +307,13 @@ impl Plugin for EditorUiPlugin {
|
||||
.init_resource::<component_registry::EditorComponentRegistry>()
|
||||
.init_resource::<crate::rendering_diagnostics::RenderingDiagnosticsPanel>()
|
||||
.init_resource::<asset_browser::AssetBrowserUiState>()
|
||||
.init_resource::<material_library::MaterialLibraryState>()
|
||||
.init_resource::<material_library::MaterialLibraryCatalog>()
|
||||
.init_resource::<DockTabRequest>()
|
||||
.init_resource::<inspector::InspectorClipboard>()
|
||||
.init_resource::<inspector::InspectorPanelState>()
|
||||
.init_resource::<animation_inspector::AnimationInspectorState>()
|
||||
.init_resource::<navigation_inspector::NavigationEditorState>()
|
||||
.init_resource::<ViewportUiState>()
|
||||
.init_resource::<LayoutSaveTimer>()
|
||||
.add_systems(
|
||||
@@ -301,22 +321,41 @@ impl Plugin for EditorUiPlugin {
|
||||
init_hierarchy_panel_from_prefs
|
||||
.after(crate::project_io::load_user_preferences_on_startup),
|
||||
)
|
||||
.add_systems(Startup, validate_editor_component_registry)
|
||||
.add_systems(
|
||||
Startup,
|
||||
apply_ui_state_from_prefs
|
||||
.after(crate::project_io::load_user_preferences_on_startup),
|
||||
)
|
||||
.add_systems(
|
||||
EguiPrimaryContextPass,
|
||||
material_library::refresh_material_library_catalog.before(show_ui_system),
|
||||
)
|
||||
.add_systems(EguiPrimaryContextPass, show_ui_system)
|
||||
.add_systems(
|
||||
Update,
|
||||
(
|
||||
hierarchy_state::tick_hierarchy_prefs_save,
|
||||
build::tick_build_job,
|
||||
navigation_inspector::sync_navigation_state,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_editor_component_registry(world: &mut World) {
|
||||
let errors = world
|
||||
.resource::<component_registry::EditorComponentRegistry>()
|
||||
.validate(world)
|
||||
.err();
|
||||
if let Some(errors) = errors {
|
||||
panic!(
|
||||
"invalid authoring component registry:\n{}",
|
||||
errors.join("\n")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_ui_state_from_prefs(mut ui_state: ResMut<UiState>, prefs: Res<UserPreferences>) {
|
||||
*ui_state = UiState::from_prefs(&prefs);
|
||||
}
|
||||
@@ -398,6 +437,9 @@ impl egui_dock::TabViewer for TabViewer<'_> {
|
||||
EditorTab::AssetBrowser => {
|
||||
asset_browser::asset_browser_ui(self.world, ui, self.selected_entities);
|
||||
}
|
||||
EditorTab::MaterialLibrary => {
|
||||
material_library::material_library_ui(self.world, ui, self.selected_entities);
|
||||
}
|
||||
EditorTab::Build => build::build_ui(self.world, ui),
|
||||
}
|
||||
}
|
||||
@@ -409,6 +451,7 @@ impl egui_dock::TabViewer for TabViewer<'_> {
|
||||
EditorTab::Inspector => (icons::SLIDERS, "Inspector"),
|
||||
EditorTab::Toolbar => (icons::WRENCH, "Toolbar"),
|
||||
EditorTab::AssetBrowser => (icons::FOLDER, "Asset Browser"),
|
||||
EditorTab::MaterialLibrary => (icons::PALETTE, "Material Library"),
|
||||
EditorTab::Build => (icons::HAMMER, "Build"),
|
||||
};
|
||||
tab_title(icon, label)
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -8,6 +8,7 @@ use bevy_inspector_egui::bevy_inspector::hierarchy::SelectedEntities;
|
||||
use egui_phosphor_icons::icons;
|
||||
use shared::{SceneComposition, SubsceneReference};
|
||||
|
||||
use crate::native_dialog::NativeDialogBroker;
|
||||
use crate::scene_io::{ComposedSceneMember, SceneIo, SceneIoRequest};
|
||||
use crate::selection::SelectedEntity;
|
||||
|
||||
@@ -195,19 +196,47 @@ fn composition_menu(
|
||||
|
||||
ui.separator();
|
||||
if ui
|
||||
.add_enabled(editing, egui::Button::new("Add Subscene..."))
|
||||
.add_enabled(
|
||||
editing && !world.resource::<NativeDialogBroker>().is_pending(),
|
||||
egui::Button::new("Add Subscene..."),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
match choose_subscene(world, &composition) {
|
||||
Ok(Some(reference)) => {
|
||||
composition.subscenes.push(reference);
|
||||
changed = true;
|
||||
}
|
||||
Ok(None) => {}
|
||||
Err(error) => world
|
||||
.resource_mut::<SceneIo>()
|
||||
.set_status(format!("Add subscene failed: {error}")),
|
||||
}
|
||||
let project_root =
|
||||
PathBuf::from(&world.resource::<crate::project_io::ProjectWorkspace>().root);
|
||||
let directory = project_root.join("assets/levels");
|
||||
let result = world.resource::<NativeDialogBroker>().request(
|
||||
move || {
|
||||
rfd::FileDialog::new()
|
||||
.set_directory(directory)
|
||||
.add_filter("Bevy scene", &["scn.ron", "ron"])
|
||||
.pick_file()
|
||||
},
|
||||
move |world, path| {
|
||||
let Some(path) = path else {
|
||||
world
|
||||
.resource_mut::<SceneIo>()
|
||||
.set_status("Add subscene cancelled");
|
||||
return;
|
||||
};
|
||||
let current = world.resource::<SceneComposition>().clone();
|
||||
match validate_subscene_choice(&project_root, ¤t, path) {
|
||||
Ok(reference) => {
|
||||
let mut updated = current;
|
||||
updated.subscenes.push(reference);
|
||||
crate::history::set_scene_composition_with_history(world, updated);
|
||||
world.resource_mut::<SceneIo>().set_status("Subscene added");
|
||||
}
|
||||
Err(error) => world
|
||||
.resource_mut::<SceneIo>()
|
||||
.set_status(format!("Add subscene failed: {error}")),
|
||||
}
|
||||
},
|
||||
);
|
||||
world.resource_mut::<SceneIo>().set_status(match result {
|
||||
Ok(()) => "Choose a scene to compose".into(),
|
||||
Err(error) => format!("Add subscene unavailable: {error}"),
|
||||
});
|
||||
}
|
||||
|
||||
if changed {
|
||||
@@ -218,20 +247,14 @@ fn composition_menu(
|
||||
}
|
||||
}
|
||||
|
||||
fn choose_subscene(
|
||||
world: &World,
|
||||
fn validate_subscene_choice(
|
||||
project_root: &Path,
|
||||
composition: &SceneComposition,
|
||||
) -> Result<Option<SubsceneReference>, String> {
|
||||
let project_root = PathBuf::from(&world.resource::<crate::project_io::ProjectWorkspace>().root)
|
||||
path: PathBuf,
|
||||
) -> Result<SubsceneReference, String> {
|
||||
let project_root = project_root
|
||||
.canonicalize()
|
||||
.map_err(|error| format!("could not resolve project root: {error}"))?;
|
||||
let Some(path) = rfd::FileDialog::new()
|
||||
.set_directory(project_root.join("assets/levels"))
|
||||
.add_filter("Bevy scene", &["scn.ron", "ron"])
|
||||
.pick_file()
|
||||
else {
|
||||
return Ok(None);
|
||||
};
|
||||
let path = path
|
||||
.canonicalize()
|
||||
.map_err(|error| format!("could not resolve {}: {error}", path.display()))?;
|
||||
@@ -251,12 +274,12 @@ fn choose_subscene(
|
||||
{
|
||||
return Err(format!("{relative} is already composed"));
|
||||
}
|
||||
Ok(Some(SubsceneReference {
|
||||
Ok(SubsceneReference {
|
||||
id: uuid::Uuid::new_v4().to_string(),
|
||||
path: relative,
|
||||
visible: true,
|
||||
locked: true,
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
fn focus_subscene(world: &mut World, selected: &mut SelectedEntities, reference_id: &str) {
|
||||
|
||||
@@ -7,6 +7,7 @@ use egui_phosphor_icons::icons;
|
||||
|
||||
use crate::history::EditorHistory;
|
||||
use crate::operators::ActiveOperator;
|
||||
use crate::project::collaboration::{file_status_indicator_ui, CollaborationState};
|
||||
use crate::scene_io::SceneIo;
|
||||
use crate::state::{EditorMode, PlayPaused};
|
||||
|
||||
@@ -47,6 +48,16 @@ pub fn status_bar_ui(
|
||||
.on_hover_text(status);
|
||||
},
|
||||
|ui| {
|
||||
if let (Some(state), Some(path)) = (
|
||||
world.get_resource::<CollaborationState>(),
|
||||
world.resource::<SceneIo>().active_path.as_deref(),
|
||||
) {
|
||||
let status = state.file_status(path);
|
||||
if status.indicator().is_some() {
|
||||
let _ = file_status_indicator_ui(ui, &status, path);
|
||||
ui.separator();
|
||||
}
|
||||
}
|
||||
let (mode_icon, mode_label, mode_color) = match mode {
|
||||
EditorMode::Editing => (icons::PENCIL_SIMPLE, "EDIT", ACCENT),
|
||||
EditorMode::Playing => {
|
||||
|
||||
@@ -141,6 +141,25 @@ fn left_toolbar(world: &mut World, ui: &mut egui::Ui) {
|
||||
if icon_button(ui, icons::PENCIL_SIMPLE_LINE, "Draw brush (B)").clicked() {
|
||||
start_draw_brush_tool(world);
|
||||
}
|
||||
let selected_navigation_bounds = world
|
||||
.resource::<crate::selection::SelectedEntity>()
|
||||
.0
|
||||
.filter(|entity| world.get::<shared::NavigationBounds>(*entity).is_some());
|
||||
let navigation_tip = if selected_navigation_bounds.is_some() {
|
||||
"Bake selected navigation bounds"
|
||||
} else {
|
||||
"Create navigation bounds"
|
||||
};
|
||||
if icon_button(ui, icons::PATH, navigation_tip).clicked() {
|
||||
if let Some(entity) = selected_navigation_bounds {
|
||||
super::navigation_inspector::bake_bounds(world, entity);
|
||||
} else {
|
||||
super::navigation_inspector::spawn_navigation_actor(
|
||||
world,
|
||||
super::navigation_inspector::NavigationActorType::Bounds,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
toolbar_separator(ui);
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ use egui_phosphor_icons::icons;
|
||||
use transform_gizmo_bevy::prelude::GizmoOptions;
|
||||
|
||||
use crate::assets::operators::{
|
||||
apply_material_operator, apply_texture_operator, assign_animation_clip_operator,
|
||||
assign_audio_clip_operator, place_asset_operator, place_subasset_operator,
|
||||
assign_animation_clip_operator, assign_audio_clip_operator, place_asset_operator,
|
||||
place_subasset_operator,
|
||||
};
|
||||
use crate::assets::thumbnails::kind_icon;
|
||||
use crate::assets::{AssetSelection, AssetSubAssetKind, EditorAssets};
|
||||
@@ -20,9 +20,11 @@ use crate::state::PlayPossession;
|
||||
use crate::viewport::actor_icons::ActorIconSettings;
|
||||
use crate::viewport::brush_edit::{BrushEditMode, BrushElementSelection};
|
||||
use crate::viewport::brush_tool::{BrushToolPhase, BrushToolState};
|
||||
use crate::viewport::terrain_paint::{TerrainPaintMode, TerrainPaintState};
|
||||
use crate::viewport::terrain_sculpt::{TerrainSculptMode, TerrainSculptState};
|
||||
use crate::viewport::{
|
||||
snap_translation, viewport_ground_position, EditorViewportMode, ViewportDisplayMode,
|
||||
ViewportSettings,
|
||||
material_drop::is_surface_asset_selection, snap_translation, viewport_ground_position,
|
||||
EditorViewportMode, MaterialDropState, ViewportDisplayMode, ViewportSettings,
|
||||
};
|
||||
|
||||
use super::helpers::{
|
||||
@@ -30,7 +32,8 @@ use super::helpers::{
|
||||
};
|
||||
use super::theme::{
|
||||
overlay_chip_frame, viewport_toolbar_frame, ACCENT, ACCENT_HOVER, AXIS_X, AXIS_Y, AXIS_Z,
|
||||
BORDER, BORDER_STRONG, ELEVATED_BG, SELECTION, SUCCESS, TEXT, TEXT_DIM, TEXT_MUTED, WARNING,
|
||||
BORDER, BORDER_STRONG, ELEVATED_BG, ERROR, SELECTION, SUCCESS, TEXT, TEXT_DIM, TEXT_MUTED,
|
||||
WARNING,
|
||||
};
|
||||
use super::widgets::{
|
||||
icon_button_small, panel_toolbar_row, phosphor_icon, tool_button, tool_button_accent,
|
||||
@@ -40,6 +43,7 @@ use super::widgets::{
|
||||
pub struct ViewportUiState {
|
||||
pub options_open: bool,
|
||||
pub shortcuts_open: bool,
|
||||
pub toolbar_rect: Option<egui::Rect>,
|
||||
}
|
||||
|
||||
const VIEWPORT_TOOLTIP: &str = "RMB + WASD/QE: fly | MMB: pan | Scroll: dolly\nW/E/R: gizmo | X: world/local | F: focus | G: game view | Ctrl+G: grid\nTab: cycle overlapping picks | Play/Pause/Stop: main toolbar (F5 / F6)";
|
||||
@@ -69,9 +73,17 @@ pub fn viewport_tab_ui(
|
||||
|
||||
let clean_game_view = world.resource::<ViewportDisplayMode>().clean_game_view;
|
||||
let response = ui.allocate_rect(rect, egui::Sense::HOVER);
|
||||
*viewport_pointer_pos = response
|
||||
.interact_pointer_pos()
|
||||
.or_else(|| response.hover_pos())
|
||||
// A drag source owns egui's interaction response, so `Response::hover_pos()`
|
||||
// is intentionally empty while an asset is dragged over the viewport. The
|
||||
// global pointer position remains available and is the correct input for
|
||||
// drag previews and exact surface targeting.
|
||||
*viewport_pointer_pos = ui
|
||||
.input(|input| {
|
||||
input
|
||||
.pointer
|
||||
.interact_pos()
|
||||
.or_else(|| input.pointer.hover_pos())
|
||||
})
|
||||
.filter(|pos| rect.contains(*pos));
|
||||
*pointer_in_viewport = viewport_pointer_pos.is_some();
|
||||
|
||||
@@ -137,6 +149,8 @@ pub fn viewport_tab_ui(
|
||||
scene_view_overlay_toolbar(world, ui.ctx(), rect);
|
||||
scene_view_selection_hud(world, ui.ctx(), rect, selected_entities);
|
||||
scene_view_brush_draw_hints(world, ui.ctx(), rect);
|
||||
scene_view_terrain_sculpt_hints(world, ui.ctx(), rect);
|
||||
scene_view_terrain_paint_hints(world, ui.ctx(), rect);
|
||||
scene_view_render_badge(world, ui.ctx(), rect);
|
||||
scene_view_brush_mode_badge(world, ui.ctx(), rect);
|
||||
scene_view_volume_hud(world, ui.ctx(), rect);
|
||||
@@ -295,6 +309,94 @@ fn scene_view_brush_draw_hints(world: &World, ctx: &egui::Context, scene_rect: e
|
||||
});
|
||||
}
|
||||
|
||||
fn scene_view_terrain_sculpt_hints(world: &World, ctx: &egui::Context, scene_rect: egui::Rect) {
|
||||
let Some(tool) = world.get_resource::<TerrainSculptState>() else {
|
||||
return;
|
||||
};
|
||||
if !tool.active {
|
||||
return;
|
||||
}
|
||||
egui::Area::new(egui::Id::new("scene_view_terrain_sculpt_hints"))
|
||||
.fixed_pos(scene_rect.left_top() + egui::vec2(8.0, 52.0))
|
||||
.interactable(false)
|
||||
.show(ctx, |ui| {
|
||||
overlay_chip_frame().show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(
|
||||
egui::RichText::new(format!("Terrain {}", tool.mode.label()))
|
||||
.color(SELECTION)
|
||||
.strong(),
|
||||
);
|
||||
ui.label(
|
||||
egui::RichText::new(format!("R {:.1}m", tool.radius))
|
||||
.color(TEXT_DIM)
|
||||
.monospace()
|
||||
.small(),
|
||||
);
|
||||
ui.label(
|
||||
egui::RichText::new(format!("S {:.2}m", tool.strength))
|
||||
.color(SUCCESS)
|
||||
.monospace()
|
||||
.small(),
|
||||
);
|
||||
});
|
||||
ui.add_space(4.0);
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
key_hint(ui, "LMB Drag", "Sculpt");
|
||||
key_hint(ui, "Esc", "Cancel stroke / close");
|
||||
key_hint(ui, "RMB", "Cancel stroke / close");
|
||||
key_hint(ui, "Ctrl+Z", "Undo stroke");
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn scene_view_terrain_paint_hints(world: &World, ctx: &egui::Context, scene_rect: egui::Rect) {
|
||||
let Some(tool) = world.get_resource::<TerrainPaintState>() else {
|
||||
return;
|
||||
};
|
||||
if !tool.active {
|
||||
return;
|
||||
}
|
||||
egui::Area::new(egui::Id::new("scene_view_terrain_paint_hints"))
|
||||
.fixed_pos(scene_rect.left_top() + egui::vec2(8.0, 52.0))
|
||||
.interactable(false)
|
||||
.show(ctx, |ui| {
|
||||
overlay_chip_frame().show(ui, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(
|
||||
egui::RichText::new(format!(
|
||||
"Terrain {} • Layer {}",
|
||||
tool.mode.label(),
|
||||
tool.active_layer + 1
|
||||
))
|
||||
.color(SELECTION)
|
||||
.strong(),
|
||||
);
|
||||
ui.label(
|
||||
egui::RichText::new(format!("R {:.1}m", tool.radius))
|
||||
.color(TEXT_DIM)
|
||||
.monospace()
|
||||
.small(),
|
||||
);
|
||||
ui.label(
|
||||
egui::RichText::new(format!("S {:.0}%", tool.strength * 100.0))
|
||||
.color(SUCCESS)
|
||||
.monospace()
|
||||
.small(),
|
||||
);
|
||||
});
|
||||
ui.add_space(4.0);
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
key_hint(ui, "LMB Drag", tool.mode.label());
|
||||
key_hint(ui, "Esc", "Cancel stroke / close");
|
||||
key_hint(ui, "RMB", "Cancel stroke / close");
|
||||
key_hint(ui, "Ctrl+Z", "Undo stroke");
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn key_hint(ui: &mut egui::Ui, key: &str, label: &str) {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(
|
||||
@@ -483,8 +585,30 @@ fn scene_view_volume_hud(world: &World, ctx: &egui::Context, scene_rect: egui::R
|
||||
fn scene_view_overlay_toolbar(world: &mut World, ctx: &egui::Context, scene_rect: egui::Rect) {
|
||||
let mut options_open = world.resource::<ViewportUiState>().options_open;
|
||||
let mut shortcuts_open = world.resource::<ViewportUiState>().shortcuts_open;
|
||||
let terrain_selected = world
|
||||
.resource::<crate::selection::SelectedEntity>()
|
||||
.0
|
||||
.filter(|entity| world.get::<shared::TerrainDesc>(*entity).is_some());
|
||||
let terrain_layer_labels = terrain_selected
|
||||
.and_then(|entity| world.get::<shared::TerrainDesc>(entity))
|
||||
.map(|terrain| {
|
||||
terrain
|
||||
.material_layers
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(index, layer)| {
|
||||
layer
|
||||
.material
|
||||
.as_ref()
|
||||
.map(|material| material.label.clone())
|
||||
.filter(|label| !label.trim().is_empty())
|
||||
.unwrap_or_else(|| format!("Layer {}", index + 1))
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
egui::Area::new(egui::Id::new("scene_view_toolbar"))
|
||||
let toolbar_response = egui::Area::new(egui::Id::new("scene_view_toolbar"))
|
||||
.fixed_pos(scene_rect.left_top() + egui::vec2(6.0, 6.0))
|
||||
.interactable(true)
|
||||
.show(ctx, |ui| {
|
||||
@@ -613,6 +737,174 @@ fn scene_view_overlay_toolbar(world: &mut World, ctx: &egui::Context, scene_rect
|
||||
}
|
||||
}
|
||||
|
||||
let sculpt_active = world.resource::<TerrainSculptState>().active;
|
||||
let paint_active = world.resource::<TerrainPaintState>().active;
|
||||
if terrain_selected.is_some() || sculpt_active || paint_active {
|
||||
ui.separator();
|
||||
let stroking = world.resource::<TerrainSculptState>().is_stroking();
|
||||
let sculpt_button_clicked = tool_button_accent(
|
||||
ui,
|
||||
icons::MOUNTAINS,
|
||||
sculpt_active,
|
||||
if sculpt_active {
|
||||
"Close terrain sculpt tool"
|
||||
} else {
|
||||
"Sculpt selected terrain"
|
||||
},
|
||||
)
|
||||
.clicked();
|
||||
if sculpt_button_clicked {
|
||||
world.resource_mut::<ViewportClick>().0 = None;
|
||||
}
|
||||
if sculpt_button_clicked && !stroking {
|
||||
let state = &mut *world.resource_mut::<TerrainSculptState>();
|
||||
if state.active {
|
||||
state.stop();
|
||||
} else if let Some(entity) = terrain_selected {
|
||||
state.start(entity);
|
||||
}
|
||||
let active = state.active;
|
||||
if active {
|
||||
world.resource_mut::<TerrainPaintState>().stop();
|
||||
world.resource_mut::<BrushToolState>().cancel();
|
||||
world
|
||||
.resource_mut::<crate::operators::ActiveOperator>()
|
||||
.status = Some(crate::operators::OperatorStatus {
|
||||
id: "terrain.sculpt".to_string(),
|
||||
label: "Terrain Sculpt".to_string(),
|
||||
phase: crate::operators::OperatorPhase::Preview,
|
||||
hint: "LMB drag sculpts; Esc or RMB cancels".to_string(),
|
||||
warnings: Vec::new(),
|
||||
});
|
||||
}
|
||||
}
|
||||
if sculpt_active {
|
||||
let mut mode = world.resource::<TerrainSculptState>().mode;
|
||||
for candidate in [
|
||||
TerrainSculptMode::Raise,
|
||||
TerrainSculptMode::Lower,
|
||||
TerrainSculptMode::Flatten,
|
||||
TerrainSculptMode::Smooth,
|
||||
TerrainSculptMode::Noise,
|
||||
] {
|
||||
ui.selectable_value(&mut mode, candidate, candidate.label())
|
||||
.on_hover_text(format!("{} terrain", candidate.label()));
|
||||
}
|
||||
let mut radius = world.resource::<TerrainSculptState>().radius;
|
||||
let mut strength = world.resource::<TerrainSculptState>().strength;
|
||||
ui.add(
|
||||
egui::DragValue::new(&mut radius)
|
||||
.range(0.25..=128.0)
|
||||
.speed(0.1)
|
||||
.prefix("R ")
|
||||
.suffix(" m"),
|
||||
)
|
||||
.on_hover_text("Brush radius");
|
||||
ui.add(
|
||||
egui::DragValue::new(&mut strength)
|
||||
.range(0.01..=20.0)
|
||||
.speed(0.05)
|
||||
.prefix("S ")
|
||||
.suffix(" m"),
|
||||
)
|
||||
.on_hover_text("Height strength per dab");
|
||||
let mut state = world.resource_mut::<TerrainSculptState>();
|
||||
state.mode = mode;
|
||||
state.radius = radius;
|
||||
state.strength = strength;
|
||||
state.clamp_settings();
|
||||
}
|
||||
|
||||
let paint_stroking = world.resource::<TerrainPaintState>().is_stroking();
|
||||
let can_paint = terrain_layer_labels.len() >= 2 || paint_active;
|
||||
let paint_button_clicked = ui
|
||||
.add_enabled(
|
||||
can_paint,
|
||||
egui::Button::new(phosphor_icon(icons::PAINT_BRUSH, 16.0))
|
||||
.selected(paint_active),
|
||||
)
|
||||
.on_hover_text(if can_paint {
|
||||
if paint_active {
|
||||
"Close terrain material paint tool"
|
||||
} else {
|
||||
"Paint selected terrain material layers"
|
||||
}
|
||||
} else {
|
||||
"Assign at least two terrain material layers first"
|
||||
})
|
||||
.clicked();
|
||||
if paint_button_clicked {
|
||||
world.resource_mut::<ViewportClick>().0 = None;
|
||||
}
|
||||
if paint_button_clicked && !paint_stroking {
|
||||
let layer_count = terrain_layer_labels.len();
|
||||
let state = &mut *world.resource_mut::<TerrainPaintState>();
|
||||
if state.active {
|
||||
state.stop();
|
||||
} else if let Some(entity) = terrain_selected {
|
||||
state.start(entity, layer_count);
|
||||
}
|
||||
let active = state.active;
|
||||
if active {
|
||||
world.resource_mut::<TerrainSculptState>().stop();
|
||||
world.resource_mut::<BrushToolState>().cancel();
|
||||
world
|
||||
.resource_mut::<crate::operators::ActiveOperator>()
|
||||
.status = Some(crate::operators::OperatorStatus {
|
||||
id: "terrain.paint".into(),
|
||||
label: "Terrain Paint".into(),
|
||||
phase: crate::operators::OperatorPhase::Preview,
|
||||
hint: "LMB drag paints weights; Esc or RMB cancels".into(),
|
||||
warnings: Vec::new(),
|
||||
});
|
||||
}
|
||||
}
|
||||
if paint_active {
|
||||
let mut mode = world.resource::<TerrainPaintState>().mode;
|
||||
ui.selectable_value(&mut mode, TerrainPaintMode::Paint, "Paint")
|
||||
.on_hover_text("Increase the selected layer weight");
|
||||
ui.selectable_value(&mut mode, TerrainPaintMode::Erase, "Erase")
|
||||
.on_hover_text("Reduce the selected layer weight");
|
||||
let mut active_layer =
|
||||
world.resource::<TerrainPaintState>().active_layer;
|
||||
egui::ComboBox::from_id_salt("terrain_paint_layer")
|
||||
.selected_text(
|
||||
terrain_layer_labels
|
||||
.get(active_layer)
|
||||
.cloned()
|
||||
.unwrap_or_else(|| "Layer".into()),
|
||||
)
|
||||
.show_ui(ui, |ui| {
|
||||
for (index, label) in terrain_layer_labels.iter().enumerate() {
|
||||
ui.selectable_value(&mut active_layer, index, label);
|
||||
}
|
||||
});
|
||||
let mut radius = world.resource::<TerrainPaintState>().radius;
|
||||
let mut strength = world.resource::<TerrainPaintState>().strength;
|
||||
ui.add(
|
||||
egui::DragValue::new(&mut radius)
|
||||
.range(0.25..=128.0)
|
||||
.speed(0.1)
|
||||
.prefix("R ")
|
||||
.suffix(" m"),
|
||||
)
|
||||
.on_hover_text("Brush radius");
|
||||
ui.add(
|
||||
egui::DragValue::new(&mut strength)
|
||||
.range(0.01..=1.0)
|
||||
.speed(0.02)
|
||||
.prefix("S "),
|
||||
)
|
||||
.on_hover_text("Weight strength per dab");
|
||||
let mut state = world.resource_mut::<TerrainPaintState>();
|
||||
state.mode = mode;
|
||||
state.active_layer = active_layer;
|
||||
state.radius = radius;
|
||||
state.strength = strength;
|
||||
state.clamp_settings();
|
||||
}
|
||||
}
|
||||
|
||||
let clean_game_view = world.resource::<ViewportDisplayMode>().clean_game_view;
|
||||
if tool_button(
|
||||
ui,
|
||||
@@ -640,6 +932,13 @@ fn scene_view_overlay_toolbar(world: &mut World, ctx: &egui::Context, scene_rect
|
||||
});
|
||||
});
|
||||
|
||||
let toolbar_clicked = toolbar_response.response.contains_pointer()
|
||||
&& ctx.input(|input| input.pointer.button_clicked(egui::PointerButton::Primary));
|
||||
if toolbar_clicked {
|
||||
world.resource_mut::<ViewportClick>().0 = None;
|
||||
}
|
||||
world.resource_mut::<ViewportUiState>().toolbar_rect = Some(toolbar_response.response.rect);
|
||||
|
||||
if options_open {
|
||||
scene_options_popover(world, ctx, scene_rect, &mut options_open);
|
||||
}
|
||||
@@ -820,11 +1119,44 @@ fn viewport_asset_drop_ui(
|
||||
.resource::<EditorAssets>()
|
||||
.dragging_selection()
|
||||
.cloned();
|
||||
let drag_descriptor = drag_selection
|
||||
let surface_drag = drag_selection
|
||||
.as_ref()
|
||||
.is_some_and(|selection| is_surface_asset_selection(world, selection));
|
||||
let mut drag_descriptor = drag_selection
|
||||
.as_ref()
|
||||
.and_then(|selection| asset_drag_descriptor(world, selection, selected));
|
||||
let over_viewport = pointer_pos.is_some_and(|pos| viewport_rect.contains(pos));
|
||||
let surface_feedback = surface_drag
|
||||
.then(|| world.get_resource::<MaterialDropState>())
|
||||
.flatten()
|
||||
.and_then(MaterialDropState::feedback)
|
||||
.cloned();
|
||||
if surface_drag && over_viewport {
|
||||
if let Some((_, _, action)) = drag_descriptor.as_mut() {
|
||||
*action = surface_feedback
|
||||
.as_ref()
|
||||
.map(|feedback| feedback.action.clone())
|
||||
.unwrap_or_else(|| "Finding an assignable surface".into());
|
||||
}
|
||||
}
|
||||
let drop_valid = (surface_drag && over_viewport)
|
||||
.then(|| surface_feedback.as_ref().map(|feedback| feedback.valid))
|
||||
.flatten();
|
||||
let highlight_color = match drop_valid {
|
||||
Some(true) => SUCCESS,
|
||||
Some(false) => ERROR,
|
||||
None => ACCENT_HOVER,
|
||||
};
|
||||
|
||||
let drag_visual_state = if !over_viewport {
|
||||
AssetDragVisualState::Outside
|
||||
} else {
|
||||
match drop_valid {
|
||||
Some(true) => AssetDragVisualState::Valid,
|
||||
Some(false) => AssetDragVisualState::Invalid,
|
||||
None => AssetDragVisualState::Targeted,
|
||||
}
|
||||
};
|
||||
if let (Some(pointer), Some((icon, label, action))) = (pointer_pos, drag_descriptor.as_ref()) {
|
||||
draw_asset_drag_preview(
|
||||
ui,
|
||||
@@ -833,7 +1165,7 @@ fn viewport_asset_drop_ui(
|
||||
*icon,
|
||||
label,
|
||||
action,
|
||||
over_viewport,
|
||||
drag_visual_state,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -841,7 +1173,7 @@ fn viewport_asset_drop_ui(
|
||||
ui.painter().rect_stroke(
|
||||
viewport_rect.shrink(2.0),
|
||||
0.0,
|
||||
egui::Stroke::new(2.0, ACCENT_HOVER),
|
||||
egui::Stroke::new(2.0, highlight_color),
|
||||
egui::StrokeKind::Inside,
|
||||
);
|
||||
}
|
||||
@@ -851,6 +1183,11 @@ fn viewport_asset_drop_ui(
|
||||
return;
|
||||
}
|
||||
|
||||
if surface_drag && over_viewport {
|
||||
// The Last-schedule surface-drop session owns exact hit resolution and commit.
|
||||
return;
|
||||
}
|
||||
|
||||
if !pointer_pos.is_some_and(|pos| viewport_rect.contains(pos)) {
|
||||
world.resource_mut::<EditorAssets>().clear_drag();
|
||||
return;
|
||||
@@ -875,7 +1212,7 @@ fn viewport_asset_drop_ui(
|
||||
.as_slice()
|
||||
.iter()
|
||||
.copied()
|
||||
.find(|entity| world.get::<shared::ModelRef>(*entity).is_some())
|
||||
.find(|entity| world.get::<shared::SkinnedMeshRenderer>(*entity).is_some())
|
||||
{
|
||||
assign_animation_clip_operator(world, selection, entity);
|
||||
} else {
|
||||
@@ -903,26 +1240,6 @@ fn viewport_asset_drop_ui(
|
||||
return;
|
||||
}
|
||||
|
||||
if let AssetSelection::SubAsset {
|
||||
kind: AssetSubAssetKind::Texture,
|
||||
source_path: Some(path),
|
||||
label,
|
||||
..
|
||||
} = &selection
|
||||
{
|
||||
let asset = crate::assets::EditorAsset {
|
||||
label: label.clone(),
|
||||
path: Some(path.clone()),
|
||||
folder_path: std::path::Path::new(path)
|
||||
.parent()
|
||||
.map(|parent| parent.to_string_lossy().replace('\\', "/"))
|
||||
.unwrap_or_else(|| crate::assets::ASSETS_ROOT.to_string()),
|
||||
kind: crate::assets::EditorAssetKind::Texture,
|
||||
};
|
||||
apply_texture_operator(world, asset, selected);
|
||||
return;
|
||||
}
|
||||
|
||||
let asset = {
|
||||
let assets = world.resource::<EditorAssets>();
|
||||
assets.asset_for_selection(&selection).cloned()
|
||||
@@ -943,18 +1260,6 @@ fn viewport_asset_drop_ui(
|
||||
}
|
||||
return;
|
||||
}
|
||||
match asset.kind {
|
||||
crate::assets::EditorAssetKind::Texture => {
|
||||
apply_texture_operator(world, asset, selected);
|
||||
return;
|
||||
}
|
||||
crate::assets::EditorAssetKind::Material => {
|
||||
apply_material_operator(world, asset, selected);
|
||||
return;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
place_asset_operator(world, asset, placement);
|
||||
}
|
||||
|
||||
@@ -996,11 +1301,11 @@ fn asset_drag_descriptor(
|
||||
AssetSelection::SubAsset {
|
||||
kind: AssetSubAssetKind::Texture,
|
||||
..
|
||||
} if !selected.is_empty() => "Apply texture to selection",
|
||||
} => "Drop onto a primitive or brush face",
|
||||
AssetSelection::SubAsset {
|
||||
kind: AssetSubAssetKind::Material,
|
||||
..
|
||||
} if !selected.is_empty() => "Apply material to selection",
|
||||
} => "Drop onto an exact renderer slot",
|
||||
AssetSelection::SubAsset {
|
||||
kind: AssetSubAssetKind::Skeleton,
|
||||
..
|
||||
@@ -1011,7 +1316,7 @@ fn asset_drag_descriptor(
|
||||
} if selected
|
||||
.as_slice()
|
||||
.iter()
|
||||
.any(|entity| world.get::<shared::ModelRef>(*entity).is_some()) =>
|
||||
.any(|entity| world.get::<shared::SkinnedMeshRenderer>(*entity).is_some()) =>
|
||||
{
|
||||
"Assign clip to animated actor"
|
||||
}
|
||||
@@ -1020,12 +1325,8 @@ fn asset_drag_descriptor(
|
||||
..
|
||||
} => "Create animated actor",
|
||||
_ => match asset.kind {
|
||||
crate::assets::EditorAssetKind::Texture if !selected.is_empty() => {
|
||||
"Apply texture to selection"
|
||||
}
|
||||
crate::assets::EditorAssetKind::Material if !selected.is_empty() => {
|
||||
"Apply material to selection"
|
||||
}
|
||||
crate::assets::EditorAssetKind::Texture => "Drop onto a primitive or brush face",
|
||||
crate::assets::EditorAssetKind::Material => "Drop onto a renderable surface",
|
||||
crate::assets::EditorAssetKind::AudioClip
|
||||
if selected
|
||||
.as_slice()
|
||||
@@ -1041,6 +1342,29 @@ fn asset_drag_descriptor(
|
||||
Some((icon, label, action.to_string()))
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
enum AssetDragVisualState {
|
||||
Outside,
|
||||
Targeted,
|
||||
Valid,
|
||||
Invalid,
|
||||
}
|
||||
|
||||
impl AssetDragVisualState {
|
||||
fn over_viewport(self) -> bool {
|
||||
self != Self::Outside
|
||||
}
|
||||
|
||||
fn color(self) -> egui::Color32 {
|
||||
match self {
|
||||
Self::Outside => TEXT_DIM,
|
||||
Self::Targeted => ACCENT_HOVER,
|
||||
Self::Valid => SUCCESS,
|
||||
Self::Invalid => ERROR,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_asset_drag_preview(
|
||||
ui: &egui::Ui,
|
||||
viewport_rect: egui::Rect,
|
||||
@@ -1048,39 +1372,41 @@ fn draw_asset_drag_preview(
|
||||
icon: egui_phosphor_icons::Icon,
|
||||
label: &str,
|
||||
action: &str,
|
||||
over_viewport: bool,
|
||||
visual_state: AssetDragVisualState,
|
||||
) {
|
||||
let over_viewport = visual_state.over_viewport();
|
||||
let highlight_color = visual_state.color();
|
||||
if over_viewport {
|
||||
let painter = ui.painter();
|
||||
painter.circle_filled(pointer, 3.0, ACCENT_HOVER);
|
||||
painter.circle_stroke(pointer, 11.0, egui::Stroke::new(1.5, ACCENT_HOVER));
|
||||
painter.circle_filled(pointer, 3.0, highlight_color);
|
||||
painter.circle_stroke(pointer, 11.0, egui::Stroke::new(1.5, highlight_color));
|
||||
painter.line_segment(
|
||||
[
|
||||
pointer - egui::vec2(17.0, 0.0),
|
||||
pointer - egui::vec2(7.0, 0.0),
|
||||
],
|
||||
egui::Stroke::new(1.5, ACCENT_HOVER),
|
||||
egui::Stroke::new(1.5, highlight_color),
|
||||
);
|
||||
painter.line_segment(
|
||||
[
|
||||
pointer + egui::vec2(7.0, 0.0),
|
||||
pointer + egui::vec2(17.0, 0.0),
|
||||
],
|
||||
egui::Stroke::new(1.5, ACCENT_HOVER),
|
||||
egui::Stroke::new(1.5, highlight_color),
|
||||
);
|
||||
painter.line_segment(
|
||||
[
|
||||
pointer - egui::vec2(0.0, 17.0),
|
||||
pointer - egui::vec2(0.0, 7.0),
|
||||
],
|
||||
egui::Stroke::new(1.5, ACCENT_HOVER),
|
||||
egui::Stroke::new(1.5, highlight_color),
|
||||
);
|
||||
painter.line_segment(
|
||||
[
|
||||
pointer + egui::vec2(0.0, 7.0),
|
||||
pointer + egui::vec2(0.0, 17.0),
|
||||
],
|
||||
egui::Stroke::new(1.5, ACCENT_HOVER),
|
||||
egui::Stroke::new(1.5, highlight_color),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1101,7 +1427,7 @@ fn draw_asset_drag_preview(
|
||||
ui.set_width(228.0);
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(phosphor_icon(icon, 20.0).color(if over_viewport {
|
||||
ACCENT_HOVER
|
||||
highlight_color
|
||||
} else {
|
||||
TEXT_DIM
|
||||
}));
|
||||
@@ -1116,7 +1442,7 @@ fn draw_asset_drag_preview(
|
||||
})
|
||||
.size(11.0)
|
||||
.color(if over_viewport {
|
||||
ACCENT_HOVER
|
||||
highlight_color
|
||||
} else {
|
||||
TEXT_MUTED
|
||||
}),
|
||||
@@ -1152,9 +1478,9 @@ fn draw_asset_drag_preview(
|
||||
),
|
||||
] {
|
||||
ui.painter()
|
||||
.line_segment([a, a + b], egui::Stroke::new(3.0, ACCENT_HOVER));
|
||||
.line_segment([a, a + b], egui::Stroke::new(3.0, highlight_color));
|
||||
ui.painter()
|
||||
.line_segment([a, a + c], egui::Stroke::new(3.0, ACCENT_HOVER));
|
||||
.line_segment([a, a + c], egui::Stroke::new(3.0, highlight_color));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,8 @@ use bevy::shader::ShaderRef;
|
||||
use shared::{
|
||||
ActorKind, AudioListenerDesc, AudioSourceDesc, AuthoringLightKind, ColliderDesc, LevelObject,
|
||||
LightDesc, ModelRef, ObjectiveMarker, PhysicsBody, PlayerSpawn, PostProcessVolumeDesc,
|
||||
PrefabInstance, PrefabRef, Primitive, RaytracingExcluded, StaticMeshRenderer, TeamSpawn,
|
||||
TriggerVolume, WeaponSpawn,
|
||||
PrefabInstance, PrefabRef, Primitive, RaytracingExcluded, SkinnedMeshRenderer,
|
||||
StaticMeshRenderer, TeamSpawn, TriggerVolume, WeaponSpawn,
|
||||
};
|
||||
|
||||
use crate::camera::EditorCamera;
|
||||
@@ -203,6 +203,7 @@ struct ActorIconComponents {
|
||||
light_kind: Option<AuthoringLightKind>,
|
||||
has_primitive: bool,
|
||||
has_static_mesh_renderer: bool,
|
||||
has_skinned_mesh_renderer: bool,
|
||||
has_model_ref: bool,
|
||||
has_prefab_ref: bool,
|
||||
has_prefab_instance: bool,
|
||||
@@ -386,6 +387,7 @@ fn sync_actor_icons(
|
||||
),
|
||||
(With<LevelObject>, Without<EditorOnly>),
|
||||
>,
|
||||
skinned_meshes: Query<(), With<SkinnedMeshRenderer>>,
|
||||
audio: Query<(Has<AudioSourceDesc>, Has<AudioListenerDesc>)>,
|
||||
physics: Query<(), Or<(With<PhysicsBody>, With<ColliderDesc>)>>,
|
||||
) {
|
||||
@@ -419,6 +421,7 @@ fn sync_actor_icons(
|
||||
has_primitive,
|
||||
has_static_mesh_renderer: static_mesh_renderer
|
||||
.is_some_and(has_resolved_static_mesh_slot),
|
||||
has_skinned_mesh_renderer: skinned_meshes.contains(target),
|
||||
has_model_ref,
|
||||
has_prefab_ref,
|
||||
has_prefab_instance,
|
||||
@@ -489,6 +492,7 @@ fn sync_actor_icons(
|
||||
has_primitive,
|
||||
has_static_mesh_renderer: static_mesh_renderer
|
||||
.is_some_and(has_resolved_static_mesh_slot),
|
||||
has_skinned_mesh_renderer: skinned_meshes.contains(target),
|
||||
has_model_ref,
|
||||
has_prefab_ref,
|
||||
has_prefab_instance,
|
||||
@@ -627,6 +631,10 @@ fn icon_for_actor_components(components: ActorIconComponents) -> ActorIconSpec {
|
||||
image: ActorIconImage::Mesh,
|
||||
category: ActorIconCategory::Mesh,
|
||||
},
|
||||
ActorKind::Terrain => ActorIconSpec {
|
||||
image: ActorIconImage::Mesh,
|
||||
category: ActorIconCategory::Mesh,
|
||||
},
|
||||
ActorKind::StaticMesh => {
|
||||
if components.has_primitive || components.has_static_mesh_renderer {
|
||||
ActorIconSpec {
|
||||
@@ -637,6 +645,16 @@ fn icon_for_actor_components(components: ActorIconComponents) -> ActorIconSpec {
|
||||
warning
|
||||
}
|
||||
}
|
||||
ActorKind::SkinnedMesh => {
|
||||
if components.has_skinned_mesh_renderer {
|
||||
ActorIconSpec {
|
||||
image: ActorIconImage::Mesh,
|
||||
category: ActorIconCategory::Mesh,
|
||||
}
|
||||
} else {
|
||||
warning
|
||||
}
|
||||
}
|
||||
ActorKind::ImportedModel => {
|
||||
if components.has_model_ref {
|
||||
ActorIconSpec {
|
||||
@@ -752,6 +770,10 @@ fn icon_for_actor_components(components: ActorIconComponents) -> ActorIconSpec {
|
||||
warning
|
||||
}
|
||||
}
|
||||
ActorKind::Navigation => ActorIconSpec {
|
||||
image: ActorIconImage::GameMarker,
|
||||
category: ActorIconCategory::Volume,
|
||||
},
|
||||
ActorKind::Empty => {
|
||||
if components.has_physics {
|
||||
ActorIconSpec {
|
||||
|
||||
@@ -1047,6 +1047,17 @@ fn pick_face(
|
||||
best
|
||||
}
|
||||
|
||||
pub(crate) fn pick_brush_face_id(
|
||||
brush: &BrushDesc,
|
||||
transform: &GlobalTransform,
|
||||
ray: Ray3d,
|
||||
) -> Option<(ComponentInstanceId, f32)> {
|
||||
let (BrushElementKey::Face { face }, distance) = pick_face(brush, transform, ray)? else {
|
||||
return None;
|
||||
};
|
||||
Some((face, distance))
|
||||
}
|
||||
|
||||
fn world_vertices(face: &BrushFaceDesc, transform: &GlobalTransform) -> Vec<Vec3> {
|
||||
face.vertices
|
||||
.iter()
|
||||
|
||||
@@ -374,6 +374,7 @@ fn brush_snapshot_from_convex_points(
|
||||
primitive: None,
|
||||
brush: Some(brush),
|
||||
static_mesh_renderer: None,
|
||||
skinned_mesh_renderer: None,
|
||||
material: Some(MaterialDesc::default()),
|
||||
material_override: None,
|
||||
rigid_body: None,
|
||||
@@ -392,8 +393,18 @@ fn brush_snapshot_from_convex_points(
|
||||
post_process_volume: None,
|
||||
team_spawn: None,
|
||||
objective: None,
|
||||
|
||||
navigation_bounds: None,
|
||||
|
||||
navigation_obstacle: None,
|
||||
|
||||
navigation_area: None,
|
||||
|
||||
navigation_link: None,
|
||||
hierarchy_sibling_index: 0,
|
||||
editor_visibility: EditorVisibility::default(),
|
||||
inspector_order: None,
|
||||
component_states: None,
|
||||
children: Vec::new(),
|
||||
})
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -6,11 +6,14 @@ pub mod brush_edit;
|
||||
pub mod brush_tool;
|
||||
pub mod camera;
|
||||
pub mod gizmos;
|
||||
pub mod material_drop;
|
||||
mod panel;
|
||||
pub mod render_view;
|
||||
pub mod rendering_diagnostics;
|
||||
pub mod selection;
|
||||
pub mod selection_outline;
|
||||
pub mod terrain_paint;
|
||||
pub mod terrain_sculpt;
|
||||
pub mod viewport_mode;
|
||||
pub mod visualizers;
|
||||
|
||||
@@ -21,5 +24,8 @@ pub use brush_csg::{
|
||||
};
|
||||
pub use brush_edit::{BrushEditMode, BrushEditPlugin, BrushElementSelection};
|
||||
pub use brush_tool::{BrushToolPlugin, BrushToolState};
|
||||
pub use material_drop::{MaterialDropFeedback, MaterialDropPlugin, MaterialDropState};
|
||||
pub use panel::*;
|
||||
pub use terrain_paint::{TerrainPaintMode, TerrainPaintPlugin, TerrainPaintState};
|
||||
pub use terrain_sculpt::{TerrainSculptMode, TerrainSculptPlugin, TerrainSculptState};
|
||||
pub use viewport_mode::EditorViewportMode;
|
||||
@@ -290,14 +290,33 @@ fn solari_geometry_summary(world: &World, ui: &mut egui::Ui) {
|
||||
ui.separator();
|
||||
ui.heading("Solari raytracing scene");
|
||||
ui.label(format!(
|
||||
"Project meshes: {} tagged, {} eligible, {} Solari-compatible assets, {} unsupported, {} excluded helpers, {} outside level roots",
|
||||
"Project meshes: {} tagged, {} eligible, {} Solari-compatible assets, {} unsupported, {} deformed safely omitted, {} excluded helpers, {} outside level roots",
|
||||
stats.tagged_meshes,
|
||||
stats.project_meshes,
|
||||
stats.compatible_mesh_assets,
|
||||
stats.unsupported_meshes,
|
||||
stats.deformed_meshes_excluded,
|
||||
stats.excluded_meshes,
|
||||
stats.missing_level_root_meshes
|
||||
));
|
||||
if stats.surface_material_meshes > 0 {
|
||||
ui.label(format!(
|
||||
"Surface ABI materials: {} meshes, {} missing an active evaluator generation",
|
||||
stats.surface_material_meshes, stats.surface_materials_missing_evaluator
|
||||
));
|
||||
}
|
||||
if stats.deformed_meshes_excluded > 0 {
|
||||
ui.colored_label(
|
||||
egui::Color32::from_rgb(255, 180, 100),
|
||||
"Skinned/morphed meshes are omitted from Solari until dynamic deformed BLAS is available; no bind-pose proxy is traced.",
|
||||
);
|
||||
}
|
||||
if stats.surface_materials_missing_evaluator > 0 {
|
||||
ui.colored_label(
|
||||
egui::Color32::from_rgb(255, 140, 140),
|
||||
"Surface meshes without a validated evaluator are omitted instead of using an approximate ray-tracing material.",
|
||||
);
|
||||
}
|
||||
if stats.incompatible_mesh_assets > 0 {
|
||||
ui.colored_label(
|
||||
egui::Color32::from_rgb(255, 180, 100),
|
||||
@@ -457,6 +476,7 @@ pub fn spawn_post_process_volume_at_camera(world: &mut World) {
|
||||
primitive: None,
|
||||
brush: None,
|
||||
static_mesh_renderer: None,
|
||||
skinned_mesh_renderer: None,
|
||||
material: None,
|
||||
material_override: None,
|
||||
rigid_body: None,
|
||||
@@ -475,8 +495,18 @@ pub fn spawn_post_process_volume_at_camera(world: &mut World) {
|
||||
post_process_volume: Some(PostProcessVolumeDesc::default()),
|
||||
team_spawn: None,
|
||||
objective: None,
|
||||
|
||||
navigation_bounds: None,
|
||||
|
||||
navigation_obstacle: None,
|
||||
|
||||
navigation_area: None,
|
||||
|
||||
navigation_link: None,
|
||||
hierarchy_sibling_index: 0,
|
||||
editor_visibility: EditorVisibility::default(),
|
||||
inspector_order: None,
|
||||
component_states: None,
|
||||
children: Vec::new(),
|
||||
};
|
||||
spawn_with_history(world, snapshot);
|
||||
|
||||
@@ -14,6 +14,7 @@ use crate::ui::helpers::ensure_player_spawn_for_edit;
|
||||
use crate::ui::hierarchy_ops::is_entity_locked;
|
||||
use crate::ui::hierarchy_state::HierarchyPanelState;
|
||||
use crate::ui::UiState;
|
||||
use crate::ui::ViewportUiState;
|
||||
use crate::viewport::actor_icons::ActorIconProxy;
|
||||
use crate::viewport::brush_edit::{BrushEditMode, BrushElementGizmo};
|
||||
use crate::viewport::brush_tool::BrushToolState;
|
||||
@@ -21,7 +22,10 @@ use crate::viewport::ViewportDisplayMode;
|
||||
use crate::visualizers::EditorVisualizerProxy;
|
||||
use bevy_egui::egui;
|
||||
|
||||
use crate::viewport::material_drop::{MaterialDropSet, MaterialDropState};
|
||||
use crate::viewport::scene_view_ray;
|
||||
use crate::viewport::terrain_paint::TerrainPaintState;
|
||||
use crate::viewport::terrain_sculpt::TerrainSculptState;
|
||||
|
||||
#[derive(Resource, Default, Debug, Clone, Copy)]
|
||||
pub struct SelectedEntity(pub Option<Entity>);
|
||||
@@ -47,6 +51,10 @@ struct PickTargetQueries<'w, 's> {
|
||||
icon_proxies: Query<'w, 's, &'static ActorIconProxy>,
|
||||
parents: Query<'w, 's, &'static ChildOf>,
|
||||
editor_only: Query<'w, 's, (), With<EditorOnly>>,
|
||||
material_drop: Option<Res<'w, MaterialDropState>>,
|
||||
terrain_sculpt: Res<'w, TerrainSculptState>,
|
||||
terrain_paint: Res<'w, TerrainPaintState>,
|
||||
viewport_ui: Res<'w, ViewportUiState>,
|
||||
}
|
||||
|
||||
impl Plugin for EditorSelectionPlugin {
|
||||
@@ -68,6 +76,7 @@ impl Plugin for EditorSelectionPlugin {
|
||||
Last,
|
||||
(handle_pick_events, cycle_overlapping_viewport_pick)
|
||||
.chain()
|
||||
.after(MaterialDropSet)
|
||||
.run_if(scene_tools_active),
|
||||
);
|
||||
}
|
||||
@@ -110,6 +119,29 @@ fn handle_pick_events(
|
||||
gizmo_targets: Query<&GizmoTarget>,
|
||||
hierarchy: Option<Res<HierarchyPanelState>>,
|
||||
) -> Result {
|
||||
if ui_state.viewport_pointer_pos.is_some_and(|pointer| {
|
||||
pick_targets
|
||||
.viewport_ui
|
||||
.toolbar_rect
|
||||
.is_some_and(|rect| rect.contains(pointer))
|
||||
}) {
|
||||
viewport_click.0 = None;
|
||||
for _ in click_events.read() {}
|
||||
return Ok(());
|
||||
}
|
||||
if pick_targets.terrain_sculpt.active || pick_targets.terrain_paint.active {
|
||||
viewport_click.0 = None;
|
||||
for _ in click_events.read() {}
|
||||
return Ok(());
|
||||
}
|
||||
if pick_targets
|
||||
.material_drop
|
||||
.as_deref()
|
||||
.is_some_and(MaterialDropState::captures_viewport_input)
|
||||
{
|
||||
viewport_click.0 = None;
|
||||
return Ok(());
|
||||
}
|
||||
if ui_state.pointer_in_viewport
|
||||
&& !buttons.any_pressed([MouseButton::Right, MouseButton::Middle])
|
||||
&& keys.just_pressed(KeyCode::Escape)
|
||||
@@ -209,6 +241,10 @@ fn handle_pick_events(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[expect(
|
||||
clippy::too_many_arguments,
|
||||
reason = "selection cycling reads independent viewport input ownership resources"
|
||||
)]
|
||||
fn cycle_overlapping_viewport_pick(
|
||||
mut ui_state: ResMut<UiState>,
|
||||
mut selected: ResMut<SelectedEntity>,
|
||||
@@ -216,7 +252,19 @@ fn cycle_overlapping_viewport_pick(
|
||||
keys: Res<ButtonInput<KeyCode>>,
|
||||
buttons: Res<ButtonInput<MouseButton>>,
|
||||
display: Res<ViewportDisplayMode>,
|
||||
material_drop: Option<Res<MaterialDropState>>,
|
||||
terrain_sculpt: Res<TerrainSculptState>,
|
||||
terrain_paint: Res<TerrainPaintState>,
|
||||
) -> Result {
|
||||
if terrain_sculpt.active || terrain_paint.active {
|
||||
return Ok(());
|
||||
}
|
||||
if material_drop
|
||||
.as_deref()
|
||||
.is_some_and(MaterialDropState::captures_viewport_input)
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
if display.clean_game_view {
|
||||
return Ok(());
|
||||
}
|
||||
@@ -397,13 +445,19 @@ fn sync_gizmo_targets(
|
||||
hierarchy: Option<Res<HierarchyPanelState>>,
|
||||
display: Res<ViewportDisplayMode>,
|
||||
brush_mode: Res<BrushEditMode>,
|
||||
terrain_sculpt: Res<TerrainSculptState>,
|
||||
terrain_paint: Res<TerrainPaintState>,
|
||||
) {
|
||||
ui_state
|
||||
.selected_entities
|
||||
.retain(|entity| transforms.contains(entity) && !editor_only.contains(entity));
|
||||
selected.0 = ui_state.selected_entities.as_slice().first().copied();
|
||||
|
||||
if display.clean_game_view || brush_mode.is_element_mode() {
|
||||
if display.clean_game_view
|
||||
|| brush_mode.is_element_mode()
|
||||
|| terrain_sculpt.active
|
||||
|| terrain_paint.active
|
||||
{
|
||||
for (entity, brush_element_gizmo) in &targets {
|
||||
if brush_element_gizmo.is_none() {
|
||||
commands.entity(entity).remove::<GizmoTarget>();
|
||||
@@ -456,6 +510,8 @@ mod tests {
|
||||
.init_resource::<SelectedEntity>()
|
||||
.init_resource::<ViewportDisplayMode>()
|
||||
.init_resource::<BrushEditMode>()
|
||||
.init_resource::<TerrainSculptState>()
|
||||
.init_resource::<TerrainPaintState>()
|
||||
.add_systems(Update, sync_gizmo_targets);
|
||||
|
||||
app.update();
|
||||
@@ -470,4 +526,50 @@ mod tests {
|
||||
assert!(app.world().get::<GizmoTarget>(first).is_some());
|
||||
assert!(app.world().get::<GizmoTarget>(second).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn terrain_sculpt_owns_pointer_without_transform_gizmo() {
|
||||
let mut app = App::new();
|
||||
let terrain = app
|
||||
.world_mut()
|
||||
.spawn((LevelObject, Transform::default(), GizmoTarget::default()))
|
||||
.id();
|
||||
let mut ui_state = UiState::default_layout();
|
||||
ui_state.selected_entities.select_replace(terrain);
|
||||
let mut sculpt = TerrainSculptState::default();
|
||||
sculpt.start(terrain);
|
||||
app.insert_resource(ui_state)
|
||||
.insert_resource(sculpt)
|
||||
.init_resource::<SelectedEntity>()
|
||||
.init_resource::<ViewportDisplayMode>()
|
||||
.init_resource::<BrushEditMode>()
|
||||
.init_resource::<TerrainPaintState>()
|
||||
.add_systems(Update, sync_gizmo_targets);
|
||||
|
||||
app.update();
|
||||
assert!(app.world().get::<GizmoTarget>(terrain).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn terrain_paint_owns_pointer_without_transform_gizmo() {
|
||||
let mut app = App::new();
|
||||
let terrain = app
|
||||
.world_mut()
|
||||
.spawn((LevelObject, Transform::default(), GizmoTarget::default()))
|
||||
.id();
|
||||
let mut ui_state = UiState::default_layout();
|
||||
ui_state.selected_entities.select_replace(terrain);
|
||||
let mut paint = TerrainPaintState::default();
|
||||
paint.start(terrain, 2);
|
||||
app.insert_resource(ui_state)
|
||||
.insert_resource(paint)
|
||||
.init_resource::<SelectedEntity>()
|
||||
.init_resource::<ViewportDisplayMode>()
|
||||
.init_resource::<BrushEditMode>()
|
||||
.init_resource::<TerrainSculptState>()
|
||||
.add_systems(Update, sync_gizmo_targets);
|
||||
|
||||
app.update();
|
||||
assert!(app.world().get::<GizmoTarget>(terrain).is_none());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,531 @@
|
||||
//! Modal terrain material-weight painting with exact cancel and grouped history.
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_egui::EguiContexts;
|
||||
use shared::{TerrainDesc, AUTHORING_COMPONENT_TERRAIN, COMPONENT_TERRAIN_DESC};
|
||||
|
||||
use super::terrain_sculpt::{active_scene_ray, smooth_falloff, terrain_ray_hit, TerrainHit};
|
||||
use crate::camera::EditorCamera;
|
||||
use crate::history::reflected_component_transaction;
|
||||
use crate::operators::{ActiveOperator, OperatorPhase, OperatorStatus};
|
||||
use crate::scene_io::SceneIo;
|
||||
use crate::selection::{SelectedEntity, ViewportClick};
|
||||
use crate::state::scene_tools_active;
|
||||
use crate::ui::UiState;
|
||||
use crate::viewport::ViewportDisplayMode;
|
||||
|
||||
const MIN_RADIUS: f32 = 0.25;
|
||||
const MAX_RADIUS: f32 = 128.0;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
pub enum TerrainPaintMode {
|
||||
#[default]
|
||||
Paint,
|
||||
Erase,
|
||||
}
|
||||
|
||||
impl TerrainPaintMode {
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::Paint => "Paint",
|
||||
Self::Erase => "Erase",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct TerrainPaintStroke {
|
||||
entity: Entity,
|
||||
original: TerrainDesc,
|
||||
last_local: Vec3,
|
||||
}
|
||||
|
||||
#[derive(Resource, Debug, Clone)]
|
||||
pub struct TerrainPaintState {
|
||||
pub active: bool,
|
||||
pub mode: TerrainPaintMode,
|
||||
pub active_layer: usize,
|
||||
pub radius: f32,
|
||||
pub strength: f32,
|
||||
hover: Option<TerrainHit>,
|
||||
stroke: Option<TerrainPaintStroke>,
|
||||
target: Option<Entity>,
|
||||
}
|
||||
|
||||
impl Default for TerrainPaintState {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
active: false,
|
||||
mode: TerrainPaintMode::Paint,
|
||||
active_layer: 1,
|
||||
radius: 4.0,
|
||||
strength: 0.35,
|
||||
hover: None,
|
||||
stroke: None,
|
||||
target: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TerrainPaintState {
|
||||
pub fn start(&mut self, target: Entity, layer_count: usize) {
|
||||
self.active = true;
|
||||
self.target = Some(target);
|
||||
self.active_layer = self.active_layer.min(layer_count.saturating_sub(1));
|
||||
}
|
||||
|
||||
pub fn stop(&mut self) {
|
||||
self.active = false;
|
||||
self.hover = None;
|
||||
self.target = None;
|
||||
}
|
||||
|
||||
pub fn is_stroking(&self) -> bool {
|
||||
self.stroke.is_some()
|
||||
}
|
||||
|
||||
pub fn clamp_settings(&mut self) {
|
||||
self.radius = self.radius.clamp(MIN_RADIUS, MAX_RADIUS);
|
||||
self.strength = self.strength.clamp(0.01, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TerrainPaintPlugin;
|
||||
|
||||
impl Plugin for TerrainPaintPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.init_resource::<TerrainPaintState>().add_systems(
|
||||
Update,
|
||||
(terrain_paint_input, draw_terrain_paint_preview)
|
||||
.chain()
|
||||
.run_if(scene_tools_active),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn terrain_paint_input(
|
||||
mut commands: Commands,
|
||||
mut state: ResMut<TerrainPaintState>,
|
||||
mut selected: ResMut<SelectedEntity>,
|
||||
keys: Res<ButtonInput<KeyCode>>,
|
||||
buttons: Res<ButtonInput<MouseButton>>,
|
||||
mut contexts: EguiContexts,
|
||||
ui_state: Res<UiState>,
|
||||
display: Res<ViewportDisplayMode>,
|
||||
cameras: Query<(&Camera, &GlobalTransform), With<EditorCamera>>,
|
||||
mut terrains: Query<(&GlobalTransform, &mut TerrainDesc)>,
|
||||
mut viewport_click: ResMut<ViewportClick>,
|
||||
mut scene_io: ResMut<SceneIo>,
|
||||
mut active_operator: ResMut<ActiveOperator>,
|
||||
) -> Result {
|
||||
if !state.active {
|
||||
return Ok(());
|
||||
}
|
||||
viewport_click.0 = None;
|
||||
state.clamp_settings();
|
||||
let Some(entity) = state.target.or(selected.0) else {
|
||||
cancel_stroke(&mut state, &mut terrains);
|
||||
state.stop();
|
||||
return Ok(());
|
||||
};
|
||||
if selected.0 != Some(entity) {
|
||||
selected.0 = Some(entity);
|
||||
}
|
||||
if display.clean_game_view {
|
||||
cancel_stroke(&mut state, &mut terrains);
|
||||
state.stop();
|
||||
return Ok(());
|
||||
}
|
||||
let ctx = contexts.ctx_mut()?;
|
||||
let cancel_requested =
|
||||
keys.just_pressed(KeyCode::Escape) || buttons.just_pressed(MouseButton::Right);
|
||||
if cancel_requested {
|
||||
if state.is_stroking() {
|
||||
cancel_stroke(&mut state, &mut terrains);
|
||||
scene_io.status = "Terrain paint stroke canceled".into();
|
||||
set_status(
|
||||
&mut active_operator,
|
||||
OperatorPhase::Canceled,
|
||||
"Weights restored",
|
||||
);
|
||||
} else {
|
||||
state.stop();
|
||||
scene_io.status = "Terrain paint tool closed".into();
|
||||
set_status(&mut active_operator, OperatorPhase::Canceled, "Tool closed");
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
let Ok((global, mut terrain)) = terrains.get_mut(entity) else {
|
||||
state.stroke = None;
|
||||
state.stop();
|
||||
return Ok(());
|
||||
};
|
||||
let layer_count = terrain.material_layers.len();
|
||||
if layer_count == 0 {
|
||||
state.stop();
|
||||
scene_io.status = "Add a terrain material layer before painting".into();
|
||||
return Ok(());
|
||||
}
|
||||
state.active_layer = state.active_layer.min(layer_count - 1);
|
||||
state.hover = ui_state
|
||||
.viewport_pointer_pos
|
||||
.and_then(|pointer| active_scene_ray(&cameras, pointer, ui_state.viewport_rect))
|
||||
.and_then(|ray| terrain_ray_hit(entity, &terrain, global, ray));
|
||||
|
||||
if buttons.just_pressed(MouseButton::Left) && !ctx.egui_wants_pointer_input() {
|
||||
if let Some(hit) = state.hover.filter(|hit| hit.entity == entity) {
|
||||
let original = terrain.clone();
|
||||
terrain.ensure_material_weights();
|
||||
apply_weight_dab(
|
||||
&mut terrain,
|
||||
hit.local,
|
||||
state.radius,
|
||||
state.strength,
|
||||
state.active_layer,
|
||||
state.mode,
|
||||
);
|
||||
state.stroke = Some(TerrainPaintStroke {
|
||||
entity,
|
||||
original,
|
||||
last_local: hit.local,
|
||||
});
|
||||
set_status(
|
||||
&mut active_operator,
|
||||
OperatorPhase::Preview,
|
||||
format!(
|
||||
"{} layer {} in progress",
|
||||
state.mode.label(),
|
||||
state.active_layer + 1
|
||||
),
|
||||
);
|
||||
}
|
||||
} else if buttons.pressed(MouseButton::Left) {
|
||||
let radius = state.radius;
|
||||
let strength = state.strength;
|
||||
let layer = state.active_layer;
|
||||
let mode = state.mode;
|
||||
if let (Some(hit), Some(stroke)) = (state.hover, state.stroke.as_mut()) {
|
||||
if hit.entity == stroke.entity {
|
||||
let step = (radius * 0.2).max(terrain.sample_spacing * 0.25);
|
||||
let delta = hit.local - stroke.last_local;
|
||||
let distance = Vec2::new(delta.x, delta.z).length();
|
||||
if distance >= step {
|
||||
let count = (distance / step).floor() as usize;
|
||||
for index in 1..=count {
|
||||
let point = stroke.last_local + delta * (index as f32 / count as f32);
|
||||
apply_weight_dab(&mut terrain, point, radius, strength, layer, mode);
|
||||
}
|
||||
stroke.last_local = hit.local;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if buttons.just_released(MouseButton::Left) {
|
||||
if let Some(stroke) = state.stroke.take() {
|
||||
let final_terrain = terrain.clone();
|
||||
let mode = state.mode;
|
||||
commands.queue(move |world: &mut World| {
|
||||
if let Err(error) = commit_paint_stroke(world, stroke, final_terrain) {
|
||||
world.resource_mut::<SceneIo>().status =
|
||||
format!("Terrain paint commit failed: {error}");
|
||||
}
|
||||
});
|
||||
scene_io.status = format!("{} terrain material weights committed", mode.label());
|
||||
set_status(
|
||||
&mut active_operator,
|
||||
OperatorPhase::Committed,
|
||||
format!("{} weights; Ctrl+Z to undo", mode.label()),
|
||||
);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn commit_paint_stroke(
|
||||
world: &mut World,
|
||||
stroke: TerrainPaintStroke,
|
||||
final_terrain: TerrainDesc,
|
||||
) -> Result<(), String> {
|
||||
if let Ok(mut actor) = world.get_entity_mut(stroke.entity) {
|
||||
actor.insert(stroke.original);
|
||||
}
|
||||
reflected_component_transaction(
|
||||
world,
|
||||
stroke.entity,
|
||||
"Paint Terrain Material",
|
||||
AUTHORING_COMPONENT_TERRAIN,
|
||||
COMPONENT_TERRAIN_DESC,
|
||||
move |world, entity| {
|
||||
world.entity_mut(entity).insert(final_terrain);
|
||||
Ok(())
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn cancel_stroke(
|
||||
state: &mut TerrainPaintState,
|
||||
terrains: &mut Query<(&GlobalTransform, &mut TerrainDesc)>,
|
||||
) {
|
||||
let Some(stroke) = state.stroke.take() else {
|
||||
return;
|
||||
};
|
||||
if let Ok((_, mut terrain)) = terrains.get_mut(stroke.entity) {
|
||||
*terrain = stroke.original;
|
||||
}
|
||||
}
|
||||
|
||||
fn set_status(active: &mut ActiveOperator, phase: OperatorPhase, hint: impl Into<String>) {
|
||||
active.status = Some(OperatorStatus {
|
||||
id: "terrain.paint".into(),
|
||||
label: "Terrain Paint".into(),
|
||||
phase,
|
||||
hint: hint.into(),
|
||||
warnings: Vec::new(),
|
||||
});
|
||||
}
|
||||
|
||||
fn apply_weight_dab(
|
||||
terrain: &mut TerrainDesc,
|
||||
center: Vec3,
|
||||
radius: f32,
|
||||
strength: f32,
|
||||
active_layer: usize,
|
||||
mode: TerrainPaintMode,
|
||||
) {
|
||||
terrain.ensure_material_weights();
|
||||
let layer_count = terrain.material_layers.len().clamp(1, 4);
|
||||
if active_layer >= layer_count {
|
||||
return;
|
||||
}
|
||||
let radius = radius.max(MIN_RADIUS);
|
||||
let half_extent = (terrain.resolution - 1) as f32 * terrain.sample_spacing * 0.5;
|
||||
for z in 0..terrain.resolution {
|
||||
for x in 0..terrain.resolution {
|
||||
let sample = Vec2::new(
|
||||
x as f32 * terrain.sample_spacing - half_extent,
|
||||
z as f32 * terrain.sample_spacing - half_extent,
|
||||
);
|
||||
let distance = sample.distance(Vec2::new(center.x, center.z));
|
||||
if distance > radius {
|
||||
continue;
|
||||
}
|
||||
let amount = strength.clamp(0.0, 1.0) * smooth_falloff(distance / radius);
|
||||
let index = (z * terrain.resolution + x) as usize;
|
||||
terrain.material_weights[index] = adjust_weights(
|
||||
terrain.material_weights[index],
|
||||
active_layer,
|
||||
layer_count,
|
||||
amount,
|
||||
mode,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn adjust_weights(
|
||||
weights: [u8; 4],
|
||||
active_layer: usize,
|
||||
layer_count: usize,
|
||||
amount: f32,
|
||||
mode: TerrainPaintMode,
|
||||
) -> [u8; 4] {
|
||||
let mut values = weights.map(|value| f32::from(value) / 255.0);
|
||||
for value in values.iter_mut().skip(layer_count) {
|
||||
*value = 0.0;
|
||||
}
|
||||
let current = values[active_layer];
|
||||
let target = match mode {
|
||||
TerrainPaintMode::Paint => current + (1.0 - current) * amount,
|
||||
TerrainPaintMode::Erase => current * (1.0 - amount),
|
||||
};
|
||||
let other_sum: f32 = values
|
||||
.iter()
|
||||
.take(layer_count)
|
||||
.enumerate()
|
||||
.filter(|(index, _)| *index != active_layer)
|
||||
.map(|(_, value)| *value)
|
||||
.sum();
|
||||
if other_sum <= f32::EPSILON {
|
||||
if layer_count == 1 {
|
||||
values[active_layer] = 1.0;
|
||||
} else {
|
||||
values.fill(0.0);
|
||||
values[active_layer] = target;
|
||||
let fallback = if active_layer == 0 { 1 } else { 0 };
|
||||
values[fallback] = 1.0 - target;
|
||||
}
|
||||
} else {
|
||||
let scale = (1.0 - target) / other_sum;
|
||||
for (index, value) in values.iter_mut().take(layer_count).enumerate() {
|
||||
if index != active_layer {
|
||||
*value *= scale;
|
||||
}
|
||||
}
|
||||
values[active_layer] = target;
|
||||
}
|
||||
quantize_weights(values, layer_count)
|
||||
}
|
||||
|
||||
fn quantize_weights(values: [f32; 4], layer_count: usize) -> [u8; 4] {
|
||||
let mut result = [0_u8; 4];
|
||||
let mut fractions = [(0_usize, 0.0_f32); 4];
|
||||
let mut assigned = 0_u16;
|
||||
for index in 0..layer_count {
|
||||
let scaled = values[index].clamp(0.0, 1.0) * 255.0;
|
||||
let floor = scaled.floor() as u8;
|
||||
result[index] = floor;
|
||||
assigned += u16::from(floor);
|
||||
fractions[index] = (index, scaled - f32::from(floor));
|
||||
}
|
||||
fractions[..layer_count].sort_by(|a, b| b.1.total_cmp(&a.1));
|
||||
for offset in 0..usize::from(255_u16 - assigned) {
|
||||
result[fractions[offset % layer_count].0] += 1;
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
fn draw_terrain_paint_preview(state: Res<TerrainPaintState>, mut gizmos: Gizmos) {
|
||||
if !state.active {
|
||||
return;
|
||||
}
|
||||
let Some(hit) = state.hover else {
|
||||
return;
|
||||
};
|
||||
let color = match state.mode {
|
||||
TerrainPaintMode::Paint => Color::srgba(0.22, 0.78, 1.0, 0.95),
|
||||
TerrainPaintMode::Erase => Color::srgba(1.0, 0.64, 0.22, 0.95),
|
||||
};
|
||||
let rotation = hit.world_rotation * Quat::from_rotation_x(std::f32::consts::FRAC_PI_2);
|
||||
gizmos
|
||||
.circle(
|
||||
Isometry3d::new(hit.world + Vec3::Y * 0.035, rotation),
|
||||
state.radius,
|
||||
color,
|
||||
)
|
||||
.resolution(48);
|
||||
gizmos.sphere(
|
||||
Isometry3d::from_translation(hit.world + Vec3::Y * 0.04),
|
||||
0.06,
|
||||
color,
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::history::{apply_command_redo, apply_command_undo, EditorHistory};
|
||||
use shared::{ActorKind, LevelObject};
|
||||
|
||||
#[test]
|
||||
fn paint_and_erase_keep_weights_exactly_normalized() {
|
||||
let painted = adjust_weights([255, 0, 0, 0], 1, 2, 0.5, TerrainPaintMode::Paint);
|
||||
assert_eq!(painted.iter().copied().map(u16::from).sum::<u16>(), 255);
|
||||
assert!(painted[1] > 0);
|
||||
let erased = adjust_weights(painted, 1, 2, 1.0, TerrainPaintMode::Erase);
|
||||
assert_eq!(erased, [255, 0, 0, 0]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dab_only_changes_samples_inside_footprint() {
|
||||
let mut terrain = TerrainDesc::flat(5);
|
||||
terrain.material_layers = vec![Default::default(), Default::default()];
|
||||
apply_weight_dab(
|
||||
&mut terrain,
|
||||
Vec3::ZERO,
|
||||
1.1,
|
||||
1.0,
|
||||
1,
|
||||
TerrainPaintMode::Paint,
|
||||
);
|
||||
assert!(terrain.material_weights[12][1] > 0);
|
||||
assert_eq!(terrain.material_weights[0], [255, 0, 0, 0]);
|
||||
assert!(terrain.validate().is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn many_dabs_commit_as_one_undoable_paint_stroke() {
|
||||
let mut app = App::new();
|
||||
app.register_type::<ActorKind>()
|
||||
.register_type::<TerrainDesc>()
|
||||
.register_type::<shared::TerrainMaterialLayer>()
|
||||
.register_type::<shared::EditorAssetRef>();
|
||||
let world = app.world_mut();
|
||||
world.init_resource::<EditorHistory>();
|
||||
world.init_resource::<SceneIo>();
|
||||
let mut original = TerrainDesc::flat(9);
|
||||
original.material_layers = vec![Default::default(), Default::default()];
|
||||
let entity = world
|
||||
.spawn((LevelObject, ActorKind::Terrain, original.clone()))
|
||||
.id();
|
||||
let mut final_terrain = original.clone();
|
||||
for x in [-2.0, 0.0, 2.0] {
|
||||
apply_weight_dab(
|
||||
&mut final_terrain,
|
||||
Vec3::new(x, 0.0, 0.0),
|
||||
2.5,
|
||||
0.5,
|
||||
1,
|
||||
TerrainPaintMode::Paint,
|
||||
);
|
||||
}
|
||||
world.entity_mut(entity).insert(final_terrain.clone());
|
||||
commit_paint_stroke(
|
||||
world,
|
||||
TerrainPaintStroke {
|
||||
entity,
|
||||
original: original.clone(),
|
||||
last_local: Vec3::ZERO,
|
||||
},
|
||||
final_terrain.clone(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(world.resource::<EditorHistory>().undo_depth(), 1);
|
||||
assert_eq!(world.get::<TerrainDesc>(entity), Some(&final_terrain));
|
||||
apply_command_undo(world);
|
||||
assert_eq!(world.get::<TerrainDesc>(entity), Some(&original));
|
||||
apply_command_redo(world);
|
||||
assert_eq!(world.get::<TerrainDesc>(entity), Some(&final_terrain));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cancel_restores_implicit_pre_stroke_weights() {
|
||||
fn cancel_once(
|
||||
mut state: ResMut<TerrainPaintState>,
|
||||
mut terrains: Query<(&GlobalTransform, &mut TerrainDesc)>,
|
||||
) {
|
||||
cancel_stroke(&mut state, &mut terrains);
|
||||
}
|
||||
|
||||
let mut app = App::new();
|
||||
let mut original = TerrainDesc::flat(5);
|
||||
original.material_layers = vec![Default::default(), Default::default()];
|
||||
let mut preview = original.clone();
|
||||
apply_weight_dab(
|
||||
&mut preview,
|
||||
Vec3::ZERO,
|
||||
3.0,
|
||||
0.8,
|
||||
1,
|
||||
TerrainPaintMode::Paint,
|
||||
);
|
||||
let entity = app
|
||||
.world_mut()
|
||||
.spawn((GlobalTransform::default(), preview))
|
||||
.id();
|
||||
let mut state = TerrainPaintState::default();
|
||||
state.start(entity, 2);
|
||||
state.stroke = Some(TerrainPaintStroke {
|
||||
entity,
|
||||
original: original.clone(),
|
||||
last_local: Vec3::ZERO,
|
||||
});
|
||||
app.insert_resource(state).add_systems(Update, cancel_once);
|
||||
|
||||
app.update();
|
||||
assert_eq!(app.world().get::<TerrainDesc>(entity), Some(&original));
|
||||
assert!(!app.world().resource::<TerrainPaintState>().is_stroking());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,741 @@
|
||||
//! Modal terrain height sculpting with one history transaction per pointer stroke.
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_egui::EguiContexts;
|
||||
use shared::{TerrainDesc, AUTHORING_COMPONENT_TERRAIN, COMPONENT_TERRAIN_DESC};
|
||||
|
||||
use crate::camera::EditorCamera;
|
||||
use crate::history::reflected_component_transaction;
|
||||
use crate::operators::{ActiveOperator, OperatorPhase, OperatorStatus};
|
||||
use crate::scene_io::SceneIo;
|
||||
use crate::selection::{SelectedEntity, ViewportClick};
|
||||
use crate::state::scene_tools_active;
|
||||
use crate::ui::UiState;
|
||||
use crate::viewport::{scene_view_ray, ViewportDisplayMode};
|
||||
|
||||
const MIN_RADIUS: f32 = 0.25;
|
||||
const MAX_RADIUS: f32 = 128.0;
|
||||
const MIN_STRENGTH: f32 = 0.01;
|
||||
const MAX_STRENGTH: f32 = 20.0;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
||||
pub enum TerrainSculptMode {
|
||||
#[default]
|
||||
Raise,
|
||||
Lower,
|
||||
Flatten,
|
||||
Smooth,
|
||||
Noise,
|
||||
}
|
||||
|
||||
impl TerrainSculptMode {
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::Raise => "Raise",
|
||||
Self::Lower => "Lower",
|
||||
Self::Flatten => "Flatten",
|
||||
Self::Smooth => "Smooth",
|
||||
Self::Noise => "Noise",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub(super) struct TerrainHit {
|
||||
pub(super) entity: Entity,
|
||||
pub(super) local: Vec3,
|
||||
pub(super) world: Vec3,
|
||||
pub(super) world_rotation: Quat,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct TerrainStroke {
|
||||
entity: Entity,
|
||||
original: TerrainDesc,
|
||||
last_local: Vec3,
|
||||
flatten_height: f32,
|
||||
seed: u32,
|
||||
}
|
||||
|
||||
#[derive(Resource, Debug, Clone)]
|
||||
pub struct TerrainSculptState {
|
||||
pub active: bool,
|
||||
pub mode: TerrainSculptMode,
|
||||
pub radius: f32,
|
||||
/// Approximate world-space height delta per dab.
|
||||
pub strength: f32,
|
||||
hover: Option<TerrainHit>,
|
||||
stroke: Option<TerrainStroke>,
|
||||
target: Option<Entity>,
|
||||
next_seed: u32,
|
||||
}
|
||||
|
||||
impl Default for TerrainSculptState {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
active: false,
|
||||
mode: TerrainSculptMode::Raise,
|
||||
radius: 4.0,
|
||||
strength: 0.35,
|
||||
hover: None,
|
||||
stroke: None,
|
||||
target: None,
|
||||
next_seed: 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TerrainSculptState {
|
||||
pub fn start(&mut self, target: Entity) {
|
||||
self.active = true;
|
||||
self.target = Some(target);
|
||||
}
|
||||
|
||||
pub fn stop(&mut self) {
|
||||
self.active = false;
|
||||
self.hover = None;
|
||||
self.target = None;
|
||||
}
|
||||
|
||||
pub fn is_stroking(&self) -> bool {
|
||||
self.stroke.is_some()
|
||||
}
|
||||
|
||||
pub fn clamp_settings(&mut self) {
|
||||
self.radius = self.radius.clamp(MIN_RADIUS, MAX_RADIUS);
|
||||
self.strength = self.strength.clamp(MIN_STRENGTH, MAX_STRENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TerrainSculptPlugin;
|
||||
|
||||
impl Plugin for TerrainSculptPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.init_resource::<TerrainSculptState>().add_systems(
|
||||
Update,
|
||||
(terrain_sculpt_input, draw_terrain_sculpt_preview)
|
||||
.chain()
|
||||
.run_if(scene_tools_active),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn terrain_sculpt_input(
|
||||
mut commands: Commands,
|
||||
mut state: ResMut<TerrainSculptState>,
|
||||
mut selected: ResMut<SelectedEntity>,
|
||||
keys: Res<ButtonInput<KeyCode>>,
|
||||
buttons: Res<ButtonInput<MouseButton>>,
|
||||
mut contexts: EguiContexts,
|
||||
ui_state: Res<UiState>,
|
||||
display: Res<ViewportDisplayMode>,
|
||||
cameras: Query<(&Camera, &GlobalTransform), With<EditorCamera>>,
|
||||
mut terrains: Query<(&GlobalTransform, &mut TerrainDesc)>,
|
||||
mut viewport_click: ResMut<ViewportClick>,
|
||||
mut scene_io: ResMut<SceneIo>,
|
||||
mut active_operator: ResMut<ActiveOperator>,
|
||||
) -> Result {
|
||||
if !state.active {
|
||||
return Ok(());
|
||||
}
|
||||
viewport_click.0 = None;
|
||||
state.clamp_settings();
|
||||
|
||||
let Some(entity) = state.target.or(selected.0) else {
|
||||
cancel_stroke(&mut state, &mut terrains);
|
||||
state.stop();
|
||||
return Ok(());
|
||||
};
|
||||
if selected.0 != Some(entity) {
|
||||
selected.0 = Some(entity);
|
||||
}
|
||||
|
||||
if display.clean_game_view {
|
||||
cancel_stroke(&mut state, &mut terrains);
|
||||
state.stop();
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let ctx = contexts.ctx_mut()?;
|
||||
let pointer_over_ui = ctx.egui_wants_pointer_input();
|
||||
let cancel_requested =
|
||||
keys.just_pressed(KeyCode::Escape) || buttons.just_pressed(MouseButton::Right);
|
||||
if cancel_requested {
|
||||
if state.is_stroking() {
|
||||
cancel_stroke(&mut state, &mut terrains);
|
||||
scene_io.status = "Terrain sculpt stroke canceled".to_string();
|
||||
set_status(
|
||||
&mut active_operator,
|
||||
OperatorPhase::Canceled,
|
||||
"Stroke canceled; terrain restored",
|
||||
);
|
||||
} else {
|
||||
state.stop();
|
||||
scene_io.status = "Terrain sculpt tool closed".to_string();
|
||||
set_status(&mut active_operator, OperatorPhase::Canceled, "Tool closed");
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let Ok((global, mut terrain)) = terrains.get_mut(entity) else {
|
||||
state.stroke = None;
|
||||
state.stop();
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
let hit = ui_state
|
||||
.viewport_pointer_pos
|
||||
.and_then(|pointer| active_scene_ray(&cameras, pointer, ui_state.viewport_rect))
|
||||
.and_then(|ray| terrain_ray_hit(entity, &terrain, global, ray));
|
||||
state.hover = hit;
|
||||
|
||||
if buttons.just_pressed(MouseButton::Left) && !pointer_over_ui {
|
||||
if let Some(hit) = state.hover.filter(|hit| hit.entity == entity) {
|
||||
let flatten_height =
|
||||
sample_height_bilinear(&terrain, hit.local.x, hit.local.z).unwrap_or_default();
|
||||
let seed = state.next_seed;
|
||||
state.next_seed = state.next_seed.wrapping_add(1).max(1);
|
||||
state.stroke = Some(TerrainStroke {
|
||||
entity,
|
||||
original: terrain.clone(),
|
||||
last_local: hit.local,
|
||||
flatten_height,
|
||||
seed,
|
||||
});
|
||||
apply_dab(
|
||||
&mut terrain,
|
||||
hit.local,
|
||||
state.radius,
|
||||
state.strength,
|
||||
state.mode,
|
||||
flatten_height,
|
||||
seed,
|
||||
);
|
||||
set_status(
|
||||
&mut active_operator,
|
||||
OperatorPhase::Preview,
|
||||
format!("{} stroke in progress", state.mode.label()),
|
||||
);
|
||||
}
|
||||
} else if buttons.pressed(MouseButton::Left) {
|
||||
let radius = state.radius;
|
||||
let strength = state.strength;
|
||||
let mode = state.mode;
|
||||
if let (Some(hit), Some(stroke)) = (state.hover, state.stroke.as_mut()) {
|
||||
if hit.entity == stroke.entity {
|
||||
let step = (radius * 0.2).max(terrain.sample_spacing * 0.25);
|
||||
let delta = hit.local - stroke.last_local;
|
||||
let distance = Vec2::new(delta.x, delta.z).length();
|
||||
if distance >= step {
|
||||
let count = (distance / step).floor() as usize;
|
||||
for index in 1..=count {
|
||||
let point = stroke.last_local + delta * (index as f32 / count as f32);
|
||||
apply_dab(
|
||||
&mut terrain,
|
||||
point,
|
||||
radius,
|
||||
strength,
|
||||
mode,
|
||||
stroke.flatten_height,
|
||||
stroke.seed,
|
||||
);
|
||||
}
|
||||
stroke.last_local = hit.local;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if buttons.just_released(MouseButton::Left) {
|
||||
if let Some(stroke) = state.stroke.take() {
|
||||
let final_terrain = terrain.clone();
|
||||
let label = sculpt_history_label(state.mode);
|
||||
let mode_label = state.mode.label();
|
||||
commands.queue(move |world: &mut World| {
|
||||
let result = commit_terrain_stroke(world, stroke, final_terrain, label);
|
||||
if let Err(error) = result {
|
||||
world.resource_mut::<SceneIo>().status =
|
||||
format!("Terrain sculpt commit failed: {error}");
|
||||
}
|
||||
});
|
||||
scene_io.status = format!("{mode_label} terrain stroke committed");
|
||||
set_status(
|
||||
&mut active_operator,
|
||||
OperatorPhase::Committed,
|
||||
format!("{mode_label} stroke; Ctrl+Z to undo"),
|
||||
);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn commit_terrain_stroke(
|
||||
world: &mut World,
|
||||
stroke: TerrainStroke,
|
||||
final_terrain: TerrainDesc,
|
||||
label: &'static str,
|
||||
) -> Result<(), String> {
|
||||
if let Ok(mut actor) = world.get_entity_mut(stroke.entity) {
|
||||
actor.insert(stroke.original);
|
||||
}
|
||||
reflected_component_transaction(
|
||||
world,
|
||||
stroke.entity,
|
||||
label,
|
||||
AUTHORING_COMPONENT_TERRAIN,
|
||||
COMPONENT_TERRAIN_DESC,
|
||||
move |world, entity| {
|
||||
world.entity_mut(entity).insert(final_terrain);
|
||||
Ok(())
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn cancel_stroke(
|
||||
state: &mut TerrainSculptState,
|
||||
terrains: &mut Query<(&GlobalTransform, &mut TerrainDesc)>,
|
||||
) {
|
||||
let Some(stroke) = state.stroke.take() else {
|
||||
return;
|
||||
};
|
||||
if let Ok((_, mut terrain)) = terrains.get_mut(stroke.entity) {
|
||||
*terrain = stroke.original;
|
||||
}
|
||||
}
|
||||
|
||||
fn set_status(active: &mut ActiveOperator, phase: OperatorPhase, hint: impl Into<String>) {
|
||||
active.status = Some(OperatorStatus {
|
||||
id: "terrain.sculpt".to_string(),
|
||||
label: "Terrain Sculpt".to_string(),
|
||||
phase,
|
||||
hint: hint.into(),
|
||||
warnings: Vec::new(),
|
||||
});
|
||||
}
|
||||
|
||||
fn sculpt_history_label(mode: TerrainSculptMode) -> &'static str {
|
||||
match mode {
|
||||
TerrainSculptMode::Raise => "Raise Terrain",
|
||||
TerrainSculptMode::Lower => "Lower Terrain",
|
||||
TerrainSculptMode::Flatten => "Flatten Terrain",
|
||||
TerrainSculptMode::Smooth => "Smooth Terrain",
|
||||
TerrainSculptMode::Noise => "Noise Terrain",
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn active_scene_ray(
|
||||
cameras: &Query<(&Camera, &GlobalTransform), With<EditorCamera>>,
|
||||
pointer: bevy_egui::egui::Pos2,
|
||||
scene_rect: bevy_egui::egui::Rect,
|
||||
) -> Option<Ray3d> {
|
||||
let (camera, transform) = cameras
|
||||
.iter()
|
||||
.find(|(camera, _)| camera.is_active)
|
||||
.or_else(|| cameras.iter().next())?;
|
||||
scene_view_ray(camera, transform, pointer, scene_rect)
|
||||
}
|
||||
|
||||
pub(super) fn terrain_ray_hit(
|
||||
entity: Entity,
|
||||
terrain: &TerrainDesc,
|
||||
global: &GlobalTransform,
|
||||
ray: Ray3d,
|
||||
) -> Option<TerrainHit> {
|
||||
let world_from_local = global.affine();
|
||||
let local_from_world = world_from_local.inverse();
|
||||
let origin = local_from_world.transform_point3(ray.origin);
|
||||
let direction = local_from_world.transform_vector3(ray.direction.as_vec3());
|
||||
let local = ray_heightfield_intersection(terrain, origin, direction)?;
|
||||
Some(TerrainHit {
|
||||
entity,
|
||||
local,
|
||||
world: world_from_local.transform_point3(local),
|
||||
world_rotation: global.rotation(),
|
||||
})
|
||||
}
|
||||
|
||||
fn ray_heightfield_intersection(
|
||||
terrain: &TerrainDesc,
|
||||
origin: Vec3,
|
||||
direction: Vec3,
|
||||
) -> Option<Vec3> {
|
||||
if terrain.validate().is_err() || direction.length_squared() <= f32::EPSILON {
|
||||
return None;
|
||||
}
|
||||
let horizontal_speed = Vec2::new(direction.x, direction.z).length();
|
||||
if horizontal_speed <= 1.0e-6 {
|
||||
if direction.y.abs() <= 1.0e-6 {
|
||||
return None;
|
||||
}
|
||||
let height = sample_height_bilinear(terrain, origin.x, origin.z)?;
|
||||
let t = (height - origin.y) / direction.y;
|
||||
return (t >= 0.0).then_some(origin + direction * t);
|
||||
}
|
||||
let half_extent = (terrain.resolution - 1) as f32 * terrain.sample_spacing * 0.5;
|
||||
let (mut start, mut end) = (0.0_f32, f32::INFINITY);
|
||||
for (origin_axis, direction_axis) in [(origin.x, direction.x), (origin.z, direction.z)] {
|
||||
if direction_axis.abs() <= 1.0e-6 {
|
||||
if origin_axis < -half_extent || origin_axis > half_extent {
|
||||
return None;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
let a = (-half_extent - origin_axis) / direction_axis;
|
||||
let b = (half_extent - origin_axis) / direction_axis;
|
||||
start = start.max(a.min(b));
|
||||
end = end.min(a.max(b));
|
||||
}
|
||||
if end < start || end < 0.0 {
|
||||
return None;
|
||||
}
|
||||
start = start.max(0.0);
|
||||
|
||||
let span = (end - start).max(0.0);
|
||||
let steps = ((span * horizontal_speed) / (terrain.sample_spacing * 0.4))
|
||||
.ceil()
|
||||
.clamp(1.0, 8192.0) as usize;
|
||||
let surface_delta = |t: f32| {
|
||||
let point = origin + direction * t;
|
||||
sample_height_bilinear(terrain, point.x, point.z).map(|height| point.y - height)
|
||||
};
|
||||
let mut previous_t = start;
|
||||
let mut previous = surface_delta(start)?;
|
||||
if previous.abs() <= 1.0e-4 {
|
||||
return Some(origin + direction * start);
|
||||
}
|
||||
for step in 1..=steps {
|
||||
let t = start + span * (step as f32 / steps as f32);
|
||||
let current = surface_delta(t)?;
|
||||
if current.signum() != previous.signum() || current.abs() <= 1.0e-4 {
|
||||
let (mut low, mut high) = (previous_t, t);
|
||||
let low_sign = previous.signum();
|
||||
for _ in 0..14 {
|
||||
let middle = (low + high) * 0.5;
|
||||
let delta = surface_delta(middle)?;
|
||||
if delta.signum() == low_sign {
|
||||
low = middle;
|
||||
} else {
|
||||
high = middle;
|
||||
}
|
||||
}
|
||||
let hit_t = (low + high) * 0.5;
|
||||
return Some(origin + direction * hit_t);
|
||||
}
|
||||
previous_t = t;
|
||||
previous = current;
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn sample_height_bilinear(terrain: &TerrainDesc, local_x: f32, local_z: f32) -> Option<f32> {
|
||||
let half_extent = (terrain.resolution - 1) as f32 * terrain.sample_spacing * 0.5;
|
||||
let x = (local_x + half_extent) / terrain.sample_spacing;
|
||||
let z = (local_z + half_extent) / terrain.sample_spacing;
|
||||
let max = (terrain.resolution - 1) as f32;
|
||||
if x < 0.0 || z < 0.0 || x > max || z > max {
|
||||
return None;
|
||||
}
|
||||
let x0 = x.floor() as u32;
|
||||
let z0 = z.floor() as u32;
|
||||
let x1 = (x0 + 1).min(terrain.resolution - 1);
|
||||
let z1 = (z0 + 1).min(terrain.resolution - 1);
|
||||
let sample = |sx: u32, sz: u32| {
|
||||
terrain.heights[(sz * terrain.resolution + sx) as usize] * terrain.height_scale
|
||||
};
|
||||
let top = sample(x0, z0).lerp(sample(x1, z0), x - x0 as f32);
|
||||
let bottom = sample(x0, z1).lerp(sample(x1, z1), x - x0 as f32);
|
||||
Some(top.lerp(bottom, z - z0 as f32))
|
||||
}
|
||||
|
||||
fn apply_dab(
|
||||
terrain: &mut TerrainDesc,
|
||||
center: Vec3,
|
||||
radius: f32,
|
||||
strength: f32,
|
||||
mode: TerrainSculptMode,
|
||||
flatten_height: f32,
|
||||
seed: u32,
|
||||
) {
|
||||
let radius = radius.max(MIN_RADIUS);
|
||||
let resolution = terrain.resolution;
|
||||
let half_extent = (resolution - 1) as f32 * terrain.sample_spacing * 0.5;
|
||||
let source = terrain.heights.clone();
|
||||
let normalized_strength = strength / terrain.height_scale.max(0.01);
|
||||
for z in 0..resolution {
|
||||
for x in 0..resolution {
|
||||
let sample_position = Vec2::new(
|
||||
x as f32 * terrain.sample_spacing - half_extent,
|
||||
z as f32 * terrain.sample_spacing - half_extent,
|
||||
);
|
||||
let distance = sample_position.distance(Vec2::new(center.x, center.z));
|
||||
if distance > radius {
|
||||
continue;
|
||||
}
|
||||
let falloff = smooth_falloff(distance / radius);
|
||||
let index = (z * resolution + x) as usize;
|
||||
let current = source[index];
|
||||
let next = match mode {
|
||||
TerrainSculptMode::Raise => current + normalized_strength * falloff,
|
||||
TerrainSculptMode::Lower => current - normalized_strength * falloff,
|
||||
TerrainSculptMode::Flatten => {
|
||||
let target = flatten_height / terrain.height_scale.max(0.01);
|
||||
current.lerp(target, (normalized_strength * falloff).clamp(0.0, 1.0))
|
||||
}
|
||||
TerrainSculptMode::Smooth => {
|
||||
let average = neighbor_average(&source, resolution, x, z);
|
||||
current.lerp(average, (normalized_strength * falloff).clamp(0.0, 1.0))
|
||||
}
|
||||
TerrainSculptMode::Noise => {
|
||||
current + signed_noise(x, z, seed) * normalized_strength * falloff
|
||||
}
|
||||
};
|
||||
terrain.heights[index] = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn smooth_falloff(normalized_distance: f32) -> f32 {
|
||||
let t = (1.0 - normalized_distance).clamp(0.0, 1.0);
|
||||
t * t * (3.0 - 2.0 * t)
|
||||
}
|
||||
|
||||
fn neighbor_average(heights: &[f32], resolution: u32, x: u32, z: u32) -> f32 {
|
||||
let mut sum = 0.0;
|
||||
let mut count = 0;
|
||||
for dz in -1_i32..=1 {
|
||||
for dx in -1_i32..=1 {
|
||||
let sx = x as i32 + dx;
|
||||
let sz = z as i32 + dz;
|
||||
if sx >= 0 && sz >= 0 && sx < resolution as i32 && sz < resolution as i32 {
|
||||
sum += heights[(sz as u32 * resolution + sx as u32) as usize];
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
sum / count as f32
|
||||
}
|
||||
|
||||
fn signed_noise(x: u32, z: u32, seed: u32) -> f32 {
|
||||
let mut value = x
|
||||
.wrapping_mul(0x9e37_79b9)
|
||||
.wrapping_add(z.wrapping_mul(0x85eb_ca6b))
|
||||
.wrapping_add(seed.wrapping_mul(0xc2b2_ae35));
|
||||
value ^= value >> 16;
|
||||
value = value.wrapping_mul(0x7feb_352d);
|
||||
value ^= value >> 15;
|
||||
value = value.wrapping_mul(0x846c_a68b);
|
||||
value ^= value >> 16;
|
||||
(value as f32 / u32::MAX as f32) * 2.0 - 1.0
|
||||
}
|
||||
|
||||
fn draw_terrain_sculpt_preview(state: Res<TerrainSculptState>, mut gizmos: Gizmos) {
|
||||
if !state.active {
|
||||
return;
|
||||
}
|
||||
let Some(hit) = state.hover else {
|
||||
return;
|
||||
};
|
||||
let color = match state.mode {
|
||||
TerrainSculptMode::Raise => Color::srgba(0.30, 0.92, 0.58, 0.95),
|
||||
TerrainSculptMode::Lower => Color::srgba(0.96, 0.36, 0.32, 0.95),
|
||||
TerrainSculptMode::Flatten => Color::srgba(0.32, 0.72, 1.0, 0.95),
|
||||
TerrainSculptMode::Smooth => Color::srgba(0.72, 0.56, 1.0, 0.95),
|
||||
TerrainSculptMode::Noise => Color::srgba(1.0, 0.76, 0.28, 0.95),
|
||||
};
|
||||
let rotation = hit.world_rotation * Quat::from_rotation_x(std::f32::consts::FRAC_PI_2);
|
||||
gizmos
|
||||
.circle(
|
||||
Isometry3d::new(hit.world + Vec3::Y * 0.03, rotation),
|
||||
state.radius,
|
||||
color,
|
||||
)
|
||||
.resolution(48);
|
||||
gizmos.sphere(
|
||||
Isometry3d::from_translation(hit.world + Vec3::Y * 0.035),
|
||||
0.06,
|
||||
color,
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::history::{apply_command_redo, apply_command_undo, EditorHistory};
|
||||
use shared::{ActorKind, LevelObject};
|
||||
|
||||
fn sample(terrain: &TerrainDesc, x: u32, z: u32) -> f32 {
|
||||
terrain.heights[(z * terrain.resolution + x) as usize]
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vertical_ray_hits_heightfield_surface() {
|
||||
let mut terrain = TerrainDesc::flat(3);
|
||||
terrain.height_scale = 2.0;
|
||||
terrain.heights[4] = 1.0;
|
||||
let hit = ray_heightfield_intersection(&terrain, Vec3::new(0.0, 5.0, 0.0), Vec3::NEG_Y)
|
||||
.expect("ray should hit center sample");
|
||||
assert!((hit.y - 2.0).abs() < 0.001);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn raise_and_lower_only_touch_brush_footprint() {
|
||||
let mut terrain = TerrainDesc::flat(5);
|
||||
apply_dab(
|
||||
&mut terrain,
|
||||
Vec3::ZERO,
|
||||
1.1,
|
||||
1.0,
|
||||
TerrainSculptMode::Raise,
|
||||
0.0,
|
||||
1,
|
||||
);
|
||||
assert!(sample(&terrain, 2, 2) > 0.0);
|
||||
assert_eq!(sample(&terrain, 0, 0), 0.0);
|
||||
let raised = sample(&terrain, 2, 2);
|
||||
apply_dab(
|
||||
&mut terrain,
|
||||
Vec3::ZERO,
|
||||
1.1,
|
||||
1.0,
|
||||
TerrainSculptMode::Lower,
|
||||
0.0,
|
||||
1,
|
||||
);
|
||||
assert!(sample(&terrain, 2, 2) < raised);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flatten_and_smooth_converge_toward_targets() {
|
||||
let mut terrain = TerrainDesc::flat(3);
|
||||
terrain.height_scale = 1.0;
|
||||
terrain.heights[4] = 4.0;
|
||||
apply_dab(
|
||||
&mut terrain,
|
||||
Vec3::ZERO,
|
||||
2.0,
|
||||
1.0,
|
||||
TerrainSculptMode::Smooth,
|
||||
0.0,
|
||||
2,
|
||||
);
|
||||
assert!(sample(&terrain, 1, 1) < 4.0);
|
||||
apply_dab(
|
||||
&mut terrain,
|
||||
Vec3::ZERO,
|
||||
2.0,
|
||||
0.5,
|
||||
TerrainSculptMode::Flatten,
|
||||
2.0,
|
||||
2,
|
||||
);
|
||||
assert!(sample(&terrain, 1, 1) > 0.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn noise_is_deterministic_for_stroke_seed() {
|
||||
let mut first = TerrainDesc::flat(5);
|
||||
let mut second = first.clone();
|
||||
for terrain in [&mut first, &mut second] {
|
||||
apply_dab(
|
||||
terrain,
|
||||
Vec3::ZERO,
|
||||
3.0,
|
||||
0.4,
|
||||
TerrainSculptMode::Noise,
|
||||
0.0,
|
||||
42,
|
||||
);
|
||||
}
|
||||
assert_eq!(first.heights, second.heights);
|
||||
assert!(first.heights.iter().any(|height| *height != 0.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn many_dabs_commit_as_one_undoable_stroke() {
|
||||
let mut app = App::new();
|
||||
app.register_type::<ActorKind>()
|
||||
.register_type::<TerrainDesc>();
|
||||
let world = app.world_mut();
|
||||
world.init_resource::<EditorHistory>();
|
||||
world.init_resource::<SceneIo>();
|
||||
let original = TerrainDesc::flat(9);
|
||||
let entity = world
|
||||
.spawn((LevelObject, ActorKind::Terrain, original.clone()))
|
||||
.id();
|
||||
let mut final_terrain = original.clone();
|
||||
for x in [-2.0, 0.0, 2.0] {
|
||||
apply_dab(
|
||||
&mut final_terrain,
|
||||
Vec3::new(x, 0.0, 0.0),
|
||||
2.5,
|
||||
0.4,
|
||||
TerrainSculptMode::Raise,
|
||||
0.0,
|
||||
7,
|
||||
);
|
||||
}
|
||||
world.entity_mut(entity).insert(final_terrain.clone());
|
||||
commit_terrain_stroke(
|
||||
world,
|
||||
TerrainStroke {
|
||||
entity,
|
||||
original: original.clone(),
|
||||
last_local: Vec3::ZERO,
|
||||
flatten_height: 0.0,
|
||||
seed: 7,
|
||||
},
|
||||
final_terrain.clone(),
|
||||
"Raise Terrain",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(world.resource::<EditorHistory>().undo_depth(), 1);
|
||||
assert_eq!(world.get::<TerrainDesc>(entity), Some(&final_terrain));
|
||||
apply_command_undo(world);
|
||||
assert_eq!(world.get::<TerrainDesc>(entity), Some(&original));
|
||||
apply_command_redo(world);
|
||||
assert_eq!(world.get::<TerrainDesc>(entity), Some(&final_terrain));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cancel_restores_exact_pre_stroke_descriptor() {
|
||||
fn cancel_once(
|
||||
mut state: ResMut<TerrainSculptState>,
|
||||
mut terrains: Query<(&GlobalTransform, &mut TerrainDesc)>,
|
||||
) {
|
||||
cancel_stroke(&mut state, &mut terrains);
|
||||
}
|
||||
|
||||
let mut app = App::new();
|
||||
let original = TerrainDesc::flat(5);
|
||||
let mut preview = original.clone();
|
||||
apply_dab(
|
||||
&mut preview,
|
||||
Vec3::ZERO,
|
||||
3.0,
|
||||
0.8,
|
||||
TerrainSculptMode::Raise,
|
||||
0.0,
|
||||
11,
|
||||
);
|
||||
let entity = app
|
||||
.world_mut()
|
||||
.spawn((GlobalTransform::default(), preview))
|
||||
.id();
|
||||
let mut state = TerrainSculptState::default();
|
||||
state.start(entity);
|
||||
state.stroke = Some(TerrainStroke {
|
||||
entity,
|
||||
original: original.clone(),
|
||||
last_local: Vec3::ZERO,
|
||||
flatten_height: 0.0,
|
||||
seed: 11,
|
||||
});
|
||||
app.insert_resource(state).add_systems(Update, cancel_once);
|
||||
|
||||
app.update();
|
||||
assert_eq!(app.world().get::<TerrainDesc>(entity), Some(&original));
|
||||
assert!(!app.world().resource::<TerrainSculptState>().is_stroking());
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,9 @@ use bevy::ecs::system::SystemParam;
|
||||
use bevy::prelude::*;
|
||||
use shared::{
|
||||
AudioListenerDesc, AudioSourceDesc, AuthoringLightKind, ColliderDesc, ColliderShapeDesc,
|
||||
LevelObject, LightDesc, ModelRef, ObjectiveMarker, PhysicsBody, PlayerSpawn,
|
||||
PostProcessVolumeDesc, PrefabRef, ProjectSun, RaytracingExcluded, TeamSpawn, TriggerVolume,
|
||||
LevelObject, LightDesc, ModelRef, NavigationArea, NavigationBounds, NavigationLink,
|
||||
NavigationObstacle, ObjectiveMarker, PhysicsBody, PlayerSpawn, PostProcessVolumeDesc,
|
||||
PrefabRef, ProjectSun, RaytracingExcluded, SkinnedMeshRenderer, TeamSpawn, TriggerVolume,
|
||||
WeaponSpawn,
|
||||
};
|
||||
use sim::tuning::{EYE_OFFSET_STAND, PLAYER_LENGTH, PLAYER_RADIUS};
|
||||
@@ -107,7 +108,15 @@ struct VisualizerTargetQueries<'w, 's> {
|
||||
lights: Query<'w, 's, Entity, (With<LevelObject>, With<LightDesc>)>,
|
||||
spawns: Query<'w, 's, Entity, (With<LevelObject>, With<PlayerSpawn>)>,
|
||||
prefabs: Query<'w, 's, Entity, (With<LevelObject>, With<PrefabRef>)>,
|
||||
models: Query<'w, 's, Entity, (With<LevelObject>, With<ModelRef>)>,
|
||||
models: Query<
|
||||
'w,
|
||||
's,
|
||||
Entity,
|
||||
(
|
||||
With<LevelObject>,
|
||||
Or<(With<ModelRef>, With<SkinnedMeshRenderer>)>,
|
||||
),
|
||||
>,
|
||||
players: Query<'w, 's, Entity, With<Player>>,
|
||||
cameras: Query<'w, 's, Entity, With<PlayerCamera>>,
|
||||
project_suns: Query<'w, 's, Entity, With<ProjectSun>>,
|
||||
@@ -127,6 +136,7 @@ impl Plugin for EditorVisualizersPlugin {
|
||||
draw_audio_visualizers,
|
||||
draw_split_collider_visualizers,
|
||||
draw_post_process_volume_gizmos,
|
||||
draw_navigation_visualizers,
|
||||
)
|
||||
.chain()
|
||||
.run_if(scene_tools_active)
|
||||
@@ -135,6 +145,131 @@ impl Plugin for EditorVisualizersPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_navigation_visualizers(
|
||||
state: Res<crate::ui::navigation_inspector::NavigationEditorState>,
|
||||
mut gizmos: Gizmos,
|
||||
bounds: Query<(&NavigationBounds, &GlobalTransform), With<LevelObject>>,
|
||||
obstacles: Query<(&NavigationObstacle, &GlobalTransform), With<LevelObject>>,
|
||||
areas: Query<(&NavigationArea, &GlobalTransform), With<LevelObject>>,
|
||||
links: Query<(&NavigationLink, &GlobalTransform), With<LevelObject>>,
|
||||
) {
|
||||
for (value, global) in &bounds {
|
||||
let half_extents = crate::ui::navigation_inspector::world_aabb_half_extents(
|
||||
global.affine(),
|
||||
value.half_extents,
|
||||
);
|
||||
let center = global.translation();
|
||||
draw_box(
|
||||
&mut gizmos,
|
||||
center,
|
||||
Quat::IDENTITY,
|
||||
half_extents,
|
||||
Color::srgba(0.12, 0.82, 0.78, 0.72),
|
||||
);
|
||||
}
|
||||
for (value, global) in &obstacles {
|
||||
let half_extents = crate::ui::navigation_inspector::world_aabb_half_extents(
|
||||
global.affine(),
|
||||
value.half_extents,
|
||||
);
|
||||
let center = global.translation();
|
||||
draw_box(
|
||||
&mut gizmos,
|
||||
center,
|
||||
Quat::IDENTITY,
|
||||
half_extents,
|
||||
Color::srgba(1.0, 0.28, 0.22, 0.78),
|
||||
);
|
||||
}
|
||||
for (value, global) in &areas {
|
||||
let half_extents = crate::ui::navigation_inspector::world_aabb_half_extents(
|
||||
global.affine(),
|
||||
value.half_extents,
|
||||
);
|
||||
let center = global.translation();
|
||||
let color = if value.walkable {
|
||||
Color::srgba(0.32, 0.72, 1.0, 0.62)
|
||||
} else {
|
||||
Color::srgba(1.0, 0.55, 0.18, 0.72)
|
||||
};
|
||||
draw_box(&mut gizmos, center, Quat::IDENTITY, half_extents, color);
|
||||
}
|
||||
for (value, global) in &links {
|
||||
let start = global.transform_point(value.start);
|
||||
let end = global.transform_point(value.end);
|
||||
let color = if value.enabled {
|
||||
Color::srgba(0.95, 0.78, 0.22, 0.95)
|
||||
} else {
|
||||
Color::srgba(0.48, 0.48, 0.5, 0.55)
|
||||
};
|
||||
gizmos.line(start, end, color);
|
||||
gizmos
|
||||
.sphere(Isometry3d::from_translation(start), 0.11, color)
|
||||
.resolution(12);
|
||||
gizmos
|
||||
.sphere(Isometry3d::from_translation(end), 0.11, color)
|
||||
.resolution(12);
|
||||
}
|
||||
|
||||
if state.show_mesh {
|
||||
if let Some(artifact) = &state.artifact {
|
||||
for layer in &artifact.mesh.layers {
|
||||
for polygon in &layer.polygons {
|
||||
for index in 0..polygon.vertices.len() {
|
||||
let a_index = polygon.vertices[index] as usize;
|
||||
let b_index =
|
||||
polygon.vertices[(index + 1) % polygon.vertices.len()] as usize;
|
||||
let Some(a) = navigation_vertex(layer, a_index) else {
|
||||
continue;
|
||||
};
|
||||
let Some(b) = navigation_vertex(layer, b_index) else {
|
||||
continue;
|
||||
};
|
||||
gizmos.line(
|
||||
a + Vec3::Y * 0.025,
|
||||
b + Vec3::Y * 0.025,
|
||||
Color::srgba(0.08, 0.9, 0.72, 0.7),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for edge in state.preview_path.windows(2) {
|
||||
gizmos.line(
|
||||
edge[0] + Vec3::Y * 0.08,
|
||||
edge[1] + Vec3::Y * 0.08,
|
||||
Color::srgba(0.98, 0.88, 0.2, 1.0),
|
||||
);
|
||||
}
|
||||
if let Some(start) = state.preview_path.first().copied() {
|
||||
gizmos
|
||||
.sphere(
|
||||
Isometry3d::from_translation(start + Vec3::Y * 0.08),
|
||||
0.16,
|
||||
Color::srgba(0.2, 1.0, 0.55, 1.0),
|
||||
)
|
||||
.resolution(14);
|
||||
}
|
||||
if let Some(end) = state.preview_path.last().copied() {
|
||||
gizmos
|
||||
.sphere(
|
||||
Isometry3d::from_translation(end + Vec3::Y * 0.08),
|
||||
0.16,
|
||||
Color::srgba(1.0, 0.28, 0.22, 1.0),
|
||||
)
|
||||
.resolution(14);
|
||||
}
|
||||
}
|
||||
|
||||
fn navigation_vertex(layer: &polyanya::Layer, index: usize) -> Option<Vec3> {
|
||||
let vertex = layer.vertices.get(index)?;
|
||||
let height = layer.height.get(index).copied().unwrap_or_default();
|
||||
let coords = vertex.coords + layer.offset;
|
||||
Some(Vec3::new(coords.x, height, coords.y))
|
||||
}
|
||||
|
||||
fn draw_audio_visualizers(
|
||||
viewport_mode: Res<EditorViewportMode>,
|
||||
settings: Res<EditorVisualizationSettings>,
|
||||
@@ -399,7 +534,13 @@ fn draw_visualizers(
|
||||
lights: Query<(Entity, &LightDesc, &GlobalTransform), With<LevelObject>>,
|
||||
spawns: Query<(Entity, &GlobalTransform), (With<LevelObject>, With<PlayerSpawn>)>,
|
||||
prefabs: Query<(Entity, &GlobalTransform), (With<LevelObject>, With<PrefabRef>)>,
|
||||
models: Query<(Entity, &GlobalTransform), (With<LevelObject>, With<ModelRef>)>,
|
||||
models: Query<
|
||||
(Entity, &GlobalTransform),
|
||||
(
|
||||
With<LevelObject>,
|
||||
Or<(With<ModelRef>, With<SkinnedMeshRenderer>)>,
|
||||
),
|
||||
>,
|
||||
players: Query<(Entity, &GlobalTransform), With<Player>>,
|
||||
cameras: Query<(Entity, &GlobalTransform), With<PlayerCamera>>,
|
||||
project_suns: Query<(Entity, &GlobalTransform), With<ProjectSun>>,
|
||||
|
||||
@@ -18,6 +18,8 @@ bevy_ufbx.workspace = true
|
||||
cpal = "0.17.3"
|
||||
game_hot = { path = "../game_hot" }
|
||||
hot-lib-reloader = { version = "0.8.2", optional = true }
|
||||
nav_glam.workspace = true
|
||||
polyanya.workspace = true
|
||||
protocol.workspace = true
|
||||
ron = "0.12"
|
||||
scene.workspace = true
|
||||
|
||||
Loaded 100 of 236 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user