diff --git a/assets/20240205_shapekey_BevyImplementationFaceCap_5/fake_test.morph_anim.csv b/assets/20240205_shapekey_BevyImplementationFaceCap_5/fake_test.morph_anim.csv new file mode 100644 index 0000000..a606598 --- /dev/null +++ b/assets/20240205_shapekey_BevyImplementationFaceCap_5/fake_test.morph_anim.csv @@ -0,0 +1,10 @@ +Timecode,BlendshapeCount,EyeBlinkLeft,EyeLookDownLeft,EyeLookInLeft,EyeLookOutLeft,EyeLookUpLeft,EyeSquintLeft,EyeWideLeft,EyeBlinkRight,EyeLookDownRight,EyeLookInRight,EyeLookOutRight,EyeLookUpRight,EyeSquintRight,EyeWideRight,JawForward,JawRight,JawLeft,JawOpen,MouthClose,MouthFunnel,MouthPucker,MouthRight,MouthLeft,MouthSmileLeft,MouthSmileRight,MouthFrownLeft,MouthFrownRight,MouthDimpleLeft,MouthDimpleRight,MouthStretchLeft,MouthStretchRight,MouthRollLower,MouthRollUpper,MouthShrugLower,MouthShrugUpper,MouthPressLeft,MouthPressRight,MouthLowerDownLeft,MouthLowerDownRight,MouthUpperUpLeft,MouthUpperUpRight,BrowDownLeft,BrowDownRight,BrowInnerUp,BrowOuterUpLeft,BrowOuterUpRight,CheekPuff,CheekSquintLeft,CheekSquintRight,NoseSneerLeft,NoseSneerRight,TongueOut,HeadYaw,HeadPitch,HeadRoll,LeftEyeYaw,LeftEyePitch,LeftEyeRoll,RightEyeYaw,RightEyePitch,RightEyeRoll +00:00:00:00,61,0.0000000000,0.0000000000,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.0,-0.0,0.0,-0.0,-0.0,0.0,0.0,-0.0,-0.0 +00:00:00:01,61,0.5000000000,0.0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-0.0,0.0,0.0,-0.0,-0.0 +00:00:02:01,61,0.0000000000,0.1000000000,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.0,-0.0,0.0,-0.0,-0.0,0.0,0.0,-0.0,-0.0 +00:00:03:0,61,0.0000000000,0.5000000000,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.0,-0.0,0.0,-0.0,-0.0,0.0,0.0,-0.0,-0.0 +00:00:03:01,61,0.0000000000,0.0000000000,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.0,-0.0,0.0,-0.0,-0.0,0.0,0.0,-0.0,-0.0 + diff --git a/examples/simple_example.rs b/examples/simple_example.rs index 023d23e..80813d5 100644 --- a/examples/simple_example.rs +++ b/examples/simple_example.rs @@ -53,7 +53,7 @@ fn setup(mut commands: Commands, asset_server: Res) { fn setup_animation(mut commands: Commands, asset_server: Res, mut players: Query, Without)>) { for entity in &mut players { - let handle = asset_server.load_with_settings("20240205_shapekey_BevyImplementationFaceCap_5/shapekey_BevyImplementationFaceCap_5_ScottiPhone_raw.morph_anim.csv", |s: &mut CSVAnimationLoaderSettings| { s.0.parts = vec![Name::new("pascal_Head")]; }); + let handle = asset_server.load_with_settings("20240205_shapekey_BevyImplementationFaceCap_5/fake_test.morph_anim.csv", |s: &mut CSVAnimationLoaderSettings| { s.0.parts = vec![Name::new("pascal_Head")]; }); let mut player = AnimationPlayer::default(); player.play(handle.clone()).repeat(); diff --git a/src/lib.rs b/src/lib.rs index d31d255..2d494ad 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ use std::{num::ParseFloatError, str::FromStr}; use bevy::{ - animation::{self, AnimationClip, EntityPath, Keyframes, VariableCurve}, asset::{meta::Settings, Asset, AssetLoader, AsyncReadExt}, core::Name, reflect::Reflect + animation::{self, AnimationClip, EntityPath, Keyframes, VariableCurve}, asset::{meta::Settings, Asset, AssetLoader, AsyncReadExt}, core::Name, log::info, reflect::Reflect }; use serde::{de::DeserializeOwned, Deserialize, Serialize}; @@ -290,8 +290,12 @@ impl AssetLoader for CSVAnimationLoader { let csv_animation = CSVAnimation::parse(&csv).map_err(CSVAnimationLoaderError::CSVParseError)?; + info!("Parsed Animation - got {} FPS with {} total frames", csv_animation.fps, csv_animation.frames.len()); + let animation = csv_animation.generate_clip(&settings.0); + info!("Clip has duration of {}", animation.duration()); + Ok(animation) }) }