pub(crate) mod animation;
mod gltf;
mod initialize;
mod loader;
use crate::macros::{entity_component, marker_component};
use crate::vrma::animation::VrmaAnimationPlayersPlugin;
use crate::vrma::initialize::VrmaInitializePlugin;
use crate::vrma::loader::{VrmaAsset, VrmaLoaderPlugin};
use bevy::app::App;
use bevy::asset::Handle;
use bevy::prelude::*;
use std::path::PathBuf;
use std::time::Duration;
pub mod prelude {
pub use crate::vrma::{
LoadedVrma, Vrma, VrmaDuration, VrmaEntity, VrmaHandle, VrmaPath, VrmaPlugin,
animation::prelude::*, loader::VrmaAsset,
};
}
pub struct VrmaPlugin;
impl Plugin for VrmaPlugin {
fn build(
&self,
app: &mut App,
) {
app.add_plugins((
VrmaLoaderPlugin,
VrmaInitializePlugin,
VrmaAnimationPlayersPlugin,
));
app.register_type::<Vrma>()
.register_type::<VrmaEntity>()
.register_type::<VrmaHandle>()
.register_type::<VrmaPath>()
.register_type::<VrmaDuration>()
.register_type::<RetargetSource>()
.register_type::<VrmAnimationClipHandle>()
.register_type::<VrmAnimationNodeIndex>();
}
}
#[derive(Debug, Component, Reflect)]
#[reflect(Component)]
pub struct VrmaHandle(pub Handle<VrmaAsset>);
marker_component!(
Vrma
);
entity_component!(
VrmaEntity
);
#[derive(Component, Debug, Clone, Eq, PartialEq, Reflect, Deref)]
#[reflect(Component)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", reflect(Serialize, Deserialize))]
pub struct VrmaPath(pub PathBuf);
#[derive(Debug, Component, Reflect)]
#[reflect(Component)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", reflect(Serialize, Deserialize))]
pub struct VrmaDuration(pub Duration);
#[derive(Debug, EntityEvent, Copy, Clone, Reflect)]
pub struct LoadedVrma {
pub vrm: Entity,
#[event_target]
pub vrma: Entity,
}
#[derive(Debug, Component, Reflect)]
#[reflect(Component)]
pub(crate) struct VrmAnimationClipHandle(pub Handle<AnimationClip>);
#[derive(Debug, Component, Reflect, Copy, Clone, Default)]
#[reflect(Component, Default)]
pub(crate) struct VrmAnimationNodeIndex(pub AnimationNodeIndex);
#[derive(Debug, Component, Reflect)]
#[reflect(Component)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", reflect(Serialize, Deserialize))]
pub(crate) struct RetargetSource;