Ship production navigation authoring workflow
This commit is contained in:
1 parent
0798aa5d57
commit
b4aa61e394
35 files changed
+3898
-602
No files matched your search
@@ -88,6 +88,7 @@ pub struct SceneIo {
|
||||
pub events: VecDeque<SceneIoEvent>,
|
||||
pub tabs: Vec<SceneTab>,
|
||||
pub active_tab: usize,
|
||||
change_revision: u64,
|
||||
next_event_id: u64,
|
||||
next_tab_id: u64,
|
||||
}
|
||||
@@ -127,6 +128,7 @@ impl Default for SceneIo {
|
||||
recovery_snapshot: None,
|
||||
}],
|
||||
active_tab: 0,
|
||||
change_revision: 0,
|
||||
next_event_id: 1,
|
||||
next_tab_id: 2,
|
||||
}
|
||||
@@ -136,14 +138,20 @@ impl Default for SceneIo {
|
||||
impl SceneIo {
|
||||
pub fn mark_dirty(&mut self) {
|
||||
self.dirty = true;
|
||||
self.change_revision = self.change_revision.wrapping_add(1);
|
||||
self.sync_active_tab_metadata();
|
||||
}
|
||||
|
||||
pub fn mark_clean(&mut self) {
|
||||
self.dirty = false;
|
||||
self.change_revision = self.change_revision.wrapping_add(1);
|
||||
self.sync_active_tab_metadata();
|
||||
}
|
||||
|
||||
pub fn change_revision(&self) -> u64 {
|
||||
self.change_revision
|
||||
}
|
||||
|
||||
pub fn active_path_label(&self) -> String {
|
||||
self.active_path
|
||||
.as_ref()
|
||||
@@ -935,7 +943,7 @@ fn save_level(world: &mut World, path: &Path) -> Result<usize, String> {
|
||||
}
|
||||
}
|
||||
|
||||
fn serialize_active_scene(world: &mut World) -> Result<String, String> {
|
||||
pub(crate) fn serialize_active_scene(world: &mut World) -> Result<String, String> {
|
||||
let entities = authored_scene_entities(world);
|
||||
if world
|
||||
.resource::<SceneIo>()
|
||||
@@ -1950,11 +1958,13 @@ mod tests {
|
||||
let mut io = SceneIo::default();
|
||||
assert_eq!(io.tabs.len(), 1);
|
||||
assert!(!io.tabs[0].dirty);
|
||||
let initial_revision = io.change_revision();
|
||||
|
||||
io.active_path = Some(PathBuf::from("assets/levels/arena.scn.ron"));
|
||||
io.mark_dirty();
|
||||
|
||||
assert!(io.has_unsaved_tabs());
|
||||
assert!(io.change_revision() > initial_revision);
|
||||
assert!(io.tabs[0].dirty);
|
||||
assert_eq!(
|
||||
io.tabs[0].path.as_deref(),
|
||||
|
||||
Reference in new issue
Block a user