mirror of
https://github.com/storytold/artcraft.git
synced 2026-10-25 18:49:38 +00:00
expanded animation table
This commit is contained in:
Generated
+1
@@ -3,6 +3,7 @@
|
||||
<words>
|
||||
<w>arpabet</w>
|
||||
<w>backfill</w>
|
||||
<w>blendshapes</w>
|
||||
<w>canonicalized</w>
|
||||
<w>canonicalizing</w>
|
||||
<w>cashapp</w>
|
||||
|
||||
@@ -15,17 +15,49 @@ use utoipa::ToSchema;
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum MediaFileAnimationType {
|
||||
/// Animation or rig for MikuMikuDance (MMD).
|
||||
/// Body: No body animation or rig.
|
||||
/// Face: Rig supporting ARKit face blendshapes, or ARKit data
|
||||
ArKit,
|
||||
|
||||
/// Body: Animation or rig for MikuMikuDance (MMD).
|
||||
/// Face: No face animation.
|
||||
MikuMikuDance,
|
||||
|
||||
/// Animation or rig for Mixamo
|
||||
/// Body: Animation or rig for MikuMikuDance (MMD).
|
||||
/// Face: Animation blendshapes for ARKit.
|
||||
MikuMikuDanceArKit,
|
||||
|
||||
/// Body: Animation or rig for Mixamo
|
||||
/// Face: No face animation.
|
||||
Mixamo,
|
||||
|
||||
/// Animation generated by MocapNet
|
||||
/// Body: Animation or rig for Mixamo
|
||||
/// Face: Animation blendshapes for ARKit.
|
||||
MixamoArKit,
|
||||
|
||||
/// Body: Animation or rig by MocapNet
|
||||
/// Face: No face animation.
|
||||
MocapNet,
|
||||
|
||||
/// Animation or rig for Rigify.
|
||||
/// Body: Animation or rig for MocapNet
|
||||
/// Face: Animation blendshapes for ARKit.
|
||||
MocapNetArKit,
|
||||
|
||||
/// Body: Animation or rig by Move.ai
|
||||
/// Face: No face animation.
|
||||
MoveAi,
|
||||
|
||||
/// Body: Animation or rig for Move.ai
|
||||
/// Face: Animation blendshapes for ARKit.
|
||||
MoveAiArKit,
|
||||
|
||||
/// Body: Animation or rig for Rigify.
|
||||
/// Face: No face animation.
|
||||
Rigify,
|
||||
|
||||
/// Body: Animation or rig for Rigify.
|
||||
/// Face: Animation blendshapes for ARKit.
|
||||
RigifyArKit,
|
||||
}
|
||||
|
||||
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
|
||||
@@ -37,19 +69,33 @@ impl_mysql_from_row!(MediaFileAnimationType);
|
||||
impl MediaFileAnimationType {
|
||||
pub fn to_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::ArKit => "ar_kit",
|
||||
Self::MikuMikuDance => "miku_miku_dance",
|
||||
Self::MikuMikuDanceArKit => "miku_miku_dance_ar_kit",
|
||||
Self::Mixamo => "mixamo",
|
||||
Self::MixamoArKit => "mixamo_ar_kit",
|
||||
Self::MocapNet => "mocap_net",
|
||||
Self::MocapNetArKit => "mocap_net_ar_kit",
|
||||
Self::MoveAi => "move_ai",
|
||||
Self::MoveAiArKit => "move_ai_ar_kit",
|
||||
Self::Rigify => "rigify",
|
||||
Self::RigifyArKit => "rigify_ar_kit",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_str(value: &str) -> Result<Self, String> {
|
||||
match value {
|
||||
"ar_kit" => Ok(Self::ArKit),
|
||||
"miku_miku_dance" => Ok(Self::MikuMikuDance),
|
||||
"miku_miku_dance_ar_kit" => Ok(Self::MikuMikuDanceArKit),
|
||||
"mixamo" => Ok(Self::Mixamo),
|
||||
"mixamo_ar_kit" => Ok(Self::MixamoArKit),
|
||||
"mocap_net" => Ok(Self::MocapNet),
|
||||
"mocap_net_ar_kit" => Ok(Self::MocapNetArKit),
|
||||
"move_ai" => Ok(Self::MoveAi),
|
||||
"move_ai_ar_kit" => Ok(Self::MoveAiArKit),
|
||||
"rigify" => Ok(Self::Rigify),
|
||||
"rigify_ar_kit" => Ok(Self::RigifyArKit),
|
||||
_ => Err(format!("invalid value: {:?}", value)),
|
||||
}
|
||||
}
|
||||
@@ -58,10 +104,17 @@ impl MediaFileAnimationType {
|
||||
// NB: BTreeSet is sorted
|
||||
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
|
||||
BTreeSet::from([
|
||||
Self::ArKit,
|
||||
Self::MikuMikuDance,
|
||||
Self::MikuMikuDanceArKit,
|
||||
Self::Mixamo,
|
||||
Self::MixamoArKit,
|
||||
Self::MocapNet,
|
||||
Self::MocapNetArKit,
|
||||
Self::MoveAi,
|
||||
Self::MoveAiArKit,
|
||||
Self::Rigify,
|
||||
Self::RigifyArKit,
|
||||
])
|
||||
}
|
||||
}
|
||||
@@ -76,37 +129,65 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_serialization() {
|
||||
assert_serialization(MediaFileAnimationType::ArKit, "ar_kit");
|
||||
assert_serialization(MediaFileAnimationType::MikuMikuDance, "miku_miku_dance");
|
||||
assert_serialization(MediaFileAnimationType::MikuMikuDanceArKit, "miku_miku_dance_ar_kit");
|
||||
assert_serialization(MediaFileAnimationType::Mixamo, "mixamo");
|
||||
assert_serialization(MediaFileAnimationType::MixamoArKit, "mixamo_ar_kit");
|
||||
assert_serialization(MediaFileAnimationType::MocapNet, "mocap_net");
|
||||
assert_serialization(MediaFileAnimationType::MocapNetArKit, "mocap_net_ar_kit");
|
||||
assert_serialization(MediaFileAnimationType::MoveAi, "move_ai");
|
||||
assert_serialization(MediaFileAnimationType::MoveAiArKit, "move_ai_ar_kit");
|
||||
assert_serialization(MediaFileAnimationType::Rigify, "rigify");
|
||||
assert_serialization(MediaFileAnimationType::RigifyArKit, "rigify_ar_kit");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_to_str() {
|
||||
assert_eq!(MediaFileAnimationType::ArKit.to_str(), "ar_kit");
|
||||
assert_eq!(MediaFileAnimationType::MikuMikuDance.to_str(), "miku_miku_dance");
|
||||
assert_eq!(MediaFileAnimationType::MikuMikuDanceArKit.to_str(), "miku_miku_dance_ar_kit");
|
||||
assert_eq!(MediaFileAnimationType::Mixamo.to_str(), "mixamo");
|
||||
assert_eq!(MediaFileAnimationType::MixamoArKit.to_str(), "mixamo_ar_kit");
|
||||
assert_eq!(MediaFileAnimationType::MocapNet.to_str(), "mocap_net");
|
||||
assert_eq!(MediaFileAnimationType::MocapNetArKit.to_str(), "mocap_net_ar_kit");
|
||||
assert_eq!(MediaFileAnimationType::MoveAi.to_str(), "move_ai");
|
||||
assert_eq!(MediaFileAnimationType::MoveAiArKit.to_str(), "move_ai_ar_kit");
|
||||
assert_eq!(MediaFileAnimationType::Rigify.to_str(), "rigify");
|
||||
assert_eq!(MediaFileAnimationType::RigifyArKit.to_str(), "rigify_ar_kit");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_str() {
|
||||
assert_eq!(MediaFileAnimationType::from_str("ar_kit").unwrap(), MediaFileAnimationType::ArKit);
|
||||
assert_eq!(MediaFileAnimationType::from_str("miku_miku_dance").unwrap(), MediaFileAnimationType::MikuMikuDance);
|
||||
assert_eq!(MediaFileAnimationType::from_str("miku_miku_dance_ar_kit").unwrap(), MediaFileAnimationType::MikuMikuDanceArKit);
|
||||
assert_eq!(MediaFileAnimationType::from_str("mixamo").unwrap(), MediaFileAnimationType::Mixamo);
|
||||
assert_eq!(MediaFileAnimationType::from_str("mixamo_ar_kit").unwrap(), MediaFileAnimationType::MixamoArKit);
|
||||
assert_eq!(MediaFileAnimationType::from_str("mocap_net").unwrap(), MediaFileAnimationType::MocapNet);
|
||||
assert_eq!(MediaFileAnimationType::from_str("mocap_net_ar_kit").unwrap(), MediaFileAnimationType::MocapNetArKit);
|
||||
assert_eq!(MediaFileAnimationType::from_str("move_ai").unwrap(), MediaFileAnimationType::MoveAi);
|
||||
assert_eq!(MediaFileAnimationType::from_str("move_ai_ar_kit").unwrap(), MediaFileAnimationType::MoveAiArKit);
|
||||
assert_eq!(MediaFileAnimationType::from_str("rigify").unwrap(), MediaFileAnimationType::Rigify);
|
||||
assert_eq!(MediaFileAnimationType::from_str("rigify_ar_kit").unwrap(), MediaFileAnimationType::RigifyArKit);
|
||||
assert!(MediaFileAnimationType::from_str("foo").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn all_variants() {
|
||||
let mut variants = MediaFileAnimationType::all_variants();
|
||||
assert_eq!(variants.len(), 4);
|
||||
assert_eq!(variants.len(), 11);
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileAnimationType::ArKit));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileAnimationType::MikuMikuDance));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileAnimationType::MikuMikuDanceArKit));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileAnimationType::Mixamo));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileAnimationType::MixamoArKit));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileAnimationType::MocapNet));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileAnimationType::MocapNetArKit));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileAnimationType::MoveAi));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileAnimationType::MoveAiArKit));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileAnimationType::Rigify));
|
||||
assert_eq!(variants.pop_first(), Some(MediaFileAnimationType::RigifyArKit));
|
||||
assert_eq!(variants.pop_first(), None);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user