Skip to content
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

Add Label type #1423

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2bd15fa
Add Label type
TheRawMeatball Feb 9, 2021
f41d7eb
General improvement
TheRawMeatball Feb 9, 2021
85eebf2
Fix stuff
TheRawMeatball Feb 9, 2021
857fa83
hotfix
TheRawMeatball Feb 9, 2021
d0cc270
rework to implement suggestions
TheRawMeatball Feb 15, 2021
52567f5
cargo fmt
TheRawMeatball Feb 15, 2021
37941ba
cargo test
TheRawMeatball Feb 15, 2021
fd3747c
Improve Debug impl on dyn Label
TheRawMeatball Feb 16, 2021
4b90fb0
Apply suggestions from code review
TheRawMeatball Feb 16, 2021
b8af092
hotfix
TheRawMeatball Feb 16, 2021
c28f3fd
Implement minor suggestion
TheRawMeatball Feb 16, 2021
099f8a6
Revert changes in tests
TheRawMeatball Feb 16, 2021
e70a8c1
Fix doctest
TheRawMeatball Feb 16, 2021
c002ba2
Fix inconsistencies
TheRawMeatball Feb 16, 2021
2e95129
Merge remote-tracking branch 'upstream/master' into zst-labels
TheRawMeatball Feb 16, 2021
c5724f6
Revert accidental changes
TheRawMeatball Feb 16, 2021
9c70a5d
Switch to requirig Debug impl
TheRawMeatball Feb 16, 2021
6d82c4e
cargo fmt
TheRawMeatball Feb 16, 2021
b7f1e85
Fix test
TheRawMeatball Feb 16, 2021
6e8f6fd
Merge 'upstream/master' into zst-labels
TheRawMeatball Feb 17, 2021
62f1eef
Fancify labels
TheRawMeatball Feb 17, 2021
da24443
mod/use consistency
cart Feb 17, 2021
7c20ed2
Implement requested changes
TheRawMeatball Feb 18, 2021
a904796
cargo fmt
TheRawMeatball Feb 18, 2021
ea539b0
Improvements from @Ratyzs
Ratysz Feb 18, 2021
3f0d074
Resolve conflicts
Ratysz Feb 18, 2021
c6db7b5
Explicit execution order ambiguities API (#1469) (#5)
Ratysz Feb 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions crates/bevy_transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ pub mod prelude {
}

use bevy_app::prelude::*;
use bevy_ecs::IntoSystem;
use bevy_ecs::ParallelSystemDescriptorCoercion;
use bevy_ecs::{IntoSystem, ParallelSystemDescriptorCoercion};
use bevy_reflect::RegisterTypeBuilder;
use prelude::{parent_update_system, Children, GlobalTransform, Parent, PreviousParent, Transform};

Expand All @@ -23,15 +22,27 @@ impl Plugin for TransformPlugin {
.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.system())
.add_startup_system_to_stage(
StartupStage::PostStartup,
transform_propagate_system::transform_propagate_system.system(),
parent_update_system.system().label("parent_update_system"),
)
.add_startup_system_to_stage(
StartupStage::PostStartup,
transform_propagate_system::transform_propagate_system
.system()
.label("transform_propagate_system")
.after("parent_update_system"),
)
.add_system_to_stage(
CoreStage::PostUpdate,
parent_update_system.system().label("parent_update_system"),
TheRawMeatball marked this conversation as resolved.
Show resolved Hide resolved
)
.add_system_to_stage(CoreStage::PostUpdate, parent_update_system.system())
.add_system_to_stage(
CoreStage::PostUpdate,
transform_propagate_system::transform_propagate_system.system(),
transform_propagate_system::transform_propagate_system
.system()
.label("transform_propagate_system")
.after("parent_update_system"),
TheRawMeatball marked this conversation as resolved.
Show resolved Hide resolved
);
}
}
27 changes: 19 additions & 8 deletions examples/ecs/ecs_guide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,9 @@ fn main() {
// However we can manually specify the stage if we want to. The following is equivalent to add_system(score_system)
.add_system_to_stage(CoreStage::Update, score_system.system())
// We can also create new stages. Here is what our games stage order will look like:
// `BeforeRound`: new_player_system, new_round_system
// `Update`: print_message_system, score_system
// `AfterRound`: score_check_system, game_over_system
// "before_round": new_player_system, new_round_system
// "update": print_message_system, score_system
// "after_round": score_check_system, game_over_system
.add_stage_before(
CoreStage::Update,
MyStages::BeforeRound,
Expand All @@ -309,11 +309,22 @@ fn main() {
)
.add_system_to_stage(MyStages::BeforeRound, new_round_system.system())
.add_system_to_stage(MyStages::BeforeRound, new_player_system.system())
.add_system_to_stage(MyStages::AfterRound, score_check_system.system())
.add_system_to_stage(MyStages::AfterRound, game_over_system.system())
// score_check_system will run before game_over_system because score_check_system modifies GameState and game_over_system
// reads GameState. This works, but it's a bit confusing. In practice, it would be clearer to create a new stage that runs
// before "after_round"
// We can ensure that game_over system runs after score_check_system using explicit ordering constraints
// First, we label the system we want to refer to using `.label`
// Then, we use either `.before` or `.after` to describe the order we want the relationship
.add_system_to_stage(
MyStages::AfterRound,
score_check_system.system().label("score_check"),
)
.add_system_to_stage(
MyStages::AfterRound,
game_over_system.system().after("score_check"),
)
TheRawMeatball marked this conversation as resolved.
Show resolved Hide resolved
// We can check our systems for execution order ambiguities by examining the output produced in the console
// by adding the following Resource to our App :)
// Be aware that not everything reported by this checker is a potential problem, you'll have to make
// that judgement yourself.
.insert_resource(ReportExecutionOrderAmbiguities)
// This call to run() starts the app we just built!
.run();
}
You are viewing a condensed version of this merge commit. You can view the full changes here.