diff options
Diffstat (limited to 'shared/src/resources.rs')
-rw-r--r-- | shared/src/resources.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/shared/src/resources.rs b/shared/src/resources.rs index 59d88b6..1b2136d 100644 --- a/shared/src/resources.rs +++ b/shared/src/resources.rs @@ -89,7 +89,7 @@ pub struct MeshPart { #[derive(Debug, Default, Clone)] pub struct Armature { - pub parent: Option<Vec<u32>>, + pub parent: Option<Vec<u16>>, pub transform: Option<Vec<Affine3A>>, pub name: Option<Vec<String>>, } @@ -135,10 +135,23 @@ impl ReadWrite for PrefabIndex { impl ReadWrite for Armature { fn write(&self, w: &mut dyn Write) -> Result<()> { - todo!() + write_kv_opt(w, b"parent", &self.parent)?; + write_kv_opt(w, b"transform", &self.transform)?; + write_kv_opt(w, b"name", &self.name)?; + Ok(()) } fn read(r: &mut dyn Read) -> Result<Self> { - todo!() + let mut s = Self::default(); + read_kv_iter(r, |k, v| match k { + b"parent" => Ok(s.parent = Some(read_slice(v)?)), + b"name" => Ok(s.name = Some(read_slice(v)?)), + b"transform" => Ok(s.transform = Some(read_slice(v)?)), + x => Ok(warn!( + "unknown armature key: {:?}", + String::from_utf8_lossy(x) + )), + })?; + Ok(s) } } impl ReadWrite for CollisionPart { |