-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
226 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[package] | ||
name = "bevy_hierarchy" | ||
version = "0.6.0" | ||
edition = "2021" | ||
description = "Provides hierarchy functionality for Bevy Engine" | ||
homepage = "https://bevyengine.org" | ||
repository = "https://github.com/bevyengine/bevy" | ||
license = "MIT OR Apache-2.0" | ||
keywords = ["bevy"] | ||
|
||
[dependencies] | ||
# bevy | ||
bevy_app = { path = "../bevy_app", version = "0.6.0" } | ||
bevy_ecs = { path = "../bevy_ecs", version = "0.6.0", features = ["bevy_reflect"] } | ||
bevy_math = { path = "../bevy_math", version = "0.6.0" } | ||
bevy_reflect = { path = "../bevy_reflect", version = "0.6.0", features = ["bevy"] } | ||
bevy_utils = { path = "../bevy_utils", version = "0.6.0" } | ||
|
||
# other | ||
smallvec = { version = "1.6", features = ["serde", "union", "const_generics"] } |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
mod children; | ||
mod parent; | ||
|
||
pub use children::Children; | ||
pub use parent::{Parent, PreviousParent}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#![warn(missing_docs)] | ||
//! `bevy_hierarchy` can be used to define hierarchies of entities. | ||
//! | ||
//! Most commonly, these hierarchies are used for inheriting [`Transform`](bevy_transform::components::Transform) values | ||
//! from the [`Parent`] to its [`Children`]. | ||
mod components; | ||
pub use components::*; | ||
|
||
mod hierarchy; | ||
pub use hierarchy::*; | ||
|
||
mod child_builder; | ||
pub use child_builder::*; | ||
|
||
mod systems; | ||
pub use systems::*; | ||
|
||
#[doc(hidden)] | ||
pub mod prelude { | ||
#[doc(hidden)] | ||
pub use crate::{child_builder::*, components::*, hierarchy::*, HierarchyPlugin}; | ||
} | ||
|
||
use bevy_app::prelude::*; | ||
use bevy_ecs::prelude::*; | ||
|
||
/// The base plugin for handling [`Parent`] and [`Children`] components | ||
#[derive(Default)] | ||
pub struct HierarchyPlugin; | ||
|
||
/// Label enum for the systems relating to hierarchy upkeep | ||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemLabel)] | ||
pub enum HierarchySystem { | ||
/// Updates [`Parent`] when changes in the hierarchy occur | ||
ParentUpdate, | ||
} | ||
|
||
impl Plugin for HierarchyPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.register_type::<Children>() | ||
.register_type::<Parent>() | ||
.register_type::<PreviousParent>() | ||
.add_startup_system_to_stage( | ||
StartupStage::PostStartup, | ||
parent_update_system.label(HierarchySystem::ParentUpdate), | ||
) | ||
.add_system_to_stage( | ||
CoreStage::PostUpdate, | ||
parent_update_system.label(HierarchySystem::ParentUpdate), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
mod children; | ||
mod global_transform; | ||
mod parent; | ||
mod transform; | ||
|
||
pub use children::Children; | ||
pub use global_transform::*; | ||
pub use parent::{Parent, PreviousParent}; | ||
pub use transform::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.