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

Create a System Builder Syntax instead of using System Descriptors #2736

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0c6a837
Add SystemConfig and some basic options
thechubbypanda Aug 27, 2021
569513c
Cargo format
thechubbypanda Aug 27, 2021
983a2be
System Builder Rework - In Progress
thechubbypanda Aug 28, 2021
abd6d8b
Rename StartupConfig to conform with other traits
thechubbypanda Aug 28, 2021
52e7fff
Remove trait_casting feature
thechubbypanda Aug 28, 2021
011af54
SystemSet handle ExclusiveSystems
thechubbypanda Aug 29, 2021
ecb855b
Testing SubType impl for StageConfig
thechubbypanda Aug 29, 2021
20fd625
Sort imports and remove double refs in app.rs
thechubbypanda Aug 29, 2021
d9f7558
Attempt at fixing `SystemConfig`, `StartupConfig`.
Ratysz Aug 31, 2021
e83c519
Merge pull request #1 from Ratysz/system-builder-syntax
thechubbypanda Sep 1, 2021
b540f79
Separate configs and conform with StageConfig
thechubbypanda Sep 1, 2021
3bad094
Make more system additions use the new methods
thechubbypanda Sep 1, 2021
325689b
Found a solution to exclusive errors
thechubbypanda Sep 1, 2021
9aeb408
Revert solution
thechubbypanda Sep 1, 2021
d7e1e2a
Fix broken startup functionality
thechubbypanda Sep 1, 2021
4514032
Actually use the correct impl
thechubbypanda Sep 1, 2021
251fb40
.stage all the things
thechubbypanda Sep 1, 2021
0995f85
Fix bevy_render error
thechubbypanda Sep 1, 2021
2d062e6
Fix final stage.rs error
thechubbypanda Sep 1, 2021
9a2284e
Fix all remaining crate errors
thechubbypanda Sep 1, 2021
5487f83
Fix examples
thechubbypanda Sep 1, 2021
1d34d96
Format
thechubbypanda Sep 1, 2021
9822b19
Merge branch 'main' into system-builder-syntax
thechubbypanda Sep 1, 2021
e80fded
Format again
thechubbypanda Sep 1, 2021
7b4bb30
Fix some ci errors
thechubbypanda Sep 1, 2021
aee8c9d
Fix InsertionPoint panic
thechubbypanda Sep 2, 2021
eb207e5
Fix startup error
thechubbypanda Sep 2, 2021
0c9ac6a
Fixed copy pasta failure (insertion point test)
thechubbypanda Sep 2, 2021
6c28d69
Remove redundant fn impl
thechubbypanda Sep 2, 2021
085a5ef
Update System docs
thechubbypanda Sep 4, 2021
55b797c
Reduce internal config function visibility and doc
thechubbypanda Sep 4, 2021
c8914c1
More docs
thechubbypanda Sep 4, 2021
0a32358
Update crates/bevy_ecs/src/schedule/stage.rs
thechubbypanda Sep 5, 2021
0f6494b
Update crates/bevy_ecs/src/system/config/system_config.rs
thechubbypanda Sep 5, 2021
91cb4c2
Update crates/bevy_ecs/src/system/system.rs
thechubbypanda Sep 5, 2021
b272cb4
Add specific config trait docs
thechubbypanda Sep 7, 2021
cf372a7
Add link to SystemStage doc
thechubbypanda Sep 7, 2021
25b1d31
Add system set conflict validation
thechubbypanda Sep 13, 2021
d360e14
Use .any rather than for loops
thechubbypanda Oct 2, 2021
a762965
Maybe cleaner add system set conflict checking
thechubbypanda Oct 2, 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
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/schedule/stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl_downcast!(Stage);
pub struct ReportExecutionOrderAmbiguities;

/// Stores and executes systems. Execution order is not defined unless explicitly specified;
/// see `SystemDescriptor` documentation.
/// see `SystemConfig` documentation.
thechubbypanda marked this conversation as resolved.
Show resolved Hide resolved
pub struct SystemStage {
/// The WorldId this stage was last run on.
world_id: Option<WorldId>,
Expand Down
17 changes: 9 additions & 8 deletions crates/bevy_ecs/src/system/config/system_config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{schedule::*, system::InsertionPoint};

/// Each system has one of these. It is updated using the various traits seen in this [directory](super).
thechubbypanda marked this conversation as resolved.
Show resolved Hide resolved
#[derive(Default)]
pub struct SystemConfig {
pub labels: Vec<BoxedSystemLabel>,
Expand All @@ -13,28 +14,28 @@ pub struct SystemConfig {
}

impl SystemConfig {
pub fn add_label(&mut self, label: impl SystemLabel) {
pub(crate) fn add_label(&mut self, label: impl SystemLabel) {
self.labels.push(Box::new(label));
}
pub fn add_before(&mut self, label: impl SystemLabel) {
pub(crate) fn add_before(&mut self, label: impl SystemLabel) {
self.before.push(Box::new(label));
}
pub fn add_after(&mut self, label: impl SystemLabel) {
pub(crate) fn add_after(&mut self, label: impl SystemLabel) {
self.after.push(Box::new(label));
}
pub fn set_stage(&mut self, label: impl StageLabel) {
pub(crate) fn set_stage(&mut self, label: impl StageLabel) {
self.stage = Some(Box::new(label));
}
pub fn add_ambiguity_set(&mut self, set: impl AmbiguitySetLabel) {
pub(crate) fn add_ambiguity_set(&mut self, set: impl AmbiguitySetLabel) {
self.ambiguity_sets.push(Box::new(set));
}
pub fn set_run_criteria(&mut self, criteria: RunCriteriaDescriptorOrLabel) {
pub(crate) fn set_run_criteria(&mut self, criteria: RunCriteriaDescriptorOrLabel) {
self.run_criteria = Some(criteria);
}
pub fn startup(&mut self) {
pub(crate) fn startup(&mut self) {
self.startup = true;
}
pub fn set_insertion_point(&mut self, insertion_point: InsertionPoint) {
pub(crate) fn set_insertion_point(&mut self, insertion_point: InsertionPoint) {
self.insertion_point = insertion_point;
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/system/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl SystemId {
///
/// Systems are executed in parallel, in opportunistic order; data access is managed automatically.
/// It's possible to specify explicit execution order between specific systems,
/// see [SystemDescriptor](crate::schedule::SystemDescriptor).
/// see [SystemConfig](super::SystemConfig) and the other files in the [./config](super::config) directory.
thechubbypanda marked this conversation as resolved.
Show resolved Hide resolved
pub trait System: Send + Sync + 'static {
/// The system's input. See [`In`](crate::system::In) for
/// [`FunctionSystem`](crate::system::FunctionSystem)s.
Expand Down