bevy/crates/bevy_transform/src/lib.rs

53 lines
1.8 KiB
Rust
Raw Normal View History

pub mod components;
pub mod hierarchy;
pub mod transform_propagate_system;
pub mod prelude {
#[doc(hidden)]
2020-07-16 23:32:39 +00:00
pub use crate::{components::*, hierarchy::*, TransformPlugin};
2020-07-10 04:18:35 +00:00
}
use bevy_app::prelude::*;
use bevy_ecs::schedule::{ParallelSystemDescriptorCoercion, SystemLabel};
use prelude::{parent_update_system, Children, GlobalTransform, Parent, PreviousParent, Transform};
2020-07-16 23:32:39 +00:00
#[derive(Default)]
pub struct TransformPlugin;
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemLabel)]
pub enum TransformSystem {
TransformPropagate,
ParentUpdate,
}
2020-08-08 03:22:17 +00:00
impl Plugin for TransformPlugin {
fn build(&self, app: &mut App) {
2020-11-28 00:39:59 +00:00
app.register_type::<Children>()
.register_type::<Parent>()
.register_type::<PreviousParent>()
.register_type::<Transform>()
.register_type::<GlobalTransform>()
2020-07-16 23:32:39 +00:00
// add transform systems to startup so the first update is "correct"
.add_startup_system_to_stage(
StartupStage::PostStartup,
parent_update_system.label(TransformSystem::ParentUpdate),
)
.add_startup_system_to_stage(
StartupStage::PostStartup,
transform_propagate_system::transform_propagate_system
.label(TransformSystem::TransformPropagate)
.after(TransformSystem::ParentUpdate),
)
.add_system_to_stage(
CoreStage::PostUpdate,
parent_update_system.label(TransformSystem::ParentUpdate),
)
.add_system_to_stage(
CoreStage::PostUpdate,
transform_propagate_system::transform_propagate_system
.label(TransformSystem::TransformPropagate)
.after(TransformSystem::ParentUpdate),
);
2020-07-16 23:32:39 +00:00
}
}