Commit cf19650
Remove systems from schedule (#20298)
# Objective
- Add ability to remove systems from a schedule.
- Fixes #279.
## Solution
- add `remove_systems_in_set` method which removes all the systems by
their set name. In most cases systems are added to a schedule once, so
just passing the system (which is an implicit set by it's type name)
will just remove the one system. If a system is added multiple times
such as `apply_deferred`, then you may need to give the system a unique
set, if you just want to remove just one system.
- The method also tries to remove all the configuration for the set and
the systems found.
- We need to pass world to the method because user build passes are
allowed to write to the world.
## Testing
- Added some unit tests.
## Future work
- In the future of systems as entities this will probably look much
different. We'd probably store all the edges as relationships, so
hopefully cleanup would be easier.
- It'd be better if remove_systems_in_set could take a tuple of system
sets. I looked into using IntoScheduleConfigs, but that won't work since
the system set version of it errors if you try to pass a system type
set. This would allow for less rebuilding of the schedule. The schedule
needs to be rebuilt to each call to be able to find the system set.
---------
Co-authored-by: Barrett Ray <66580279+onkoe@users.noreply.github.com>
Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>1 parent bec588f commit cf19650
File tree
6 files changed
+528
-16
lines changed- crates
- bevy_app/src
- bevy_ecs/src/schedule
- release-content/release-notes
6 files changed
+528
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
325 | 328 | | |
326 | 329 | | |
327 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
328 | 363 | | |
329 | 364 | | |
330 | 365 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
222 | 237 | | |
223 | 238 | | |
224 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
498 | 494 | | |
499 | 495 | | |
500 | 496 | | |
| |||
554 | 550 | | |
555 | 551 | | |
556 | 552 | | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
557 | 572 | | |
558 | 573 | | |
559 | 574 | | |
| |||
646 | 661 | | |
647 | 662 | | |
648 | 663 | | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
649 | 669 | | |
650 | 670 | | |
651 | 671 | | |
| |||
716 | 736 | | |
717 | 737 | | |
718 | 738 | | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
719 | 747 | | |
720 | 748 | | |
721 | 749 | | |
| |||
0 commit comments