Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed21bcc52d | ||
|
|
577d8dcb27 | ||
|
|
ba59f57a5a | ||
|
|
d038cf3670 | ||
|
|
61be2440bd |
No files matched your search
@@ -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.
|
||||
@@ -15,9 +15,10 @@ owner requests it again.
|
||||
|
||||
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: collaborative safety `#49`, the
|
||||
remaining Material/drag-drop contract in `#16`, `#18`, and `#51`, terrain `#22`-`#24`, physics
|
||||
placement/diagnostics `#25`-`#26`, and their regression fixtures.
|
||||
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.
|
||||
|
||||
@@ -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.
|
||||
@@ -163,13 +163,14 @@ 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 |
|
||||
| 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 |
|
||||
|
||||
@@ -398,6 +399,8 @@ 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] 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
|
||||
|
||||
@@ -269,6 +269,24 @@
|
||||
),
|
||||
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: [],
|
||||
),
|
||||
(
|
||||
id: ("dc13ce01-c7ce-43c5-974c-0e659ae49ab9"),
|
||||
path: "assets/levels/editor_scene 2.scn.ron",
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
(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"),
|
||||
)),
|
||||
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.1691, -0.0670, 0.7244, 0.6648),
|
||||
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,
|
||||
),
|
||||
}),
|
||||
})
|
||||
@@ -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"))
|
||||
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()
|
||||
else {
|
||||
},
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -25,6 +25,7 @@ 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;
|
||||
@@ -68,6 +69,7 @@ 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;
|
||||
@@ -90,6 +92,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)
|
||||
|
||||
@@ -15,6 +15,7 @@ use egui_phosphor_icons::icons;
|
||||
use shared::PrefabInstance;
|
||||
|
||||
use crate::assets::EditorAssets;
|
||||
use crate::native_dialog::NativeDialogBroker;
|
||||
use crate::project_io::ProjectWorkspace;
|
||||
use crate::scene::recovery::atomic_write_with_pre_rename;
|
||||
use crate::scene_io::SceneIo;
|
||||
@@ -880,13 +881,34 @@ fn resolve_conflict_reload(world: &mut World, conflict: &PendingFileConflict) {
|
||||
}
|
||||
|
||||
fn resolve_conflict_save_as(world: &mut World, conflict: &PendingFileConflict) {
|
||||
let directory = conflict.path.parent().unwrap_or_else(|| Path::new("."));
|
||||
let conflict = conflict.clone();
|
||||
let directory = conflict
|
||||
.path
|
||||
.parent()
|
||||
.unwrap_or_else(|| Path::new("."))
|
||||
.to_path_buf();
|
||||
let file_name = conflict_copy_file_name(&conflict.path);
|
||||
let Some(destination) = rfd::FileDialog::new()
|
||||
let request = world.resource::<NativeDialogBroker>().request(
|
||||
move || {
|
||||
rfd::FileDialog::new()
|
||||
.set_directory(directory)
|
||||
.set_file_name(file_name)
|
||||
.save_file()
|
||||
else {
|
||||
},
|
||||
move |world, destination| finish_conflict_save_as(world, conflict, destination),
|
||||
);
|
||||
world.resource_mut::<SceneIo>().set_status(match request {
|
||||
Ok(()) => "Choose a destination for the conflict copy".into(),
|
||||
Err(error) => format!("Save As unavailable: {error}"),
|
||||
});
|
||||
}
|
||||
|
||||
fn finish_conflict_save_as(
|
||||
world: &mut World,
|
||||
conflict: PendingFileConflict,
|
||||
destination: Option<PathBuf>,
|
||||
) {
|
||||
let Some(destination) = destination else {
|
||||
world
|
||||
.resource_mut::<SceneIo>()
|
||||
.set_status("Save conflict copy cancelled");
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ use shared::{
|
||||
|
||||
use crate::assets::{import_external_assets, EditorAssets, IMPORTABLE_ASSET_EXTENSIONS};
|
||||
use crate::history::{clear_level_objects, snapshot_entity, EditorHistory};
|
||||
use crate::native_dialog::NativeDialogBroker;
|
||||
use crate::project::collaboration::{publish_authored_file, FileSnapshot, FileWriteIntent};
|
||||
use crate::scene::recovery::{
|
||||
default_state_root, discard_recovery_snapshots, latest_recovery_snapshot,
|
||||
@@ -82,8 +83,6 @@ pub struct SceneIo {
|
||||
pub request: Option<SceneIoRequest>,
|
||||
pub status: String,
|
||||
pub dirty: bool,
|
||||
/// When set, the next I/O request needs unsaved-changes confirmation.
|
||||
pub pending_request: Option<SceneIoRequest>,
|
||||
/// Newest recovery snapshot that is newer than the active authored scene.
|
||||
pub recovery_snapshot: Option<PathBuf>,
|
||||
/// Bounded in-session audit trail for scene persistence and recovery operations.
|
||||
@@ -119,7 +118,6 @@ impl Default for SceneIo {
|
||||
request: None,
|
||||
status: "Ready".to_string(),
|
||||
dirty: false,
|
||||
pending_request: None,
|
||||
recovery_snapshot: None,
|
||||
events: VecDeque::new(),
|
||||
tabs: vec![SceneTab {
|
||||
@@ -291,40 +289,16 @@ fn load_startup_scene(world: &mut World) {
|
||||
}
|
||||
|
||||
fn process_scene_io_requests(world: &mut World) {
|
||||
let request = {
|
||||
let mut io = world.resource_mut::<SceneIo>();
|
||||
if let Some(pending) = io.pending_request.take() {
|
||||
pending
|
||||
} else {
|
||||
match io.request.take() {
|
||||
Some(req) if io.has_unsaved_tabs() && needs_dirty_confirm(&req) => {
|
||||
io.pending_request = Some(req);
|
||||
let Some(request) = world.resource_mut::<SceneIo>().request.take() else {
|
||||
return;
|
||||
}
|
||||
Some(req) => req,
|
||||
None => return,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if world.resource::<SceneIo>().has_unsaved_tabs() && needs_dirty_confirm(&request) {
|
||||
match confirm_discard_or_save() {
|
||||
DirtyConfirm::Save => {
|
||||
let save_status = save_all_tabs(world);
|
||||
if save_status.starts_with("Save failed") || save_status.ends_with("cancelled") {
|
||||
world.resource_mut::<SceneIo>().set_status(save_status);
|
||||
if matches!(request, SceneIoRequest::SwitchProject)
|
||||
&& world.resource::<SceneIo>().has_unsaved_tabs()
|
||||
{
|
||||
request_switch_project_confirmation(world);
|
||||
return;
|
||||
}
|
||||
}
|
||||
DirtyConfirm::Discard => {}
|
||||
DirtyConfirm::Cancel => {
|
||||
world
|
||||
.resource_mut::<SceneIo>()
|
||||
.set_status("Operation cancelled");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let status = match request {
|
||||
SceneIoRequest::New => new_scene_tab(world),
|
||||
@@ -348,16 +322,6 @@ fn process_scene_io_requests(world: &mut World) {
|
||||
world.resource_mut::<SceneIo>().set_status(status);
|
||||
}
|
||||
|
||||
enum DirtyConfirm {
|
||||
Save,
|
||||
Discard,
|
||||
Cancel,
|
||||
}
|
||||
|
||||
fn needs_dirty_confirm(request: &SceneIoRequest) -> bool {
|
||||
matches!(request, SceneIoRequest::SwitchProject)
|
||||
}
|
||||
|
||||
fn switch_project(world: &mut World) -> String {
|
||||
match crate::launcher::spawn_project_launcher_process() {
|
||||
Ok(()) => {
|
||||
@@ -368,20 +332,42 @@ fn switch_project(world: &mut World) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
fn confirm_discard_or_save() -> DirtyConfirm {
|
||||
use rfd::{MessageButtons, MessageDialog, MessageLevel};
|
||||
match MessageDialog::new()
|
||||
fn request_switch_project_confirmation(world: &mut World) {
|
||||
let result = world.resource::<NativeDialogBroker>().request(
|
||||
|| {
|
||||
rfd::MessageDialog::new()
|
||||
.set_title("Unsaved Changes")
|
||||
.set_description("The scene has unsaved changes. Save before continuing?")
|
||||
.set_level(MessageLevel::Warning)
|
||||
.set_buttons(MessageButtons::YesNoCancel)
|
||||
.set_level(rfd::MessageLevel::Warning)
|
||||
.set_buttons(rfd::MessageButtons::YesNoCancel)
|
||||
.show()
|
||||
{
|
||||
rfd::MessageDialogResult::Yes => DirtyConfirm::Save,
|
||||
rfd::MessageDialogResult::No => DirtyConfirm::Discard,
|
||||
_ => DirtyConfirm::Cancel,
|
||||
},
|
||||
|world, decision| match decision {
|
||||
rfd::MessageDialogResult::Yes => {
|
||||
let status = save_all_tabs(world);
|
||||
if status == "Saved all modified scene tabs" {
|
||||
let status = switch_project(world);
|
||||
world.resource_mut::<SceneIo>().set_status(status);
|
||||
} else {
|
||||
world.resource_mut::<SceneIo>().set_status(format!(
|
||||
"Project switch paused until every scene is saved: {status}"
|
||||
));
|
||||
}
|
||||
}
|
||||
rfd::MessageDialogResult::No => {
|
||||
let status = switch_project(world);
|
||||
world.resource_mut::<SceneIo>().set_status(status);
|
||||
}
|
||||
_ => world
|
||||
.resource_mut::<SceneIo>()
|
||||
.set_status("Project switch cancelled"),
|
||||
},
|
||||
);
|
||||
world.resource_mut::<SceneIo>().set_status(match result {
|
||||
Ok(()) => "Waiting for unsaved-scene confirmation".into(),
|
||||
Err(error) => format!("Project switch unavailable: {error}"),
|
||||
});
|
||||
}
|
||||
|
||||
fn open_recent(world: &mut World, index: usize) -> String {
|
||||
let path = world.resource::<SceneIo>().recent_paths.get(index).cloned();
|
||||
@@ -533,18 +519,14 @@ fn close_scene_tab(world: &mut World, index: usize) -> String {
|
||||
}
|
||||
|
||||
if world.resource::<SceneIo>().dirty {
|
||||
match confirm_close_scene() {
|
||||
DirtyConfirm::Save => {
|
||||
let status = save_active_or_prompt(world);
|
||||
if status.starts_with("Save failed") || status.ends_with("cancelled") {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
DirtyConfirm::Discard => {}
|
||||
DirtyConfirm::Cancel => return "Close scene cancelled".to_string(),
|
||||
}
|
||||
request_close_scene_confirmation(world);
|
||||
return "Waiting for close-scene confirmation".to_string();
|
||||
}
|
||||
|
||||
finish_close_scene_tab(world)
|
||||
}
|
||||
|
||||
fn finish_close_scene_tab(world: &mut World) -> String {
|
||||
if world.resource::<SceneIo>().tabs.len() == 1 {
|
||||
clear_scene_world(world);
|
||||
world.insert_resource(SceneComposition {
|
||||
@@ -618,18 +600,36 @@ fn reload_active_composition(world: &mut World) -> String {
|
||||
"Reloaded active scene composition".to_string()
|
||||
}
|
||||
|
||||
fn confirm_close_scene() -> DirtyConfirm {
|
||||
use rfd::{MessageButtons, MessageDialog, MessageLevel};
|
||||
match MessageDialog::new()
|
||||
fn request_close_scene_confirmation(world: &mut World) {
|
||||
let result = world.resource::<NativeDialogBroker>().request(
|
||||
|| {
|
||||
rfd::MessageDialog::new()
|
||||
.set_title("Close Scene")
|
||||
.set_description("This scene tab has unsaved changes. Save before closing it?")
|
||||
.set_level(MessageLevel::Warning)
|
||||
.set_buttons(MessageButtons::YesNoCancel)
|
||||
.set_level(rfd::MessageLevel::Warning)
|
||||
.set_buttons(rfd::MessageButtons::YesNoCancel)
|
||||
.show()
|
||||
{
|
||||
rfd::MessageDialogResult::Yes => DirtyConfirm::Save,
|
||||
rfd::MessageDialogResult::No => DirtyConfirm::Discard,
|
||||
_ => DirtyConfirm::Cancel,
|
||||
},
|
||||
|world, decision| {
|
||||
let status = match decision {
|
||||
rfd::MessageDialogResult::Yes => {
|
||||
let save_status = save_active_or_prompt(world);
|
||||
if save_status.starts_with("Saved ") {
|
||||
finish_close_scene_tab(world)
|
||||
} else {
|
||||
format!("Close scene paused until it is saved: {save_status}")
|
||||
}
|
||||
}
|
||||
rfd::MessageDialogResult::No => finish_close_scene_tab(world),
|
||||
_ => "Close scene cancelled".to_string(),
|
||||
};
|
||||
world.resource_mut::<SceneIo>().set_status(status);
|
||||
},
|
||||
);
|
||||
if let Err(error) = result {
|
||||
world
|
||||
.resource_mut::<SceneIo>()
|
||||
.set_status(format!("Close scene unavailable: {error}"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -694,12 +694,31 @@ fn save_selection_as_prefab(world: &mut World) -> String {
|
||||
return "Select level objects to save as prefab".to_string();
|
||||
}
|
||||
|
||||
let Some(path) = rfd::FileDialog::new()
|
||||
let request = world.resource::<NativeDialogBroker>().request(
|
||||
|| {
|
||||
rfd::FileDialog::new()
|
||||
.set_directory("assets/prefabs")
|
||||
.add_filter("Bevy prefab", &["scn.ron", "ron"])
|
||||
.set_file_name("prefab.scn.ron")
|
||||
.save_file()
|
||||
else {
|
||||
},
|
||||
move |world, path| {
|
||||
let status = finish_save_selection_as_prefab(world, selection, path);
|
||||
world.resource_mut::<SceneIo>().set_status(status);
|
||||
},
|
||||
);
|
||||
match request {
|
||||
Ok(()) => "Choose a destination for the prefab".to_string(),
|
||||
Err(error) => format!("Save prefab unavailable: {error}"),
|
||||
}
|
||||
}
|
||||
|
||||
fn finish_save_selection_as_prefab(
|
||||
world: &mut World,
|
||||
selection: Vec<Entity>,
|
||||
path: Option<PathBuf>,
|
||||
) -> String {
|
||||
let Some(path) = path else {
|
||||
return "Save prefab cancelled".to_string();
|
||||
};
|
||||
let expected = match FileSnapshot::capture(&path) {
|
||||
@@ -859,12 +878,27 @@ fn save_active_or_prompt(world: &mut World) -> String {
|
||||
}
|
||||
|
||||
fn save_with_dialog(world: &mut World) -> String {
|
||||
let Some(path) = rfd::FileDialog::new()
|
||||
let request = world.resource::<NativeDialogBroker>().request(
|
||||
|| {
|
||||
rfd::FileDialog::new()
|
||||
.set_directory("assets/levels")
|
||||
.add_filter("Bevy scene", &["scn.ron", "ron"])
|
||||
.set_file_name("editor_scene.scn.ron")
|
||||
.save_file()
|
||||
else {
|
||||
},
|
||||
|world, path| {
|
||||
let status = finish_save_with_dialog(world, path);
|
||||
world.resource_mut::<SceneIo>().set_status(status);
|
||||
},
|
||||
);
|
||||
match request {
|
||||
Ok(()) => "Choose a scene destination".to_string(),
|
||||
Err(error) => format!("Save unavailable: {error}"),
|
||||
}
|
||||
}
|
||||
|
||||
fn finish_save_with_dialog(world: &mut World, path: Option<PathBuf>) -> String {
|
||||
let Some(path) = path else {
|
||||
return "Save cancelled".to_string();
|
||||
};
|
||||
let expected = match FileSnapshot::capture(&path) {
|
||||
@@ -885,31 +919,51 @@ fn save_with_dialog(world: &mut World) -> String {
|
||||
}
|
||||
|
||||
fn open_with_dialog(world: &mut World) -> String {
|
||||
let Some(path) = rfd::FileDialog::new()
|
||||
let request = world.resource::<NativeDialogBroker>().request(
|
||||
|| {
|
||||
rfd::FileDialog::new()
|
||||
.set_directory("assets/levels")
|
||||
.add_filter("Bevy scene", &["scn.ron", "ron"])
|
||||
.pick_file()
|
||||
else {
|
||||
return "Open cancelled".to_string();
|
||||
};
|
||||
|
||||
open_path(world, path)
|
||||
},
|
||||
|world, path| {
|
||||
let status = path.map_or_else(
|
||||
|| "Open cancelled".to_string(),
|
||||
|path| open_path(world, path),
|
||||
);
|
||||
world.resource_mut::<SceneIo>().set_status(status);
|
||||
},
|
||||
);
|
||||
match request {
|
||||
Ok(()) => "Choose a scene to open".to_string(),
|
||||
Err(error) => format!("Open unavailable: {error}"),
|
||||
}
|
||||
}
|
||||
|
||||
fn import_with_dialog(world: &mut World) -> String {
|
||||
let Some(paths) = rfd::FileDialog::new()
|
||||
let request = world.resource::<NativeDialogBroker>().request(
|
||||
|| {
|
||||
rfd::FileDialog::new()
|
||||
.add_filter("Editor assets", IMPORTABLE_ASSET_EXTENSIONS)
|
||||
.pick_files()
|
||||
else {
|
||||
return "Import cancelled".to_string();
|
||||
};
|
||||
|
||||
match import_external_assets(&paths) {
|
||||
},
|
||||
|world, paths| {
|
||||
let status = match paths {
|
||||
None => "Import cancelled".to_string(),
|
||||
Some(paths) => match import_external_assets(&paths) {
|
||||
Ok(count) => {
|
||||
world.resource_mut::<EditorAssets>().refresh();
|
||||
format!("Imported {count} asset(s)")
|
||||
}
|
||||
Err(err) => format!("Import failed: {err}"),
|
||||
},
|
||||
};
|
||||
world.resource_mut::<SceneIo>().set_status(status);
|
||||
},
|
||||
);
|
||||
match request {
|
||||
Ok(()) => "Choose assets to import".to_string(),
|
||||
Err(error) => format!("Import unavailable: {error}"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -921,14 +975,32 @@ fn export_selection_with_dialog(world: &mut World) -> String {
|
||||
return "Selected entity is not an authored level object".to_string();
|
||||
}
|
||||
|
||||
let Some(path) = rfd::FileDialog::new()
|
||||
let request = world.resource::<NativeDialogBroker>().request(
|
||||
|| {
|
||||
rfd::FileDialog::new()
|
||||
.set_directory("assets/levels")
|
||||
.add_filter("Bevy prefab", &["scn.ron", "ron"])
|
||||
.set_file_name("selection.scn.ron")
|
||||
.save_file()
|
||||
else {
|
||||
},
|
||||
move |world, path| {
|
||||
let status = finish_export_selection(world, entity, path);
|
||||
world.resource_mut::<SceneIo>().set_status(status);
|
||||
},
|
||||
);
|
||||
match request {
|
||||
Ok(()) => "Choose an export destination".to_string(),
|
||||
Err(error) => format!("Export unavailable: {error}"),
|
||||
}
|
||||
}
|
||||
|
||||
fn finish_export_selection(world: &mut World, entity: Entity, path: Option<PathBuf>) -> String {
|
||||
let Some(path) = path else {
|
||||
return "Export cancelled".to_string();
|
||||
};
|
||||
if snapshot_entity(world, entity).is_none() {
|
||||
return "Export failed: the initiating selection no longer exists".to_string();
|
||||
}
|
||||
let expected = match FileSnapshot::capture(&path) {
|
||||
Ok(expected) => expected,
|
||||
Err(error) => return format!("Export failed: {error}"),
|
||||
@@ -1041,6 +1113,9 @@ fn format_actor_validation(err: ActorValidationError) -> String {
|
||||
ActorValidationError::InvalidBrushGeometry(message) => {
|
||||
format!("Save failed: invalid brush geometry: {message}")
|
||||
}
|
||||
ActorValidationError::InvalidTerrain(message) => {
|
||||
format!("Save failed: invalid terrain: {message}")
|
||||
}
|
||||
ActorValidationError::StaticMeshMissingPrimitive => {
|
||||
"Save failed: StaticMesh actor requires Primitive or StaticMeshRenderer with a mesh slot"
|
||||
.into()
|
||||
@@ -1607,12 +1682,32 @@ fn save_recovery_copy_with_dialog(world: &mut World) -> String {
|
||||
|| "recovered_scene.scn.ron".to_string(),
|
||||
|stem| format!("{stem}.recovered.scn.ron"),
|
||||
);
|
||||
let Some(destination) = rfd::FileDialog::new()
|
||||
let directory = directory.to_path_buf();
|
||||
let request = world.resource::<NativeDialogBroker>().request(
|
||||
move || {
|
||||
rfd::FileDialog::new()
|
||||
.set_directory(directory)
|
||||
.add_filter("Bevy scene", &["scn.ron", "ron"])
|
||||
.set_file_name(file_name)
|
||||
.save_file()
|
||||
else {
|
||||
},
|
||||
move |world, destination| {
|
||||
let status = finish_save_recovery_copy(world, snapshot, destination);
|
||||
world.resource_mut::<SceneIo>().set_status(status);
|
||||
},
|
||||
);
|
||||
match request {
|
||||
Ok(()) => "Choose a destination for the recovery copy".to_string(),
|
||||
Err(error) => format!("Save recovery copy unavailable: {error}"),
|
||||
}
|
||||
}
|
||||
|
||||
fn finish_save_recovery_copy(
|
||||
world: &mut World,
|
||||
snapshot: PathBuf,
|
||||
destination: Option<PathBuf>,
|
||||
) -> String {
|
||||
let Some(destination) = destination else {
|
||||
return "Save recovery copy cancelled".to_string();
|
||||
};
|
||||
let expected = match FileSnapshot::capture(&destination) {
|
||||
|
||||
@@ -112,6 +112,7 @@ pub fn draw_actor_inspector(world: &mut World, ui: &mut egui::Ui, entity: Entity
|
||||
ActorKind::StaticMesh
|
||||
| ActorKind::SkinnedMesh
|
||||
| ActorKind::Brush
|
||||
| ActorKind::Terrain
|
||||
| ActorKind::ImportedModel
|
||||
| ActorKind::Light
|
||||
| ActorKind::Empty
|
||||
@@ -143,6 +144,7 @@ fn actor_icon(kind: ActorKind) -> egui_phosphor_icons::Icon {
|
||||
ActorKind::StaticMesh
|
||||
| ActorKind::SkinnedMesh
|
||||
| ActorKind::Brush
|
||||
| ActorKind::Terrain
|
||||
| ActorKind::ImportedModel => icons::CUBE,
|
||||
ActorKind::Light => icons::LIGHTBULB,
|
||||
ActorKind::PrefabAnchor => icons::PACKAGE,
|
||||
|
||||
@@ -373,6 +373,27 @@ impl Default for EditorComponentRegistry {
|
||||
],
|
||||
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",
|
||||
|
||||
@@ -205,6 +205,7 @@ fn actor_kind_sort_key(world: &World, entity: Entity) -> u8 {
|
||||
.map(|kind| match kind {
|
||||
ActorKind::Empty => 0,
|
||||
ActorKind::Brush
|
||||
| ActorKind::Terrain
|
||||
| ActorKind::StaticMesh
|
||||
| ActorKind::SkinnedMesh
|
||||
| ActorKind::ImportedModel => 1,
|
||||
@@ -468,6 +469,7 @@ 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(),
|
||||
|
||||
@@ -16,8 +16,8 @@ use shared::{
|
||||
MaterialParameterValue, MaterialRef, MaterialShaderKind, NavigationArea, NavigationBounds,
|
||||
NavigationLink, NavigationObstacle, ObjectiveMarker, PhysicsBody, PlayerSpawn,
|
||||
PostProcessVolumeDesc, PrefabInstance, Primitive, PrimitiveShape, ProjectSun, RigidBodyDesc,
|
||||
SkinnedMeshRenderer, StaticMeshRenderer, StaticMeshRendererEntry, TeamSpawn, TriggerVolume,
|
||||
WeaponSpawn, AUTHORING_DIRECTIONAL_LUX_MAX, AUTHORING_POINT_SPOT_LUMENS_MAX,
|
||||
SkinnedMeshRenderer, StaticMeshRenderer, StaticMeshRendererEntry, TeamSpawn, TerrainDesc,
|
||||
TriggerVolume, WeaponSpawn, AUTHORING_DIRECTIONAL_LUX_MAX, AUTHORING_POINT_SPOT_LUMENS_MAX,
|
||||
COMPONENT_ANIMATION_CONTROLLER_DESC, COMPONENT_AUDIO_LISTENER_DESC,
|
||||
COMPONENT_AUDIO_SOURCE_DESC, COMPONENT_BRUSH_DESC, COMPONENT_COLLIDER_DESC,
|
||||
COMPONENT_LIGHT_DESC, COMPONENT_MATERIAL_DESC, COMPONENT_NAVIGATION_AREA,
|
||||
@@ -25,8 +25,8 @@ use shared::{
|
||||
COMPONENT_OBJECTIVE_MARKER, COMPONENT_PHYSICS_BODY, COMPONENT_PLAYER_SPAWN,
|
||||
COMPONENT_POST_PROCESS_VOLUME, COMPONENT_PREFAB_INSTANCE, COMPONENT_PRIMITIVE,
|
||||
COMPONENT_PROJECT_SUN, COMPONENT_RIGID_BODY_DESC, COMPONENT_SKINNED_MESH_RENDERER,
|
||||
COMPONENT_STATIC_MESH_RENDERER, COMPONENT_TEAM_SPAWN, COMPONENT_TRIGGER_VOLUME,
|
||||
COMPONENT_WEAPON_SPAWN,
|
||||
COMPONENT_STATIC_MESH_RENDERER, COMPONENT_TEAM_SPAWN, COMPONENT_TERRAIN_DESC,
|
||||
COMPONENT_TRIGGER_VOLUME, COMPONENT_WEAPON_SPAWN,
|
||||
};
|
||||
|
||||
use crate::history::{
|
||||
@@ -1110,6 +1110,7 @@ fn draw_authoring_component_by_type(
|
||||
COMPONENT_STATIC_MESH_RENDERER => static_mesh_renderer_ui(world, ui, entity),
|
||||
COMPONENT_SKINNED_MESH_RENDERER => skinned_mesh_renderer_ui(world, ui, entity),
|
||||
COMPONENT_BRUSH_DESC => brush_editor_ui(world, ui, entity),
|
||||
COMPONENT_TERRAIN_DESC => terrain_editor_ui(world, ui, entity),
|
||||
COMPONENT_PRIMITIVE => primitive_editor_ui(world, ui, entity),
|
||||
COMPONENT_MATERIAL_DESC => material_editor_ui(world, ui, entity),
|
||||
COMPONENT_LIGHT_DESC => light_editor_ui(world, ui, entity),
|
||||
@@ -3494,6 +3495,128 @@ fn brush_editor_ui(world: &mut World, ui: &mut egui::Ui, entity: Entity) {
|
||||
}
|
||||
}
|
||||
|
||||
fn terrain_editor_ui(world: &mut World, ui: &mut egui::Ui, entity: Entity) {
|
||||
let Some(mut terrain) = world.get::<TerrainDesc>(entity).cloned() else {
|
||||
return;
|
||||
};
|
||||
let original = terrain.clone();
|
||||
let mut changed = false;
|
||||
let mut requested_resolution = terrain.resolution;
|
||||
let card = component_card_context(
|
||||
world,
|
||||
entity,
|
||||
ComponentCardOptions::removable(COMPONENT_TERRAIN_DESC, "Terrain", icons::MOUNTAINS),
|
||||
);
|
||||
let card_response = component_card(ui, &card, |ui| {
|
||||
property_row(ui, "Grid", |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.add(
|
||||
egui::DragValue::new(&mut requested_resolution)
|
||||
.range(2..=1025)
|
||||
.suffix(" samples"),
|
||||
);
|
||||
if ui
|
||||
.add_enabled(
|
||||
requested_resolution != terrain.resolution,
|
||||
egui::Button::new("Resize Flat"),
|
||||
)
|
||||
.on_hover_text("Replaces the current height grid with a flat grid")
|
||||
.clicked()
|
||||
{
|
||||
let replacement = TerrainDesc::flat(requested_resolution);
|
||||
terrain.resolution = replacement.resolution;
|
||||
terrain.heights = replacement.heights;
|
||||
terrain.chunk_quads = terrain.chunk_quads.min(terrain.resolution - 1).max(1);
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
property_row(ui, "Sample Spacing", |ui| {
|
||||
changed |= ui
|
||||
.add(
|
||||
egui::DragValue::new(&mut terrain.sample_spacing)
|
||||
.range(0.01..=1000.0)
|
||||
.speed(0.1)
|
||||
.suffix(" m"),
|
||||
)
|
||||
.changed();
|
||||
});
|
||||
property_row(ui, "Height Scale", |ui| {
|
||||
changed |= ui
|
||||
.add(
|
||||
egui::DragValue::new(&mut terrain.height_scale)
|
||||
.range(0.01..=10000.0)
|
||||
.speed(0.1)
|
||||
.suffix(" m"),
|
||||
)
|
||||
.changed();
|
||||
});
|
||||
property_row(ui, "Chunk Size", |ui| {
|
||||
changed |= ui
|
||||
.add(
|
||||
egui::DragValue::new(&mut terrain.chunk_quads)
|
||||
.range(1..=terrain.resolution.saturating_sub(1))
|
||||
.suffix(" quads"),
|
||||
)
|
||||
.changed();
|
||||
});
|
||||
property_row(ui, "Collision", |ui| {
|
||||
changed |= ui
|
||||
.checkbox(&mut terrain.generate_colliders, "Generate")
|
||||
.changed();
|
||||
});
|
||||
property_row(ui, "Shadows", |ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
changed |= ui.checkbox(&mut terrain.cast_shadows, "Cast").changed();
|
||||
changed |= ui
|
||||
.checkbox(&mut terrain.receive_shadows, "Receive")
|
||||
.changed();
|
||||
});
|
||||
});
|
||||
property_row(ui, "Base Material", |ui| {
|
||||
ui.label(
|
||||
terrain
|
||||
.base_material
|
||||
.as_ref()
|
||||
.map(|material| material.label.as_str())
|
||||
.filter(|label| !label.is_empty())
|
||||
.unwrap_or("Terrain fallback"),
|
||||
);
|
||||
});
|
||||
match terrain.validate() {
|
||||
Ok(()) => {
|
||||
ui.label(
|
||||
egui::RichText::new(format!(
|
||||
"{} heights • {}×{} chunks",
|
||||
terrain.heights.len(),
|
||||
(terrain.resolution - 1).div_ceil(terrain.chunk_quads),
|
||||
(terrain.resolution - 1).div_ceil(terrain.chunk_quads)
|
||||
))
|
||||
.color(super::theme::SUCCESS),
|
||||
);
|
||||
}
|
||||
Err(error) => {
|
||||
ui.label(egui::RichText::new(error).color(super::theme::ERROR));
|
||||
}
|
||||
}
|
||||
});
|
||||
apply_component_card_response(world, entity, card_response);
|
||||
|
||||
if changed && terrain != original {
|
||||
let _ = reflected_component_transaction(
|
||||
world,
|
||||
entity,
|
||||
"Edit Terrain",
|
||||
shared::AUTHORING_COMPONENT_TERRAIN,
|
||||
COMPONENT_TERRAIN_DESC,
|
||||
move |world, entity| {
|
||||
world.entity_mut(entity).insert(terrain);
|
||||
Ok(())
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn brush_validation_ui(ui: &mut egui::Ui, brush: &BrushDesc) {
|
||||
let report = validate_brush(brush);
|
||||
if report.diagnostics.is_empty() {
|
||||
|
||||
@@ -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;
|
||||
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");
|
||||
}
|
||||
Ok(None) => {}
|
||||
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) {
|
||||
|
||||
@@ -631,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 {
|
||||
|
||||
@@ -175,6 +175,7 @@ fn actor_kind_ron(kind: ActorKind) -> &'static str {
|
||||
match kind {
|
||||
ActorKind::Empty => "Empty",
|
||||
ActorKind::Brush => "Brush",
|
||||
ActorKind::Terrain => "Terrain",
|
||||
ActorKind::StaticMesh => "StaticMesh",
|
||||
ActorKind::SkinnedMesh => "SkinnedMesh",
|
||||
ActorKind::ImportedModel => "ImportedModel",
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{
|
||||
ActorKind, AnimationControllerDesc, AudioListenerDesc, AudioSourceDesc, BrushDesc, LevelObject,
|
||||
LightDesc, ModelRef, NavigationArea, NavigationBounds, NavigationLink, NavigationObstacle,
|
||||
ObjectiveMarker, PlayerSpawn, PostProcessVolumeDesc, PrefabInstance, PrefabRef, Primitive,
|
||||
SkinnedMeshRenderer, StaticMeshRenderer, TeamSpawn, TriggerVolume, WeaponSpawn,
|
||||
SkinnedMeshRenderer, StaticMeshRenderer, TeamSpawn, TerrainDesc, TriggerVolume, WeaponSpawn,
|
||||
AUDIO_CLIP_SUB_ASSET_ID,
|
||||
};
|
||||
|
||||
@@ -31,6 +31,9 @@ pub fn infer_actor_kind(entity: EntityRef<'_>) -> Option<ActorKind> {
|
||||
if entity.get::<BrushDesc>().is_some() {
|
||||
return Some(ActorKind::Brush);
|
||||
}
|
||||
if entity.get::<TerrainDesc>().is_some() {
|
||||
return Some(ActorKind::Terrain);
|
||||
}
|
||||
if entity.get::<Primitive>().is_some() || entity.get::<StaticMeshRenderer>().is_some() {
|
||||
return Some(ActorKind::StaticMesh);
|
||||
}
|
||||
@@ -84,6 +87,7 @@ pub enum ActorValidationError {
|
||||
BrushHasLight,
|
||||
BrushHasModelRef,
|
||||
InvalidBrushGeometry(String),
|
||||
InvalidTerrain(String),
|
||||
StaticMeshMissingPrimitive,
|
||||
StaticMeshHasLight,
|
||||
StaticMeshHasModelRef,
|
||||
@@ -166,6 +170,7 @@ pub fn validate_actor(entity: EntityRef<'_>) -> Result<(), ActorValidationError>
|
||||
}
|
||||
let geometry_source_count = usize::from(entity.get::<Primitive>().is_some())
|
||||
+ usize::from(entity.get::<BrushDesc>().is_some())
|
||||
+ usize::from(entity.get::<TerrainDesc>().is_some())
|
||||
+ usize::from(entity.get::<StaticMeshRenderer>().is_some())
|
||||
+ usize::from(entity.get::<SkinnedMeshRenderer>().is_some())
|
||||
+ usize::from(entity.get::<ModelRef>().is_some());
|
||||
@@ -186,6 +191,11 @@ pub fn validate_actor(entity: EntityRef<'_>) -> Result<(), ActorValidationError>
|
||||
return Err(ActorValidationError::InvalidBrushGeometry(message));
|
||||
}
|
||||
}
|
||||
if let Some(terrain) = entity.get::<TerrainDesc>() {
|
||||
terrain
|
||||
.validate()
|
||||
.map_err(ActorValidationError::InvalidTerrain)?;
|
||||
}
|
||||
if let Some(renderer) = entity.get::<SkinnedMeshRenderer>() {
|
||||
if renderer.path.trim().is_empty() {
|
||||
return Err(ActorValidationError::SkinnedMeshInvalidRenderer);
|
||||
@@ -218,6 +228,13 @@ pub fn validate_actor(entity: EntityRef<'_>) -> Result<(), ActorValidationError>
|
||||
}
|
||||
let _ = brush;
|
||||
}
|
||||
ActorKind::Terrain => {
|
||||
if entity.get::<TerrainDesc>().is_none() {
|
||||
return Err(ActorValidationError::InvalidTerrain(
|
||||
"terrain actor is missing TerrainDesc".into(),
|
||||
));
|
||||
}
|
||||
}
|
||||
ActorKind::StaticMesh => {
|
||||
let has_static_mesh_renderer = entity
|
||||
.get::<StaticMeshRenderer>()
|
||||
|
||||
@@ -290,6 +290,7 @@ pub fn inspector_component_active(order: Option<&InspectorOrder>, type_name: &st
|
||||
// Rust type paths remain serialization details and may change during refactors.
|
||||
pub const AUTHORING_COMPONENT_PRIMITIVE: &str = "render.primitive";
|
||||
pub const AUTHORING_COMPONENT_BRUSH: &str = "render.brush";
|
||||
pub const AUTHORING_COMPONENT_TERRAIN: &str = "render.terrain";
|
||||
pub const AUTHORING_COMPONENT_STATIC_MESH_RENDERER: &str = "render.static_mesh_renderer";
|
||||
pub const AUTHORING_COMPONENT_SKINNED_MESH_RENDERER: &str = "render.skinned_mesh_renderer";
|
||||
pub const AUTHORING_COMPONENT_MATERIAL: &str = "render.material";
|
||||
@@ -318,6 +319,7 @@ pub fn authoring_component_id(key: &str) -> Option<&'static str> {
|
||||
match key {
|
||||
AUTHORING_COMPONENT_PRIMITIVE | COMPONENT_PRIMITIVE => Some(AUTHORING_COMPONENT_PRIMITIVE),
|
||||
AUTHORING_COMPONENT_BRUSH | COMPONENT_BRUSH_DESC => Some(AUTHORING_COMPONENT_BRUSH),
|
||||
AUTHORING_COMPONENT_TERRAIN | COMPONENT_TERRAIN_DESC => Some(AUTHORING_COMPONENT_TERRAIN),
|
||||
AUTHORING_COMPONENT_STATIC_MESH_RENDERER | COMPONENT_STATIC_MESH_RENDERER => {
|
||||
Some(AUTHORING_COMPONENT_STATIC_MESH_RENDERER)
|
||||
}
|
||||
@@ -386,6 +388,7 @@ pub fn authoring_component_key(key: &str) -> &str {
|
||||
|
||||
pub const COMPONENT_PRIMITIVE: &str = "shared::components::Primitive";
|
||||
pub const COMPONENT_BRUSH_DESC: &str = "shared::components::BrushDesc";
|
||||
pub const COMPONENT_TERRAIN_DESC: &str = "shared::components::TerrainDesc";
|
||||
pub const COMPONENT_STATIC_MESH_RENDERER: &str = "shared::components::StaticMeshRenderer";
|
||||
pub const COMPONENT_MATERIAL_DESC: &str = "shared::components::MaterialDesc";
|
||||
pub const COMPONENT_MATERIAL_OVERRIDE: &str = "shared::components::MaterialOverride";
|
||||
@@ -852,6 +855,124 @@ impl BrushDesc {
|
||||
}
|
||||
}
|
||||
|
||||
pub const TERRAIN_SCHEMA_VERSION: u32 = 1;
|
||||
|
||||
/// Persistent height-grid terrain authoring data. Hydration partitions the grid into generated
|
||||
/// render/collider chunks; saved scenes retain only this descriptor.
|
||||
#[derive(Component, Reflect, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[reflect(Component, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct TerrainDesc {
|
||||
#[serde(default = "default_terrain_schema_version")]
|
||||
pub schema_version: u32,
|
||||
#[serde(default = "default_terrain_resolution")]
|
||||
pub resolution: u32,
|
||||
#[serde(default = "default_terrain_heights")]
|
||||
pub heights: Vec<f32>,
|
||||
#[serde(default = "default_terrain_sample_spacing")]
|
||||
pub sample_spacing: f32,
|
||||
#[serde(default = "default_terrain_height_scale")]
|
||||
pub height_scale: f32,
|
||||
#[serde(default = "default_terrain_chunk_quads")]
|
||||
pub chunk_quads: u32,
|
||||
#[serde(default)]
|
||||
pub base_material: Option<EditorAssetRef>,
|
||||
#[serde(default = "default_true")]
|
||||
pub generate_colliders: bool,
|
||||
#[serde(default = "default_true")]
|
||||
pub cast_shadows: bool,
|
||||
#[serde(default = "default_true")]
|
||||
pub receive_shadows: bool,
|
||||
}
|
||||
|
||||
impl Default for TerrainDesc {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
schema_version: TERRAIN_SCHEMA_VERSION,
|
||||
resolution: default_terrain_resolution(),
|
||||
heights: default_terrain_heights(),
|
||||
sample_spacing: default_terrain_sample_spacing(),
|
||||
height_scale: default_terrain_height_scale(),
|
||||
chunk_quads: default_terrain_chunk_quads(),
|
||||
base_material: None,
|
||||
generate_colliders: true,
|
||||
cast_shadows: true,
|
||||
receive_shadows: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TerrainDesc {
|
||||
pub fn flat(resolution: u32) -> Self {
|
||||
let resolution = resolution.max(2);
|
||||
Self {
|
||||
resolution,
|
||||
heights: vec![0.0; resolution as usize * resolution as usize],
|
||||
chunk_quads: (resolution - 1).min(default_terrain_chunk_quads()),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn validate(&self) -> Result<(), String> {
|
||||
if self.schema_version != TERRAIN_SCHEMA_VERSION {
|
||||
return Err(format!(
|
||||
"terrain schema {} is unsupported; expected {}",
|
||||
self.schema_version, TERRAIN_SCHEMA_VERSION
|
||||
));
|
||||
}
|
||||
if !(2..=1025).contains(&self.resolution) {
|
||||
return Err("terrain resolution must be between 2 and 1025 samples".into());
|
||||
}
|
||||
let expected = self.resolution as usize * self.resolution as usize;
|
||||
if self.heights.len() != expected {
|
||||
return Err(format!(
|
||||
"terrain resolution {} requires {expected} height samples, found {}",
|
||||
self.resolution,
|
||||
self.heights.len()
|
||||
));
|
||||
}
|
||||
if self.heights.iter().any(|height| !height.is_finite()) {
|
||||
return Err("terrain height samples must all be finite".into());
|
||||
}
|
||||
if !self.sample_spacing.is_finite() || self.sample_spacing <= 0.0 {
|
||||
return Err("terrain sample spacing must be finite and positive".into());
|
||||
}
|
||||
if !self.height_scale.is_finite() || self.height_scale <= 0.0 {
|
||||
return Err("terrain height scale must be finite and positive".into());
|
||||
}
|
||||
if self.chunk_quads == 0 || self.chunk_quads > self.resolution - 1 {
|
||||
return Err(format!(
|
||||
"terrain chunk size must be between 1 and {} quads",
|
||||
self.resolution - 1
|
||||
));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn default_terrain_schema_version() -> u32 {
|
||||
TERRAIN_SCHEMA_VERSION
|
||||
}
|
||||
|
||||
fn default_terrain_resolution() -> u32 {
|
||||
33
|
||||
}
|
||||
|
||||
fn default_terrain_heights() -> Vec<f32> {
|
||||
vec![0.0; default_terrain_resolution() as usize * default_terrain_resolution() as usize]
|
||||
}
|
||||
|
||||
fn default_terrain_sample_spacing() -> f32 {
|
||||
1.0
|
||||
}
|
||||
|
||||
fn default_terrain_height_scale() -> f32 {
|
||||
10.0
|
||||
}
|
||||
|
||||
fn default_terrain_chunk_quads() -> u32 {
|
||||
16
|
||||
}
|
||||
|
||||
impl Default for BrushDesc {
|
||||
fn default() -> Self {
|
||||
Self::cuboid(Vec3::ONE)
|
||||
@@ -1392,6 +1513,7 @@ impl Default for EditorVisibility {
|
||||
pub enum ActorKind {
|
||||
Empty,
|
||||
Brush,
|
||||
Terrain,
|
||||
StaticMesh,
|
||||
SkinnedMesh,
|
||||
ImportedModel,
|
||||
|
||||
@@ -10,6 +10,7 @@ mod primitives;
|
||||
mod skinned_meshes;
|
||||
mod static_meshes;
|
||||
pub mod strip;
|
||||
mod terrain;
|
||||
mod visibility;
|
||||
|
||||
pub use lights::cascade_config_from_rendering;
|
||||
@@ -37,6 +38,8 @@ use static_meshes::{
|
||||
hydrate_static_mesh_renderers, spawn_static_mesh_parts, HydratedStaticMeshPart,
|
||||
StaticMeshArtifactCache,
|
||||
};
|
||||
pub use terrain::HydratedTerrainChunk;
|
||||
use terrain::{cleanup_removed_terrain, hydrate_terrain};
|
||||
use visibility::{
|
||||
ensure_level_object_visibility_hierarchy, init_editor_visibility_on_spawn,
|
||||
sync_editor_visibility, visibility_from_editor,
|
||||
@@ -73,6 +76,7 @@ impl Plugin for HydrationPlugin {
|
||||
(
|
||||
hydrate_primitives,
|
||||
hydrate_brushes,
|
||||
hydrate_terrain,
|
||||
hydrate_materials,
|
||||
hydrate_lights,
|
||||
reconcile_missing_runtime_lights,
|
||||
@@ -83,6 +87,7 @@ impl Plugin for HydrationPlugin {
|
||||
hydrate_models,
|
||||
hydrate_prefabs,
|
||||
hydrate_physics,
|
||||
cleanup_removed_terrain,
|
||||
)
|
||||
.chain()
|
||||
.in_set(HydrationSet::Content),
|
||||
|
||||
@@ -0,0 +1,314 @@
|
||||
//! Chunked render and collider hydration for authored height-grid terrain.
|
||||
|
||||
use avian3d::prelude::ColliderConstructor;
|
||||
use bevy::asset::RenderAssetUsages;
|
||||
use bevy::light::{NotShadowCaster, NotShadowReceiver};
|
||||
use bevy::mesh::{Indices, PrimitiveTopology};
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::{
|
||||
authoring_component_active, load_resolved_material_from_path, AuthoringComponentStates,
|
||||
InspectorOrder, LevelObject, RaytracingExcluded, TerrainDesc, COMPONENT_TERRAIN_DESC,
|
||||
};
|
||||
|
||||
use super::materials::material_from_desc;
|
||||
|
||||
#[derive(Component, Reflect, Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[reflect(Component, Default, Debug)]
|
||||
pub struct HydratedTerrainChunk {
|
||||
pub owner: Entity,
|
||||
pub chunk_x: u32,
|
||||
pub chunk_z: u32,
|
||||
}
|
||||
|
||||
impl Default for HydratedTerrainChunk {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
owner: Entity::PLACEHOLDER,
|
||||
chunk_x: 0,
|
||||
chunk_z: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub fn hydrate_terrain(
|
||||
mut commands: Commands,
|
||||
asset_server: Res<AssetServer>,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
terrains: Query<
|
||||
(
|
||||
Entity,
|
||||
&TerrainDesc,
|
||||
Option<&AuthoringComponentStates>,
|
||||
Option<&InspectorOrder>,
|
||||
),
|
||||
(
|
||||
With<LevelObject>,
|
||||
Or<(
|
||||
Added<TerrainDesc>,
|
||||
Changed<TerrainDesc>,
|
||||
Changed<AuthoringComponentStates>,
|
||||
Changed<InspectorOrder>,
|
||||
)>,
|
||||
),
|
||||
>,
|
||||
children: Query<&Children>,
|
||||
chunks: Query<(), With<HydratedTerrainChunk>>,
|
||||
) {
|
||||
for (entity, terrain, states, order) in &terrains {
|
||||
despawn_terrain_chunks(&mut commands, entity, &children, &chunks);
|
||||
if authoring_component_active(states, order, COMPONENT_TERRAIN_DESC) {
|
||||
spawn_terrain_chunks(
|
||||
&mut commands,
|
||||
&asset_server,
|
||||
&mut meshes,
|
||||
&mut materials,
|
||||
entity,
|
||||
terrain,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cleanup_removed_terrain(
|
||||
mut commands: Commands,
|
||||
mut removed: RemovedComponents<TerrainDesc>,
|
||||
children: Query<&Children>,
|
||||
chunks: Query<(), With<HydratedTerrainChunk>>,
|
||||
) {
|
||||
for entity in removed.read() {
|
||||
despawn_terrain_chunks(&mut commands, entity, &children, &chunks);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn spawn_terrain_chunks(
|
||||
commands: &mut Commands,
|
||||
asset_server: &AssetServer,
|
||||
meshes: &mut Assets<Mesh>,
|
||||
materials: &mut Assets<StandardMaterial>,
|
||||
owner: Entity,
|
||||
terrain: &TerrainDesc,
|
||||
) {
|
||||
if let Err(error) = terrain.validate() {
|
||||
warn!("Terrain hydration skipped invalid actor {owner:?}: {error}");
|
||||
return;
|
||||
}
|
||||
|
||||
let material = terrain
|
||||
.base_material
|
||||
.as_ref()
|
||||
.and_then(|reference| reference.source_path.as_deref())
|
||||
.and_then(|path| match load_resolved_material_from_path(path) {
|
||||
Ok((desc, _)) => Some(material_from_desc(asset_server, &desc)),
|
||||
Err(error) => {
|
||||
warn!("Terrain {owner:?} material could not resolve: {error}");
|
||||
None
|
||||
}
|
||||
})
|
||||
.unwrap_or_else(|| StandardMaterial {
|
||||
base_color: Color::srgb(0.24, 0.29, 0.25),
|
||||
perceptual_roughness: 0.92,
|
||||
..default()
|
||||
});
|
||||
let material = materials.add(material);
|
||||
let quad_count = terrain.resolution - 1;
|
||||
let chunks_per_axis = quad_count.div_ceil(terrain.chunk_quads);
|
||||
|
||||
for chunk_z in 0..chunks_per_axis {
|
||||
for chunk_x in 0..chunks_per_axis {
|
||||
let start_x = chunk_x * terrain.chunk_quads;
|
||||
let start_z = chunk_z * terrain.chunk_quads;
|
||||
let end_x = (start_x + terrain.chunk_quads).min(quad_count);
|
||||
let end_z = (start_z + terrain.chunk_quads).min(quad_count);
|
||||
let Some(mesh) = terrain_chunk_mesh(terrain, start_x, start_z, end_x, end_z) else {
|
||||
continue;
|
||||
};
|
||||
let mesh = meshes.add(mesh);
|
||||
let mut chunk = commands.spawn((
|
||||
HydratedTerrainChunk {
|
||||
owner,
|
||||
chunk_x,
|
||||
chunk_z,
|
||||
},
|
||||
Name::new(format!("Terrain Chunk {chunk_x},{chunk_z}")),
|
||||
Mesh3d(mesh),
|
||||
MeshMaterial3d(material.clone()),
|
||||
Transform::default(),
|
||||
Visibility::Visible,
|
||||
RaytracingExcluded,
|
||||
ChildOf(owner),
|
||||
));
|
||||
if terrain.generate_colliders {
|
||||
chunk.insert(ColliderConstructor::TrimeshFromMesh);
|
||||
}
|
||||
if !terrain.cast_shadows {
|
||||
chunk.insert(NotShadowCaster);
|
||||
}
|
||||
if !terrain.receive_shadows {
|
||||
chunk.insert(NotShadowReceiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn despawn_terrain_chunks(
|
||||
commands: &mut Commands,
|
||||
entity: Entity,
|
||||
children: &Query<&Children>,
|
||||
chunks: &Query<(), With<HydratedTerrainChunk>>,
|
||||
) {
|
||||
let Ok(children) = children.get(entity) else {
|
||||
return;
|
||||
};
|
||||
for child in children.iter() {
|
||||
if chunks.get(child).is_ok() {
|
||||
commands.entity(child).despawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn terrain_chunk_mesh(
|
||||
terrain: &TerrainDesc,
|
||||
start_x: u32,
|
||||
start_z: u32,
|
||||
end_x: u32,
|
||||
end_z: u32,
|
||||
) -> Option<Mesh> {
|
||||
if start_x >= end_x
|
||||
|| start_z >= end_z
|
||||
|| end_x >= terrain.resolution
|
||||
|| end_z >= terrain.resolution
|
||||
{
|
||||
return None;
|
||||
}
|
||||
let width = end_x - start_x + 1;
|
||||
let depth = end_z - start_z + 1;
|
||||
let mut positions = Vec::with_capacity((width * depth) as usize);
|
||||
let mut normals = Vec::with_capacity((width * depth) as usize);
|
||||
let mut uvs = Vec::with_capacity((width * depth) as usize);
|
||||
let quad_count = (terrain.resolution - 1) as f32;
|
||||
let half_extent = quad_count * terrain.sample_spacing * 0.5;
|
||||
|
||||
let sample = |x: u32, z: u32| {
|
||||
terrain.heights[(z * terrain.resolution + x) as usize] * terrain.height_scale
|
||||
};
|
||||
for z in start_z..=end_z {
|
||||
for x in start_x..=end_x {
|
||||
let left = sample(x.saturating_sub(1), z);
|
||||
let right = sample((x + 1).min(terrain.resolution - 1), z);
|
||||
let down = sample(x, z.saturating_sub(1));
|
||||
let up = sample(x, (z + 1).min(terrain.resolution - 1));
|
||||
let normal = Vec3::new(left - right, 2.0 * terrain.sample_spacing, down - up)
|
||||
.normalize_or_zero();
|
||||
positions.push([
|
||||
x as f32 * terrain.sample_spacing - half_extent,
|
||||
sample(x, z),
|
||||
z as f32 * terrain.sample_spacing - half_extent,
|
||||
]);
|
||||
normals.push(normal.to_array());
|
||||
uvs.push([x as f32 / quad_count, z as f32 / quad_count]);
|
||||
}
|
||||
}
|
||||
|
||||
let mut indices = Vec::with_capacity(((width - 1) * (depth - 1) * 6) as usize);
|
||||
for z in 0..depth - 1 {
|
||||
for x in 0..width - 1 {
|
||||
let a = z * width + x;
|
||||
let b = a + 1;
|
||||
let c = a + width;
|
||||
let d = c + 1;
|
||||
indices.extend_from_slice(&[a, c, b, b, c, d]);
|
||||
}
|
||||
}
|
||||
|
||||
let mut mesh = Mesh::new(
|
||||
PrimitiveTopology::TriangleList,
|
||||
RenderAssetUsages::default(),
|
||||
);
|
||||
mesh.insert_attribute(Mesh::ATTRIBUTE_POSITION, positions);
|
||||
mesh.insert_attribute(Mesh::ATTRIBUTE_NORMAL, normals);
|
||||
mesh.insert_attribute(Mesh::ATTRIBUTE_UV_0, uvs);
|
||||
mesh.insert_indices(Indices::U32(indices));
|
||||
if let Err(error) = mesh.generate_tangents() {
|
||||
warn!("Terrain chunk tangent generation failed: {error:?}");
|
||||
}
|
||||
Some(mesh)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::ActorKind;
|
||||
|
||||
#[test]
|
||||
fn chunk_mesh_has_expected_topology() {
|
||||
let terrain = TerrainDesc::flat(5);
|
||||
let mesh = terrain_chunk_mesh(&terrain, 0, 0, 4, 4).unwrap();
|
||||
assert_eq!(mesh.count_vertices(), 25);
|
||||
assert_eq!(mesh.indices().unwrap().len(), 96);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn descriptor_rejects_mismatched_and_non_finite_heights() {
|
||||
let mut terrain = TerrainDesc::flat(3);
|
||||
terrain.heights.pop();
|
||||
assert!(terrain.validate().unwrap_err().contains("requires 9"));
|
||||
terrain.heights.push(f32::NAN);
|
||||
assert!(terrain.validate().unwrap_err().contains("finite"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn descriptor_round_trips_through_ron() {
|
||||
let mut terrain = TerrainDesc::flat(5);
|
||||
terrain.heights[12] = 0.75;
|
||||
terrain.sample_spacing = 2.0;
|
||||
let text = ron::to_string(&terrain).unwrap();
|
||||
let restored: TerrainDesc = ron::from_str(&text).unwrap();
|
||||
assert_eq!(restored, terrain);
|
||||
assert!(restored.validate().is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hydration_generates_runtime_only_chunks_and_cleans_up() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins((MinimalPlugins, AssetPlugin::default()))
|
||||
.init_asset::<Mesh>()
|
||||
.init_asset::<StandardMaterial>()
|
||||
.add_systems(Update, (hydrate_terrain, cleanup_removed_terrain).chain());
|
||||
let owner = app
|
||||
.world_mut()
|
||||
.spawn((
|
||||
LevelObject,
|
||||
ActorKind::Terrain,
|
||||
TerrainDesc {
|
||||
resolution: 5,
|
||||
heights: vec![0.0; 25],
|
||||
chunk_quads: 2,
|
||||
..Default::default()
|
||||
},
|
||||
Transform::default(),
|
||||
))
|
||||
.id();
|
||||
|
||||
app.update();
|
||||
app.update();
|
||||
let children = app.world().get::<Children>(owner).unwrap();
|
||||
assert_eq!(children.len(), 4);
|
||||
for child in children.iter() {
|
||||
assert!(app.world().get::<HydratedTerrainChunk>(child).is_some());
|
||||
assert!(app.world().get::<LevelObject>(child).is_none());
|
||||
assert!(app.world().get::<Mesh3d>(child).is_some());
|
||||
assert!(app.world().get::<ColliderConstructor>(child).is_some());
|
||||
}
|
||||
|
||||
app.world_mut().entity_mut(owner).remove::<TerrainDesc>();
|
||||
app.update();
|
||||
app.update();
|
||||
assert!(app
|
||||
.world()
|
||||
.get::<Children>(owner)
|
||||
.is_none_or(Children::is_empty));
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,8 @@ pub use components::*;
|
||||
pub use hydration::{
|
||||
cascade_config_from_rendering, flush_level_object_hydration, material_from_desc,
|
||||
strip_hydrated, strip_hydrated_entity, HydratedModelRoot, HydratedPrefabMember,
|
||||
HydratedPrefabReady, HydratedSkinnedMeshRoot, HydrationPlugin, PrefabHydrationBlocked,
|
||||
HydratedPrefabReady, HydratedSkinnedMeshRoot, HydratedTerrainChunk, HydrationPlugin,
|
||||
PrefabHydrationBlocked,
|
||||
};
|
||||
pub use material_asset::{
|
||||
load_resolved_material_from_path, MaterialAlphaMode, MaterialAsset, MaterialInstanceAsset,
|
||||
@@ -112,6 +113,7 @@ impl Plugin for SharedTypesPlugin {
|
||||
.register_type::<Primitive>()
|
||||
.register_type::<PrimitiveShape>()
|
||||
.register_type::<BrushDesc>()
|
||||
.register_type::<TerrainDesc>()
|
||||
.register_type::<BrushKind>()
|
||||
.register_type::<BrushPlaneDesc>()
|
||||
.register_type::<BrushFaceDesc>()
|
||||
|
||||
@@ -52,6 +52,8 @@ Immutable-style log of significant decisions. Add a new numbered ADR when changi
|
||||
| [0035](adr/0035-shared-material-assets-and-renderer-slots.md) | Shared Material/Material Instance assets, stable renderer slots, and runtime-only property blocks |
|
||||
| [0036](adr/0036-surface-abi-and-solari-parity.md) | Constrained Surface ABI v1, raster/Solari evaluator parity, and deformed-geometry boundary |
|
||||
| [0037](adr/0037-collaborative-authored-file-safety.md) | Exact authored-file revisions, observational Git status, and optional ownership providers |
|
||||
| [0038](adr/0038-non-blocking-native-dialog-broker.md) | Worker-owned native waits with one-shot main-thread workflow completion |
|
||||
| [0039](adr/0039-inline-height-grid-terrain-foundation.md) | Inline authored height grids with deterministic runtime-only chunk hydration |
|
||||
|
||||
## Editor framework
|
||||
|
||||
@@ -77,6 +79,8 @@ Immutable-style log of significant decisions. Add a new numbered ADR when changi
|
||||
| [editor/extensibility.md](editor/extensibility.md) | Static authoring component registration, lifecycle, composition, and history contract |
|
||||
| [editor/material-system.md](editor/material-system.md) | Shared material assets and instances, renderer-slot assignment, Surface evaluators, migration, and diagnostics |
|
||||
| [editor/collaborative-file-safety.md](editor/collaborative-file-safety.md) | Guarded authored writes, compact Git/read-only status, conflict recovery, and ownership providers |
|
||||
| [editor/native-dialogs.md](editor/native-dialogs.md) | Non-blocking native dialog acquisition and main-thread result application |
|
||||
| [editor/terrain.md](editor/terrain.md) | Terrain schema, inspector workflow, chunk hydration, collision, and follow-on boundaries |
|
||||
| [editor/evaluations/material-renderer-foundation/](editor/evaluations/material-renderer-foundation/) | Live screenshots and acceptance results for the renderer/material/component foundation |
|
||||
| [editor/evaluations/navigation-authoring/](editor/evaluations/navigation-authoring/) | Live screenshots and acceptance results for navigation authoring and runtime parity |
|
||||
| [editor/evaluations/production-readiness/](editor/evaluations/production-readiness/) | Current versioned production gate, evidence matrix, candidate commands, soak protocol, and independent sign-off requirements |
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# ADR 0038: Non-Blocking Native Dialog Broker
|
||||
|
||||
## Status
|
||||
|
||||
Accepted
|
||||
|
||||
## Context
|
||||
|
||||
Blacksite opens native file, folder, Save As, and confirmation dialogs from editor workflows. Calling
|
||||
the synchronous `rfd` API inside a Bevy/egui system stops window event processing until the dialog
|
||||
returns. On Wayland compositors this can trigger an application-not-responding prompt even though
|
||||
the native dialog is operating normally.
|
||||
|
||||
Path selection precedes stateful main-thread work such as scene serialization, imports, history
|
||||
changes, prefab relinking, collaborative revision checks, and project activation. Moving those
|
||||
operations to arbitrary worker threads would violate ECS ownership and weaken existing guards.
|
||||
|
||||
## Decision
|
||||
|
||||
The editor owns one `NativeDialogBroker` resource. A workflow submits native dialog construction and
|
||||
a typed completion callback. The broker runs only the blocking native dialog wait on a worker thread,
|
||||
then queues the result. An exclusive Bevy system drains the queue and invokes each completion exactly
|
||||
once with `&mut World`.
|
||||
|
||||
Only one native dialog may be active. Additional requests fail immediately with explicit status.
|
||||
Cancellation is delivered as the dialog API's empty or cancel result and remains non-mutating.
|
||||
Initiating workflows capture stable entity IDs or paths and revalidate them before applying a result.
|
||||
|
||||
Native confirmation dialogs use the same broker. A requested close or project switch proceeds only
|
||||
after the confirmation result and any required save have completed; an incomplete asynchronous save
|
||||
pauses the transition rather than discarding content.
|
||||
|
||||
## Consequences
|
||||
|
||||
- Blacksite continues rendering and answering compositor pings while native dialogs are open.
|
||||
- Project and ECS mutations remain on the Bevy main thread with their existing history, validation,
|
||||
and collaborative file-revision boundaries.
|
||||
- Workflows split dialog acquisition from result application and handle stale initiating state.
|
||||
- The one-dialog policy is intentionally global across the editor and Project Browser.
|
||||
- A future platform-specific async backend can replace the worker without changing completions.
|
||||
@@ -0,0 +1,38 @@
|
||||
# ADR 0039: Inline Height-Grid Terrain Foundation
|
||||
|
||||
## Status
|
||||
|
||||
Accepted
|
||||
|
||||
## Context
|
||||
|
||||
Terrain sculpting, material painting, physics placement, recovery, and prefab workflows need one
|
||||
stable owner for height data. Generated meshes and colliders cannot be authoritative because they
|
||||
are runtime artifacts, while introducing an external binary heightmap before editing semantics exist
|
||||
would add file-move, revision, import, and multi-document transaction complexity prematurely.
|
||||
|
||||
## Decision
|
||||
|
||||
`TerrainDesc` schema v1 stores a bounded square grid of normalized finite `f32` heights directly in
|
||||
the authored scene component. It also stores sample spacing, height scale, chunk quad size, an
|
||||
optional shared base Material/Material Instance reference, collider generation, and shadow flags.
|
||||
|
||||
Hydration deterministically partitions grid quads into generated children. Boundary samples are
|
||||
duplicated between neighboring render chunks so each chunk has complete normals and independent
|
||||
triangle geometry. Chunk meshes/colliders are never `LevelObject` entities and are therefore absent
|
||||
from saved scenes, recovery documents, prefabs, and history snapshots.
|
||||
|
||||
Resolution changes are explicit destructive flat-grid replacements in the foundation inspector.
|
||||
Sculpt tools mutate the existing grid through grouped history transactions. A future external
|
||||
heightmap representation requires an explicit schema migration and authored-file ownership ADR; it
|
||||
must not silently rewrite an inline terrain during normal load.
|
||||
|
||||
## Consequences
|
||||
|
||||
- Scene, prefab, undo, recovery, collaboration, and validation use one exact terrain document.
|
||||
- V1 grids are bounded to 1025×1025 samples to prevent accidental unbounded scene payloads.
|
||||
- Large production terrains may eventually need tiled external storage and streaming.
|
||||
- Foundation chunks remain raster-only in Solari until terrain layer materials have an exact Surface
|
||||
evaluator in `#24`; explicit exclusion is preferred to a black or mismatched ray-traced proxy.
|
||||
- Layer weights and sculpt strokes extend this descriptor contract in `#23`/`#24`; generated chunks
|
||||
remain disposable regardless of the editing representation.
|
||||
@@ -24,8 +24,13 @@ Docs for the in-process egui editor (`crates/editor/`). Update this index when a
|
||||
| [extensibility.md](extensibility.md) | Static authoring component lifecycle registration, stable IDs, composition, and generic history |
|
||||
| [material-system.md](material-system.md) | Shared Material/Material Instance assets, static/skinned renderer slots, Surface ABI, Solari scope, and migration |
|
||||
| [collaborative-file-safety.md](collaborative-file-safety.md) | Exact authored-file revisions, Git/read-only status, conflict recovery, and optional ownership providers |
|
||||
| [native-dialogs.md](native-dialogs.md) | Non-blocking file/folder/confirmation acquisition and main-thread result application |
|
||||
| [terrain.md](terrain.md) | Inline height-grid terrain, chunk hydration, collision, inspector workflow, and fixtures |
|
||||
| [evaluations/material-renderer-foundation/](evaluations/material-renderer-foundation/) | Live screenshots and verification record for the renderer/material/component foundation |
|
||||
| [evaluations/material-library-targeted-drop/](evaluations/material-library-targeted-drop/) | Live screenshot and verification record for the docked Material Library and exact reversible surface drops |
|
||||
| [evaluations/collaborative-file-safety/](evaluations/collaborative-file-safety/) | Live screenshot and verification record for source-control status and guarded external-change recovery |
|
||||
| [evaluations/native-dialog-responsiveness/](evaluations/native-dialog-responsiveness/) | Live native-Wayland screenshot and verification record for non-blocking picker responsiveness |
|
||||
| [evaluations/terrain-foundation/](evaluations/terrain-foundation/) | Live screenshot and verification record for height-grid terrain schema and chunk hydration |
|
||||
| [evaluations/navigation-authoring/](evaluations/navigation-authoring/) | Live screenshots and verification record for navigation authoring and runtime parity |
|
||||
| [evaluations/production-readiness/](evaluations/production-readiness/) | Current #50 release-candidate matrix and required clean-checkout, soak, performance, limitation, and independent-signoff evidence |
|
||||
|
||||
@@ -35,6 +40,7 @@ Docs for the in-process egui editor (`crates/editor/`). Update this index when a
|
||||
|-------------|----------------|-----|
|
||||
| `lib.rs` / `EditorPluginGroup` | Ordered plugin bundle, lib/bin split | ADR 0008, architecture.md |
|
||||
| `shared::components::BrushDesc` / `shared::hydration::brushes` | Persisted brush authoring data and generated runtime mesh hydration | brushes.md, ADR 0021 |
|
||||
| `shared::components::TerrainDesc` / `shared::hydration::terrain` | Persisted height grid and generated render/collider chunks | terrain.md, ADR 0039 |
|
||||
| `scene/` | Level I/O, tabs, composition materialization, schema, viewport render-target setup | architecture.md, multi-scene-composition.md, ADR 0026 |
|
||||
| `viewport/` | Camera, selection, gizmos, render views | architecture.md |
|
||||
| `play/` | PIE session, editor mode state | architecture.md |
|
||||
@@ -47,6 +53,7 @@ Docs for the in-process egui editor (`crates/editor/`). Update this index when a
|
||||
| `shared::prefab_overrides` | Versioned stable override schema and editor-independent runtime application | prefab-authoring.md, ADR 0027 |
|
||||
| `project/` | Workspace, settings UI, user prefs, support diagnostics | roadmap Phase 1 |
|
||||
| `project/collaboration.rs` | Guarded authored writes, asynchronous Git status, and optional ownership providers | collaborative-file-safety.md, ADR 0037 |
|
||||
| `project/native_dialog.rs` | One-at-a-time native dialog worker and one-shot main-thread completions | native-dialogs.md, ADR 0038 |
|
||||
| `project/session.rs` | Versioned XDG session document, clean marker, and safe resume | session-recovery.md, ADR 0024 |
|
||||
| `project/diagnostics_bundle.rs` | Privacy-bounded transactional support report export | session-recovery.md, ADR 0024 |
|
||||
| `project/launcher.rs` | Strict project inspection, CLI activation, recent filtering, and sandbox scaffolding | project-launcher.md, ADR 0025 |
|
||||
|
||||
@@ -56,3 +56,7 @@ empty provider registry performs no calls and adds no UI.
|
||||
|
||||
The architectural policy is recorded in
|
||||
[ADR 0037](../adr/0037-collaborative-authored-file-safety.md).
|
||||
|
||||
Live editor acceptance, including external-change detection, metadata comparison, cancel/reload
|
||||
invariants, and source-control status, is recorded in the
|
||||
[collaborative file-safety evaluation](evaluations/collaborative-file-safety/).
|
||||
@@ -0,0 +1,39 @@
|
||||
# Collaborative File Safety Evaluation
|
||||
|
||||
Date: 2026-07-12
|
||||
Branch: `codex/collaboration-live-acceptance`
|
||||
Implementation commits: `5a82a9e`, `f2ad88f`
|
||||
|
||||
This record captures live acceptance for source-control status and guarded authored-file writes.
|
||||
The permanent workflow and recovery contract live in the
|
||||
[collaborative file-safety guide](../../collaborative-file-safety.md).
|
||||
|
||||
## Live Editor Evidence
|
||||
|
||||
The image below is a native Wayland capture from the debug editor. A disposable untracked scene
|
||||
was loaded, changed locally, and then changed independently on disk before Save.
|
||||
|
||||

|
||||
|
||||
The bottom status strip reports the active scene as `UNTRACKED`. The guarded save left the disk
|
||||
revision unchanged and opened recovery choices with the exact loaded/current revision, byte count,
|
||||
modified time, and permissions.
|
||||
|
||||
## Acceptance Results
|
||||
|
||||
| Area | Result | Evidence |
|
||||
|------|--------|----------|
|
||||
| Source-control status | Pass | Active disposable scene reported `UNTRACKED` without disrupting the editor workflow |
|
||||
| External-change guard | Pass | Save detected the changed disk revision and did not overwrite it |
|
||||
| Metadata comparison | Pass | Loaded/current revision, byte count, modified time, and permissions were displayed |
|
||||
| Cancel invariants | Pass | Cancel preserved the dirty local scene and made no filesystem change |
|
||||
| Invalid reload | Pass | Malformed external RON failed safely, kept the recovery dialog open, and reported the error |
|
||||
| Valid reload | Pass | Reload replaced the local draft, removed its duplicate actor, cleared dirty/history state, and adopted the disk revision |
|
||||
| Repository hygiene | Pass | Disposable scene and importer registry churn were removed after acceptance |
|
||||
| Packaged acceptance | Deferred | Explicitly deferred by project-owner direction; no packaged result is claimed here |
|
||||
|
||||
## Automated Verification
|
||||
|
||||
The implementation commits were already covered on integrated `main` by the workspace formatting,
|
||||
check, strict Clippy, test, level-validation, and navigation-artifact suites. This evidence-only
|
||||
change was additionally checked with `git diff --check`.
|
||||
Binary file not shown.
@@ -0,0 +1,42 @@
|
||||
# Native Dialog Responsiveness Evaluation
|
||||
|
||||
Date: 2026-07-12
|
||||
Branch: `codex/non-blocking-native-dialogs`
|
||||
Implementation commits: `d038cf3` and the closing commit for Gitea #52
|
||||
|
||||
This record captures live acceptance for the non-blocking native-dialog broker. The permanent
|
||||
workflow contract lives in the [native-dialog guide](../../native-dialogs.md).
|
||||
|
||||
## Live Editor Evidence
|
||||
|
||||
The native KDE portal Open dialog below was launched through the production `SceneIoRequest::Open`
|
||||
path in a native Wayland debug editor and held open for 12 seconds.
|
||||
|
||||

|
||||
|
||||
During the hold, Hyprland continued to report Blacksite as mapped, visible, input-capable, and native
|
||||
Wayland. No application-not-responding client appeared. Cancel closed the picker without changing the
|
||||
active scene, and the editor then stopped cleanly.
|
||||
|
||||
## Acceptance Results
|
||||
|
||||
| Area | Result | Evidence |
|
||||
|------|--------|----------|
|
||||
| Frame responsiveness | Pass | A blocked-dialog regression test advances eight Bevy frames before releasing the worker; live editor remained compositor-responsive during the 12-second picker hold |
|
||||
| Shared coverage | Pass | Every `rfd::FileDialog` and `rfd::MessageDialog` construction is inside a `NativeDialogBroker::request` worker closure |
|
||||
| Request exclusivity | Pass | Focused test rejects a second request while one is pending and permits work after one-shot completion |
|
||||
| Cancellation | Pass | Live Open cancellation preserved the active scene; workflow callbacks retain explicit non-mutating cancel branches |
|
||||
| Main-thread application | Pass | Paths/results cross the broker, while scene, asset, history, registry, project, and collaboration work remains in `&mut World` completions |
|
||||
| Stale initiating state | Pass | Prefab/export completions reject missing initiating entities; composition validates against current state after selection |
|
||||
| Packaged acceptance | Deferred | Explicitly deferred by project-owner direction; no packaged result is claimed here |
|
||||
|
||||
## Automated Verification
|
||||
|
||||
| Command/suite | Result |
|
||||
|---------------|--------|
|
||||
| `cargo fmt --all -- --check` | Pass |
|
||||
| `cargo check --workspace --all-targets` | Pass |
|
||||
| `cargo clippy --workspace --all-targets -- -D warnings` | Pass |
|
||||
| `cargo test --workspace` | Pass |
|
||||
| Focused native-dialog lifecycle and frame-progress tests | 2 passed |
|
||||
| `git diff --check` | Pass |
|
||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
# Production-Readiness Acceptance Matrix
|
||||
|
||||
**Matrix version:** 0.1
|
||||
**Matrix version:** 0.2
|
||||
|
||||
**Last audit:** 2026-07-12
|
||||
|
||||
@@ -30,20 +30,20 @@ another commit, a dirty worktree, or an older package do not transfer to the can
|
||||
|
||||
| ID | Requirement | State | Current evidence and gap |
|
||||
|----|-------------|-------|--------------------------|
|
||||
| G1 | Project create/open/resume, scene authoring, autosave/recovery, hierarchy, prefab, and asset integrity pass | Partial | Project/recovery/session/multi-scene/prefab implementations are documented in [project launcher](../../project-launcher.md), [session recovery](../../session-recovery.md), [multi-scene composition](../../multi-scene-composition.md), and [prefab authoring](../../prefab-authoring.md). Candidate-specific end-to-end reruns and the open asset-integrity work remain. |
|
||||
| G2 | Brush, material, terrain, physics placement, animation, audio, navigation, PIE, and build/package samples pass | Fail | Animation, audio, navigation, and build foundations are implemented. Material/drag-drop tickets `#16`, `#18`, and `#51` remain open; terrain `#22`-`#24` and physics placement `#25` are not complete; brush acceptance `#37` remains open. Packaged testing is owner-deferred. |
|
||||
| G1 | Project create/open/resume, scene authoring, autosave/recovery, hierarchy, prefab, and asset integrity pass | Partial | Project/recovery/session/multi-scene/prefab implementations are documented in [project launcher](../../project-launcher.md), [session recovery](../../session-recovery.md), [multi-scene composition](../../multi-scene-composition.md), and [prefab authoring](../../prefab-authoring.md). Collaborative file safety `#49` and non-blocking native dialogs `#52` passed live acceptance. Candidate-specific end-to-end reruns remain. |
|
||||
| G2 | Brush, material, terrain, physics placement, animation, audio, navigation, PIE, and build/package samples pass | Fail | Animation, audio, navigation, Material Library, targeted material drops, and build foundations are implemented. Renderer foundation `#51` remains open on deformed Solari geometry; terrain `#22`-`#24`, physics placement `#25`, and brush acceptance `#37` remain incomplete. Packaged testing is owner-deferred. |
|
||||
| G3 | Undo/redo/cancel invariants and helper cleanup cover every production mutation path | Partial | The reusable harness and current tool coverage are documented in [operator regression testing](../../operator-regression-testing.md). Gitea `#33` remains open for terrain-stroke and physics-settle fixtures after those tools exist. |
|
||||
| G4 | Representative project completes an eight-hour soak without unbounded memory/target growth or unrecoverable failure | Missing | No candidate soak log, resource timeline, failure ledger, or target-growth measurement exists. |
|
||||
| G5 | Cold start, scene open/save, asset refresh, common manipulation, and package-build budgets are documented and measured | Missing | Gitea `#34` is open; no ratified budgets or candidate measurement record exists. |
|
||||
| G6 | Headless content validation and CI are green from a clean checkout | Missing | [CI configuration](../../../../.github/workflows/ci.yml) exists and local source/headless checks have passed during feature work, but no clean-checkout candidate run is linked. The current Gitea server does not expose an Actions run endpoint for this repository. |
|
||||
| G7 | First-hour UX and recovery QA are signed off by someone other than the implementer | External | No independent sign-off exists. Gitea `#36` remains open; historical H1-H6 implementation-pass notes do not count. |
|
||||
| G8 | Known limitations have severity/workaround and no P0 blocker remains | Fail | Limitations are distributed across feature docs rather than one candidate ledger. Open P0 work includes `#16`, `#18`, `#32`, `#33`, `#35`, and `#51`; `#50` cannot close while a gate-relevant P0 remains. |
|
||||
| G8 | Known limitations have severity/workaround and no P0 blocker remains | Fail | Limitations are distributed across feature docs rather than one candidate ledger. Open P0 work includes `#32`, `#33`, and `#51`; `#50` cannot close while a gate-relevant P0 remains. Roadmap audit `#35`, Material Library `#16`, targeted drops `#18`, collaborative safety `#49`, and dialog responsiveness `#52` are closed. |
|
||||
|
||||
## Deliverables
|
||||
|
||||
| ID | Deliverable | State | Evidence or next action |
|
||||
|----|-------------|-------|-------------------------|
|
||||
| D1 | Versioned acceptance matrix under `docs/editor/evaluations/` | Pass | This file, version 0.1. |
|
||||
| D1 | Versioned acceptance matrix under `docs/editor/evaluations/` | Pass | This file, version 0.2. |
|
||||
| D2 | Release-candidate representative project and reproducible validation commands | Missing | Expand the committed project/regression pack through `#32`, including terrain and physics-placement samples, then nominate an exact commit. |
|
||||
| D3 | Signed milestone comment linking evidence, limitations, and exact commit | Missing | Post only after G1-G8 pass; no candidate exists yet. |
|
||||
|
||||
@@ -56,7 +56,7 @@ another commit, a dirty worktree, or an older package do not transfer to the can
|
||||
| Hierarchy parenting and prefab structure | Implemented | Not rerun |
|
||||
| Multi-scene composition | Implemented | Not rerun |
|
||||
| Brush blockout/edit/CSG | Implemented foundation; `#37` open | Not signed off |
|
||||
| Material catalog and assignment | Partial; `#16`, `#18`, `#51` open | Blocked |
|
||||
| Material catalog and assignment | Material Library and exact targeted drops accepted; `#51` open only on deformed Solari geometry | Not rerun as one candidate |
|
||||
| Terrain authoring | `#22`-`#24` open | Blocked |
|
||||
| Physics placement | `#25` open | Blocked |
|
||||
| Animation | Implemented | Not rerun |
|
||||
@@ -64,7 +64,8 @@ another commit, a dirty worktree, or an older package do not transfer to the can
|
||||
| Navigation | Implemented | Not rerun |
|
||||
| PIE | Implemented | Not rerun |
|
||||
| Build/package/runtime | Implemented foundation | Deferred by owner |
|
||||
| Collaborative file safety | Local source/headless acceptance; `#49` open | Awaiting publication and live visual QA |
|
||||
| Collaborative file safety | Implemented; `#49` closed with live external-change acceptance | Not rerun as one candidate |
|
||||
| Native file/folder dialogs | Implemented; `#52` closed with live 12-second compositor-responsiveness hold | Not rerun as one candidate |
|
||||
|
||||
## Candidate Validation Commands
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# Terrain Foundation Evaluation
|
||||
|
||||
Date: 2026-07-12
|
||||
Branch: `codex/terrain-foundation`
|
||||
Gitea issue: `#22`
|
||||
|
||||
This record captures acceptance for the persistent height-grid terrain schema and deterministic
|
||||
runtime chunk hydration. The permanent workflow lives in the [terrain guide](../../terrain.md).
|
||||
|
||||
## Live Editor Evidence
|
||||
|
||||
The native Wayland debug editor loaded the committed
|
||||
`assets/levels/terrain_authoring_showcase.scn.ron` fixture. The screenshot uses Forward rendering to
|
||||
isolate mesh/material/light correctness while foundation terrain remains explicitly excluded from
|
||||
Solari until exact terrain layer/Surface parity lands in `#24`.
|
||||
|
||||

|
||||
|
||||
The 5×5 authored grid renders as the expected asymmetric hill, resolves the committed shared
|
||||
Material Instance, and is split into four 2×2-quad chunks with generated trimesh colliders. The
|
||||
authored scene contains no `HydratedTerrainChunk`, `Mesh3d`, or collider-constructor components.
|
||||
|
||||
## Acceptance Results
|
||||
|
||||
| Area | Result | Evidence |
|
||||
|------|--------|----------|
|
||||
| Schema and serialization | Pass | Versioned bounded descriptor, exact height count, finite-value and scale/chunk validation, RON round-trip test |
|
||||
| Chunk hydration | Pass | Deterministic four-chunk runtime fixture; topology test verifies 25 vertices and 96 indices for a 4×4-quad mesh |
|
||||
| Runtime-only ownership | Pass | Hydration test verifies children have mesh/collider/owner markers but no `LevelObject`, then verifies removal cleanup |
|
||||
| Actor/editor integration | Pass | First-class Terrain kind, registry descriptor, hierarchy/viewport icon, reflected Add Component and inspector transaction path |
|
||||
| Material behavior | Pass with boundary | Shared Material/Instance source resolves for raster; missing source uses visible fallback; Solari submission is explicitly excluded pending `#24` |
|
||||
| Project validation | Pass | 60 level dependencies, existing 5 non-blocking findings, 0 blocking errors |
|
||||
| Packaged acceptance | Deferred | Explicitly deferred by project-owner direction; no packaged result is claimed here |
|
||||
|
||||
## Automated Verification
|
||||
|
||||
| Command/suite | Result |
|
||||
|---------------|--------|
|
||||
| Focused terrain descriptor/topology/hydration tests | 4 passed |
|
||||
| Editor component registry reflection contract | Pass |
|
||||
| `cargo check --workspace --all-targets` | Pass |
|
||||
| `cargo validate-levels --project .` | 60 dependencies, 5 findings, 0 blockers |
|
||||
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
# Native Dialog Workflows
|
||||
|
||||
Blacksite routes native file, folder, Save As, and unsaved-change confirmation dialogs through the
|
||||
shared `NativeDialogBroker`. A native dialog may remain open without blocking Bevy's window event
|
||||
loop or editor rendering.
|
||||
|
||||
## Workflow Contract
|
||||
|
||||
- One native dialog can be active at a time. Direct controls are disabled while pending; other
|
||||
concurrent requests report that a dialog is already open.
|
||||
- Native work returns only selected paths or a confirmation result. Scene, asset, project, history,
|
||||
registry, and collaborative-file mutations run later on the Bevy main thread.
|
||||
- Cancel is non-mutating and produces workflow-specific status.
|
||||
- Entity-based operations capture the initiating entity and reject stale results. Composition
|
||||
additions validate against the current composition so intervening edits are not overwritten.
|
||||
- Collaborative Save As performs the same revision and destination checks after selection.
|
||||
- Close or project switch never treats an opened Save As picker as a completed save. When a save
|
||||
remains pending, the transition pauses and can be retried after saving.
|
||||
|
||||
## Covered Surfaces
|
||||
|
||||
The broker owns scene Open/Save As, import/export, prefab creation and relinking, recovery copies,
|
||||
subscene selection, collaborative conflict copies, Project Browser folder selection, and dirty-scene
|
||||
confirmations. New workflows must use the broker instead of calling `rfd` from an egui/Bevy system.
|
||||
|
||||
See [ADR 0038](../adr/0038-non-blocking-native-dialog-broker.md).
|
||||
|
||||
Live native-Wayland acceptance is recorded in the
|
||||
[native-dialog responsiveness evaluation](evaluations/native-dialog-responsiveness/).
|
||||
@@ -0,0 +1,38 @@
|
||||
# Terrain Authoring
|
||||
|
||||
Terrain is a first-class authored actor backed by `TerrainDesc`. Add it from the Inspector's
|
||||
**Add Component** shelf by searching for Terrain. It conflicts with other geometry sources on the
|
||||
same actor: Primitive, Brush, Static Mesh Renderer, and Skinned Mesh Renderer.
|
||||
|
||||
## Foundation Workflow
|
||||
|
||||
The Terrain card exposes grid resolution, sample spacing, height scale, chunk size, generated
|
||||
collision, shadows, base material status, and validation. **Resize Flat** deliberately replaces the
|
||||
height array with a flat grid; normal numeric edits retain all height samples. Every accepted edit is
|
||||
one reflected history transaction and rebuilds only that terrain's generated chunks.
|
||||
|
||||
`assets/levels/terrain_authoring_showcase.scn.ron` is the deterministic foundation fixture. Its 5×5
|
||||
grid forms an asymmetric hill split into four 2×2-quad chunks. It validates chunk boundaries,
|
||||
normals, selection through generated children, collider generation, inspector state, and save
|
||||
stripping without requiring external assets.
|
||||
|
||||
## Data And Hydration
|
||||
|
||||
- Heights are finite normalized values multiplied by Height Scale at hydration time.
|
||||
- Sample Spacing controls X/Z distance and the grid remains centered on the actor origin.
|
||||
- Chunk Size is measured in quads. Neighboring chunks share boundary samples but not runtime mesh
|
||||
assets, allowing later stroke updates to rebuild only affected chunks.
|
||||
- A resolvable shared Material/Material Instance source supplies the chunk material. Missing or
|
||||
invalid references produce a warning and visible terrain fallback rather than missing geometry.
|
||||
- Generated `HydratedTerrainChunk` children own mesh, optional trimesh collider, and shadow state.
|
||||
They are runtime-only and never serialized as authored actors.
|
||||
- Foundation chunks are explicitly excluded from Solari submission and remain raster-visible while
|
||||
Auto/Solari is active. Terrain Surface/layer parity enters with the material-layer work in `#24`;
|
||||
the editor never substitutes a black or semantically different ray-traced terrain proxy.
|
||||
|
||||
Sculpt brushes and grouped stroke undo are tracked by Gitea `#23`; material layers and weight
|
||||
painting are tracked by `#24`. The persistence decision is recorded in
|
||||
[ADR 0039](../adr/0039-inline-height-grid-terrain-foundation.md).
|
||||
|
||||
Live native-Wayland evidence and focused verification are recorded in the
|
||||
[terrain foundation evaluation](evaluations/terrain-foundation/).
|
||||
Reference in new issue
Block a user