From 1550aea7b94b6676438209cda5c49d6f1d35724e Mon Sep 17 00:00:00 2001 From: Lixou <82600264+DasLixou@users.noreply.github.com> Date: Fri, 25 Nov 2022 20:32:35 +0100 Subject: [PATCH 1/2] PluginGroups like Bundles --- rfcs/67-plugingroups-like-bundles | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 rfcs/67-plugingroups-like-bundles diff --git a/rfcs/67-plugingroups-like-bundles b/rfcs/67-plugingroups-like-bundles new file mode 100644 index 00000000..ceb80f7e --- /dev/null +++ b/rfcs/67-plugingroups-like-bundles @@ -0,0 +1,56 @@ +# Feature Name: Plugingroups like Bundles + +## Summary + +Make PluginGroups like Bundles, so they are just structs. Then the ordering will be made by a gen_graph function, maybe with the new planned `bevy_graph` (https://github.com/bevyengine/bevy/discussions/6719) ? +This will make PluginGroups from the design consistent to the other bevy types. + +## Motivation + +First, a new possibilty: adding plugingroups inside of pluginsgroup (cool). (a guy on discord asked this https://discord.com/channels/691052431525675048/1044672077451513906) and what he wanted (adding plugingroups inside of plugingroups) just wans't possible :c. +Every time when I see PluginGroups it makes my brain think about **Design consitency**, because most of the other bevy types are just structs with default rust constructors. +It also bothers me when i set plugins that for example then implement `WindowPlugin::default()` only to let me use `.set(WindowPlugin { .. })` later. + +## Example Design Impl + +```rust +#[derive(Default)] +pub struct MyPlugins { + main_plugin: MainPlugin, + #[plugingroup] + other_plugin_group: OtherPlugins, + #[cfg(feature = "optional")] + optional: OptionalPlugin, +} + +impl PluginGroup for MyPlugins { + fn gen_graph(mut self) -> PluginGraph { + let mut graph_builder = PluginGraph::new(); + builder.append::(); + builder.before::(); + #[cfg(feature = "optional")] + { + builder.append::(); + } + graph_builder.build(self) + } +} + +app.add_plugins(MyPlugins { + main_plugin: MainPlugin { .. }, + ..Default::default() +}).plugin_graph().after::(); // make plugin graph editable in app, make it also change order later +``` + +## Final Note + +I'm not sure about the naming, about the RFC in general. But thats a RFC about (i think). But with your help i think this can be a well done feature :). + +And a thing i just saw: this will remove a functionality (which i never saw used and i am even not sure if it is even possible): +```rust +app.add_plugins(MyPlugins::custom_setting(CustomSetting::Minimum)); // this would for example just add Plugin x and y, with CustomSetting::Everything, it would also add Plugin z. +// something like optional plugins via constructor isn't possible with the new design, i think. +``` + +So yeah, I'm looking forward to make this feature good and cool so everybody likes it (hopefully) and it can be adopted to also make it easier for the above mentioned `bevy_graph` and bevy in general. +Maybe this could be also an addition to the new stageless design? idk, we'll see :) From 451b4fdc5d150a7ff9b5fc11e999219170041ca3 Mon Sep 17 00:00:00 2001 From: Lixou <82600264+DasLixou@users.noreply.github.com> Date: Fri, 25 Nov 2022 20:33:33 +0100 Subject: [PATCH 2/2] it should be an .md --- ...-plugingroups-like-bundles => 67-plugingroups-like-bundles.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename rfcs/{67-plugingroups-like-bundles => 67-plugingroups-like-bundles.md} (100%) diff --git a/rfcs/67-plugingroups-like-bundles b/rfcs/67-plugingroups-like-bundles.md similarity index 100% rename from rfcs/67-plugingroups-like-bundles rename to rfcs/67-plugingroups-like-bundles.md