-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transform hierarchy split #2789
Closed
finegeometer
wants to merge
3
commits into
bevyengine:main
from
finegeometer:transform_hierarchy_split
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,19 @@ | ||
[package] | ||
name = "bevy_hierarchy" | ||
version = "0.5.0" | ||
edition = "2018" | ||
description = "Provides hierarchy and transform 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.5.0" } | ||
bevy_ecs = { path = "../bevy_ecs", version = "0.5.0" } | ||
bevy_reflect = { path = "../bevy_reflect", version = "0.5.0", features = ["bevy"] } | ||
bevy_utils = { path = "../bevy_utils", version = "0.5.0" } | ||
|
||
# other | ||
smallvec = { version = "1.6", features = ["serde", "union", "const_generics"] } |
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,3 @@ | ||
# Bevy Hierarchy | ||
|
||
Provides the ability to work with a parent-child hierarchy of entities. | ||
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.
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
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,34 @@ | ||
pub mod components; | ||
pub mod hierarchy; | ||
|
||
pub mod prelude { | ||
#[doc(hidden)] | ||
pub use crate::{components::*, hierarchy::*}; | ||
} | ||
|
||
use bevy_app::prelude::*; | ||
use bevy_ecs::schedule::{ParallelSystemDescriptorCoercion, SystemLabel}; | ||
use prelude::{parent_update_system, Children, Parent, PreviousParent}; | ||
|
||
#[derive(Default)] | ||
pub struct HierarchyPlugin; | ||
|
||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemLabel)] | ||
pub struct ParentUpdate; | ||
|
||
impl Plugin for HierarchyPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.register_type::<Children>() | ||
.register_type::<Parent>() | ||
.register_type::<PreviousParent>() | ||
// add hierarchy system to startup so the first update is "correct" | ||
.add_startup_system_to_stage( | ||
StartupStage::PostStartup, | ||
parent_update_system.label(ParentUpdate), | ||
) | ||
.add_system_to_stage( | ||
CoreStage::PostUpdate, | ||
parent_update_system.label(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 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,3 +1,5 @@ | ||
# Bevy Transform | ||
|
||
This crate is largely a 1:1 port from [legion_transform](https://github.com/AThilenius/legion_transform) (ecs: legion, math: nalgebra) to bevy (ecs: bevy_ecs, math: glam) | ||
This crate was largely a 1:1 port from [legion_transform](https://github.com/AThilenius/legion_transform) (ecs: legion, math: nalgebra) to bevy (ecs: bevy_ecs, math: glam) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this line is just fully obsolete at this point; we've changed the data structures around since then. |
||
|
||
It has since been split into two crates; this one, and `bevy_hierarchy`. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,38 @@ | ||
pub mod components; | ||
pub mod hierarchy; | ||
pub mod transform_propagate_system; | ||
|
||
pub mod prelude { | ||
#[doc(hidden)] | ||
pub use crate::{components::*, hierarchy::*, TransformPlugin}; | ||
pub use crate::{components::*, TransformPlugin}; | ||
} | ||
|
||
use bevy_app::prelude::*; | ||
use bevy_ecs::schedule::{ParallelSystemDescriptorCoercion, SystemLabel}; | ||
use prelude::{parent_update_system, Children, GlobalTransform, Parent, PreviousParent, Transform}; | ||
use bevy_hierarchy::ParentUpdate; | ||
use prelude::{GlobalTransform, Transform}; | ||
|
||
#[derive(Default)] | ||
pub struct TransformPlugin; | ||
|
||
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemLabel)] | ||
pub enum TransformSystem { | ||
TransformPropagate, | ||
ParentUpdate, | ||
} | ||
pub struct TransformPropagate; | ||
|
||
impl Plugin for TransformPlugin { | ||
fn build(&self, app: &mut App) { | ||
app.register_type::<Children>() | ||
.register_type::<Parent>() | ||
.register_type::<PreviousParent>() | ||
.register_type::<Transform>() | ||
app.register_type::<Transform>() | ||
.register_type::<GlobalTransform>() | ||
// 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), | ||
.label(TransformPropagate) | ||
.after(ParentUpdate), | ||
) | ||
.add_system_to_stage( | ||
CoreStage::PostUpdate, | ||
transform_propagate_system::transform_propagate_system | ||
.label(TransformSystem::TransformPropagate) | ||
.after(TransformSystem::ParentUpdate), | ||
.label(TransformPropagate) | ||
.after(ParentUpdate), | ||
); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be expanded somewhat to describe how it propagates transforms down the tree.