mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-25 13:57:45 +00:00
28 lines
909 B
Rust
28 lines
909 B
Rust
|
// SPDX-FileCopyrightText: 2020 Inseok Lee
|
||
|
// SPDX-License-Identifier: MIT
|
||
|
|
||
|
use std::cell::RefCell;
|
||
|
use std::sync::Arc;
|
||
|
use crate::havok::animation_binding::HavokAnimationBinding;
|
||
|
use crate::havok::object::HavokObject;
|
||
|
use crate::havok::skeleton::HavokSkeleton;
|
||
|
|
||
|
pub struct HavokAnimationContainer {
|
||
|
pub skeletons: Vec<HavokSkeleton>,
|
||
|
pub bindings: Vec<HavokAnimationBinding>,
|
||
|
}
|
||
|
|
||
|
impl HavokAnimationContainer {
|
||
|
pub fn new(object: Arc<RefCell<HavokObject>>) -> Self {
|
||
|
let root = object.borrow();
|
||
|
|
||
|
let raw_skeletons = root.get("skeletons").as_array();
|
||
|
let skeletons = raw_skeletons.iter().map(|x| HavokSkeleton::new(x.as_object())).collect::<Vec<_>>();
|
||
|
|
||
|
let raw_bindings = root.get("bindings").as_array();
|
||
|
let bindings = raw_bindings.iter().map(|x| HavokAnimationBinding::new(x.as_object())).collect::<Vec<_>>();
|
||
|
|
||
|
Self { skeletons, bindings }
|
||
|
}
|
||
|
}
|