From 4737804ab3728a6726d53ee4a238cd74c01b32ba Mon Sep 17 00:00:00 2001 From: Lee-Orr Date: Mon, 12 Feb 2024 16:22:27 -0500 Subject: [PATCH] add install instructions --- Cargo.toml | 2 +- README.md | 15 +++++++++++++++ assets/recorded_test.morph_anim.json | 2 +- src/lib.rs | 12 +----------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3f479f7..1e46cca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,5 +14,5 @@ serde_json = "1" itertools = "0.12" [dev-dependencies] -bevy = { version = "0.12", default-features = true } +bevy = { version = "0.12", default-features = true, features = ["file_watcher"]} bevy-inspector-egui = "0.22" diff --git a/README.md b/README.md index 32a1aa1..af53a94 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,20 @@ This is a project build for storyteller.ai, to provide support for importing ARKit data into bevy, and using it to drive shape keys. +## Install + +Add this to your dependencies alongside bevy: +```toml +bevy = "0.12" +bevy-facial-mocap = { git = "https://github.com/caladluin/bevy-facial-mocap" } #TODO - once ownership of the repo transfers, set this to the correct repository +``` + +If you add the `file_watcher` feature to bevy, this also supports hot reloading: +```toml +bevy = { version = "0.12", default-features = true, features = ["file_watcher"]} +``` + + ## Use Import the asset loader: @@ -19,6 +33,7 @@ let mut player = AnimationPlayer::default(); player.play(handle.clone()).repeat(); ``` + ## Asset Preparation To load a recording, you need 3 files: diff --git a/assets/recorded_test.morph_anim.json b/assets/recorded_test.morph_anim.json index e7f8551..5846dde 100644 --- a/assets/recorded_test.morph_anim.json +++ b/assets/recorded_test.morph_anim.json @@ -1,6 +1,6 @@ { "csv": "./20240205_shapekey_BevyImplementationFaceCap_5/shapekey_BevyImplementationFaceCap_5_ScottiPhone_cal.morph_anim.csv", "root_name": "pascal_Head", - "fps": 60, + "fps": 120, "mapping": "example_mapping.json" } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index ef13fff..05727b0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -275,7 +275,6 @@ impl CSVAnimation { let mut transform = Transform::from_rotation(Quat::from_euler(bevy::math::EulerRot::XYZ, 0., 0., 0.)); - println!("TIME: {time}"); for (mapping, csv_key) in mappings.iter() { let result = csv_morph_order .get(csv_key.as_str()) @@ -283,7 +282,6 @@ impl CSVAnimation { .and_then(|i| data.morphs.get(i)) .copied() .unwrap_or(0f32); - println!("Mapping {csv_key} - {mapping:?} -> {result}"); let axis = match mapping.axis { Axis::X => Vec3::X, @@ -297,10 +295,7 @@ impl CSVAnimation { let result = result * 180f32.to_radians() * scale + offset; - println!("Rotating {axis:?} by {result:?}"); - println!("From {}", transform.rotation.xyz()); transform.rotate_axis(axis, result); - println!("To {}", transform.rotation.xyz()); } keyframes.push(transform.rotation) @@ -751,7 +746,6 @@ mod tests { ] .iter() .map(|(key, value)| { - println!("Attempting to convert {key}"); (serde_json::from_str(key).unwrap(), value.to_string()) }) .collect(), @@ -805,11 +799,7 @@ mod tests { }; assert_eq!(keyframes.len(), 5); - - println!( - "Rotations: {:?}", - keyframes.iter().map(|v| v.xyz()).collect::>() - ); + assert!((keyframes[0].xyz() - Vec3::new(0., 0., 0.)).length() < 0.0001); assert!((keyframes[1].xyz() - Vec3::new(0.5, 0.5, -0.5)).length() < 0.01); }