pub mod tokens;
mod anim_mapper;
mod anim_query;
mod binding;
mod schema;
mod skeleton_query;
pub mod skinning;
mod skinning_query;
mod topology;
pub use anim_mapper::{AnimMapper, MISSING};
pub use anim_query::{JointTransformComponents, SkelAnimQuery};
pub use binding::{discover_bindings, SkelBinding};
pub use schema::{BlendShape, Inbetween, SkelAnimation, SkelBindingAPI, SkelRoot, Skeleton};
pub use skeleton_query::SkeletonResolver;
pub use skinning_query::SkinningResolver;
pub use topology::{Topology, TopologyError, NO_PARENT};
use tokens::*;
macro_rules! impl_skel_schema {
(boundable $ty:ident) => {
impl $crate::usd::SchemaBase for $ty {
const KIND: $crate::usd::SchemaKind = $crate::usd::SchemaKind::ConcreteTyped;
fn prim(&self) -> &$crate::usd::Prim {
&self.0
}
}
impl $crate::schemas::geom::Imageable for $ty {}
impl $crate::schemas::geom::Xformable for $ty {}
impl $crate::schemas::geom::Boundable for $ty {}
};
(typed $ty:ident) => {
impl $crate::usd::SchemaBase for $ty {
const KIND: $crate::usd::SchemaKind = $crate::usd::SchemaKind::ConcreteTyped;
fn prim(&self) -> &$crate::usd::Prim {
&self.0
}
}
};
(single_api $ty:ident) => {
impl $crate::usd::SchemaBase for $ty {
const KIND: $crate::usd::SchemaKind = $crate::usd::SchemaKind::SingleApplyApi;
fn prim(&self) -> &$crate::usd::Prim {
&self.0
}
}
};
}
pub(crate) use impl_skel_schema;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum SkinningMethod {
#[default]
ClassicLinear,
DualQuaternion,
}
impl SkinningMethod {
pub fn as_token(self) -> &'static str {
match self {
SkinningMethod::ClassicLinear => SKINNING_METHOD_CLASSIC_LINEAR,
SkinningMethod::DualQuaternion => SKINNING_METHOD_DUAL_QUATERNION,
}
}
pub fn from_token(s: &str) -> Option<Self> {
Some(match s {
SKINNING_METHOD_CLASSIC_LINEAR => SkinningMethod::ClassicLinear,
SKINNING_METHOD_DUAL_QUATERNION => SkinningMethod::DualQuaternion,
_ => return None,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum InfluenceInterpolation {
Constant,
#[default]
Vertex,
}
impl InfluenceInterpolation {
pub fn as_token(self) -> &'static str {
match self {
InfluenceInterpolation::Constant => INTERP_CONSTANT,
InfluenceInterpolation::Vertex => INTERP_VERTEX,
}
}
pub fn from_token(s: &str) -> Option<Self> {
Some(match s {
INTERP_CONSTANT => InfluenceInterpolation::Constant,
INTERP_VERTEX => InfluenceInterpolation::Vertex,
_ => return None,
})
}
}
crate::schemas::common::impl_token_value!(SkinningMethod, InfluenceInterpolation);