Add animation baking system

This commit is contained in:
2026-08-28 23:05:36 +02:00
parent c1315e09b6
commit c3f1074fe1
30 changed files with 1200 additions and 244 deletions
+16 -1
View File
@@ -21,7 +21,7 @@
//! save, click Rebuild in jackdaw (or run `jd build`) and it
//! appears in `Add Component`. No registration code is needed.
use bevy::prelude::*;
use bevy::{asset::processor::{AssetProcessor, ProcessorState}, prelude::*, tasks::block_on};
use bevy_asset_loader::prelude::*;
use bevy_wind_waker_shader::prelude::*;
use clap::Parser;
@@ -46,6 +46,7 @@ pub mod stage;
#[derive(States, Debug, Clone, Copy, Eq, PartialEq, Hash, Default)]
pub enum AppState {
#[default]
WaitForAssetProcessing,
LoadCommonAssets,
LoadFighterManifests,
PrepareFighterManifests,
@@ -78,6 +79,7 @@ impl Plugin for GamePlugin {
GameplaySchedulePlugin,
input::FighterInputPlugin,
fighter::FighterPlugin,
fighter::baked_animation::BakedAnimationPlugin,
stage::StagePlugin,
MatchCameraPlugin,
bevy_common_assets::ron::RonAssetPlugin::<FighterManifest>::new(&["fighter.ron"]),
@@ -109,6 +111,10 @@ impl Plugin for GamePlugin {
.on_failure_continue_to_state(AppState::CommonAssetLoadFailed)
.load_collection::<stage::manifest::StageManifestAssets>(),
)
.add_systems(
Update,
wait_for_asset_processor.run_if(in_state(AppState::WaitForAssetProcessing)),
)
.add_systems(
OnEnter(AppState::PrepareFighterManifests),
fighter::manifest::prepare_fighter_manifests,
@@ -131,6 +137,15 @@ impl Plugin for GamePlugin {
}
}
fn wait_for_asset_processor(
processor: Option<Res<AssetProcessor>>,
mut next_state: ResMut<NextState<AppState>>,
) {
if processor.is_none_or(|processor| block_on(processor.get_state()) == ProcessorState::Finished) {
next_state.set(AppState::LoadCommonAssets);
}
}
/// Spin-rate in radians per second. Attach it in the inspector; the
/// editor sees this component with no registration code because Bevy's
/// `reflect_auto_register` picks up the `Reflect` derive. `Default` +