Next Generation Scenes: Core scene system, bsn! macro, Templates#23413
Next Generation Scenes: Core scene system, bsn! macro, Templates#23413cart wants to merge 12 commits intobevyengine:mainfrom
bsn! macro, Templates#23413Conversation
a660bc5 to
a664977
Compare
|
|
||
| /// [`GetTemplate`] is implemented for types that can be produced by a specific, canonical [`Template`]. This creates a way to correlate to the [`Template`] using the | ||
| /// desired template output type. This is used by Bevy's scene system. | ||
| pub trait GetTemplate: Sized { |
There was a problem hiding this comment.
It feels a bit unnatural because the trait has an associated type representing a template. Yes, it can be used for getting a template, but there are no getters.
If it was discussed in some RFC and all the parties agreed on it, feel free to discard my comment.
There was a problem hiding this comment.
I think HasTemplate is also a reasonable name. However it doesn't have a has() function either. And the purpose of the trait is not to know whether or not it has a Template, but rather to get the template associated with the type. Of the two names, I think GetTemplate is better. I'm definitely open to other names though!
There was a problem hiding this comment.
It can be Templatable then and has no verbs, but telling that the implementing type can be templated using the specified associated type.
There was a problem hiding this comment.
I prefer Templatable as well, but I would also be fine with FromTemplate, to mirror FromWorld.
There was a problem hiding this comment.
My issue with Templatable it is that every type T is theoretically "template-able" / could have zero to many types that implement Template where Template<Output = T>. GetTemplate is about a type T having a canonical template.
Templated feels slightly better semantically, as it doesn't express whether something is "template-able", but rather it says "T has a template" (which is perhaps close enough to the "has a canonical template" idea). The "problem" I see here is the similarity between Template and Templated (just a d character differentiating them).
FromTemplate is pretty reasonable. Slight "weirdness factor", given that it isn't implementing From logic in the trait, but rather deferring to the Template for that logic.
There was a problem hiding this comment.
Another option is WithTemplate. It's similar to HasTemplate, but avoids implying a has() method that doesn't exist.
a664977 to
cfd3a96
Compare
| use tracing::error; | ||
|
|
||
| /// Adds scene spawning functionality to [`World`]. | ||
| pub trait WorldScenes { |
There was a problem hiding this comment.
Can we call this WorldScenesExt? I personally prefer making extension traits very clear to indicate that you're not meant to implement this or reference it.
Same thing for all the following extension traits!
There was a problem hiding this comment.
Hmm I've always kind of disliked the Ext naming, as this is still a trait that behaves just like any other. In a way all traits are Ext. Ext always felt like a failure to describe the scope of the trait.
That being said, I don't have strong opinions here and Ext is used in a number of places elsewhere in Bevy.
There was a problem hiding this comment.
you're not meant to implement this or reference it
I don't think either of these are strict requirements. I think a manual import of WorldScenes is totally valid, as is someone choosing to implement it and use it to share logic between things that perform the same operations.
Co-authored-by: andriyDev <andriydzikh@gmail.com>
|
It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note. Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes. |
| /// ] | ||
| /// }); | ||
| /// ``` | ||
| fn queue_spawn_scene<S: Scene>(&mut self, scene: S) -> EntityWorldMut<'_>; |
There was a problem hiding this comment.
Couple of things:
- I think this should be
spawn_scene_queuedfor LSP discoverability - I think there's a strong argument for the
queuedbehaviour being the default, and renaming the version that assumes dependencies are already loadedspawn_scene_<suffix that communicates that we're not loading new dependencies>
There was a problem hiding this comment.
- Yeah I think thats reasonable
- I think in the context of "bsn! everywhere", the vast majority of spawns could be done "immediately". That was the rationale here. Perhaps the right "best of both worlds" path here is to change the behavior of
spawn_scene_queuedto eagerly resolve and spawn when possible, then give it the preferredspawn_scenename / use it everywhere.
There was a problem hiding this comment.
Yeah it makes sense as a rationale, I'm just imagining the world where a newcomer doesn't understand why their scene's dependencies aren't spawning when they use the shortest (and therefore "most canonical") scene spawning API after spending most of their time, enthusiasm, and attention in design tooling.
| /// desired template output type. This is used by Bevy's scene system. | ||
| pub trait GetTemplate: Sized { | ||
| /// The [`Template`] for this type. | ||
| type Template: Template; |
There was a problem hiding this comment.
How does the GetTemplate / Template traits fit with FromWorld?
My initial read of them as "ways to initialiaze objects that require World data" puts them in exactly the same niche.
Do you feel that we'll want both in the long-term? Can we better explain subtle distinctions using docs?
There was a problem hiding this comment.
Similar niches, but still quite different / they can and should exist next to each other:
FromWorld: createsTfrom a world referenceGetTemplate: createsTfrom an entity spawn context, which notably includes anEntityWorldMutreference and "scoped entity reference" information from the current scene spawn.
FromWorld fills niches that GetTemplate does not (initializing any type that is not an entity). FromWorld is also still the better pick for Resources. We could in theory try to replace FromWorld in that context, but it would require reworking some of the resource init code to make it efficient. And it would be a breaking change, which I think merits consideration + planning.
| } | ||
| } | ||
|
|
||
| /// [`GetTemplate`] is implemented for types that can be produced by a specific, canonical [`Template`]. This creates a way to correlate to the [`Template`] using the |
There was a problem hiding this comment.
The explanation of this in the PR description is much better; we should duplicate the subtle information about usage / intent here.
Also this needs to link out to docs about the derive macro, which should mention that it generates types for you.
| use downcast_rs::{impl_downcast, Downcast}; | ||
| use variadics_please::all_tuples; | ||
|
|
||
| /// A [`Template`] is something that, given a spawn context (target [`Entity`], [`World`](crate::world::World), etc), can produce a [`Template::Output`]. |
There was a problem hiding this comment.
Again, lots of useful context from the PR description that should be captured in the docs here.
| /// [`Component`]: bevy_ecs::component::Component | ||
| pub trait Scene: Send + Sync + 'static { | ||
| /// This will apply the changes described in this [`Scene`] to the given [`ResolvedScene`]. This should not be called until all of the dependencies | ||
| /// in [`Scene::register_dependencies`] have been loaded. |
There was a problem hiding this comment.
"Scenes are free to modify these lists, but in most cases they should probably just be pushing to the back of them." from the PR description.
| ) -> Result<(), ResolveSceneError>; | ||
|
|
||
| /// [`Scene`] can have [`Asset`] dependencies, which _must_ be loaded before calling [`Scene::resolve`] or it might return a [`ResolveSceneError`]! | ||
| /// |
There was a problem hiding this comment.
"The scene system will ensure Scene::resolve is not called until all of the dependencies have loaded"
| use variadics_please::all_tuples; | ||
|
|
||
| /// Conceptually, a [`Scene`] describes what a spawned [`Entity`] should look like. This often describes what [`Component`]s the entity should have. | ||
| /// |
There was a problem hiding this comment.
"Scene is always one top level / root entity. For "lists of scenes" (such as a list of related entities), we have the SceneList trait, which can be used in any place where zero to many scenes are expected. These are separate traits for logical reasons: world.spawn() is a "single entity" action, scene inheritance only makes sense when both scenes are single roots, etc."
|
|
||
| all_tuples!(scene_impl, 0, 12, P); | ||
|
|
||
| /// A [`Scene`] that patches a [`Template`] of type `T` with a given function `F`. |
There was a problem hiding this comment.
"Functionally, a TemplatePatch scene will initialize a Default value of the patched Template if it does not already exist in the ResolvedScene, then apply the patch on top of the current Template in the ResolvedScene. Types that implement Template can generate a TemplatePatch like this:"
| all_tuples!(scene_impl, 0, 12, P); | ||
|
|
||
| /// A [`Scene`] that patches a [`Template`] of type `T` with a given function `F`. | ||
| pub struct TemplatePatch<F: Fn(&mut T, &mut ResolveContext), T>(pub F, pub PhantomData<T>); |
There was a problem hiding this comment.
These docs need more motivation, explaining when / why you might want to use this type. A single tangible example would go a long way.
| )) | ||
| .map_err(|e| ApplySceneError::RelatedSceneError { | ||
| relationship_type_name: related.relationship_name, | ||
| index, |
There was a problem hiding this comment.
Is this the right index? index above is defined by the outer loop, but used by the inner loop.
More descriptive names would help clarify what this code is doing.
| pub fn apply(&self, context: &mut TemplateContext) -> Result<(), ApplySceneError> { | ||
| if let Some(inherited) = &self.inherited { | ||
| let scene_patches = context.resource::<Assets<ScenePatch>>(); | ||
| if let Some(patch) = scene_patches.get(inherited) |
There was a problem hiding this comment.
This silently fails. scene_patches::get should probably be returning an error that we can bubble up.
| } | ||
| } | ||
| PathType::Const => { | ||
| todo!("A floating type-unknown const should be assumed to be a const scene right?") |
There was a problem hiding this comment.
We should clean this up before merging probably.
| BsnValue::Name(input.parse::<Ident>()?) | ||
| } else { | ||
| return Err(input.error( | ||
| "BsnValue parse for this input is not supported yet, nor is proper error handling :)" |
There was a problem hiding this comment.
This should probably get a TODO comment at least so we can find it.
|
|
||
| /// This is used to register information about the template, such as dependencies that should be loaded before it is instantiated. | ||
| #[inline] | ||
| fn register_data(&self, _data: &mut TemplateData) {} |
There was a problem hiding this comment.
This code and the TemplateData type are never called. We should at least add a test in this PR.
|
|
||
| /// This is used by the [`GetTemplate`] derive to work around [this Rust limitation](https://github.com/rust-lang/rust/issues/86935). | ||
| /// A fix is implemented and on track for stabilization. If it is ever implemented, we can remove this. | ||
| pub type Wrapper<T> = T; |
There was a problem hiding this comment.
This name is painfully generic.
| } | ||
|
|
||
| /// A [`Template`] reference to an [`Entity`]. | ||
| pub enum EntityReference { |
There was a problem hiding this comment.
What other variants do we want to support in the future here?
|
|
||
| fn build_template(&self, context: &mut TemplateContext) -> Result<Self::Output> { | ||
| Ok(match self { | ||
| // unwrap is ok as this is "internals". when implemented correctly this will never panic |
There was a problem hiding this comment.
Doesn't seem totally clear what unwrap this is referring to.
| related: TypeIdMap<RelatedResolvedScenes>, | ||
| /// The inherited [`ScenePatch`] to apply _first_ before applying this [`ResolvedScene`]. | ||
| inherited: Option<Handle<ScenePatch>>, | ||
| /// A [`TypeId`] to `templates` index mapping. If a [`Template`] is intended to be shared / patched across scenes, it should have |
There was a problem hiding this comment.
Sentence seems incomplete. It should have what?
| use proc_macro::TokenStream; | ||
|
|
||
| #[proc_macro] | ||
| pub fn bsn(input: TokenStream) -> TokenStream { | ||
| crate::bsn::bsn(input) | ||
| } | ||
|
|
||
| #[proc_macro] | ||
| pub fn bsn_list(input: TokenStream) -> TokenStream { | ||
| crate::bsn::bsn_list(input) | ||
| } |
There was a problem hiding this comment.
i thought bsn was going to be a declarative macro, this is disappointing. proc macros are pretty brittle, they often break with proc macro not expanded: proc macro crate is missing dylib errors. even println!'s autocomplete and formatting breaks pretty often for me, and thats a native rust feature. do we expect to do better in userland?
There was a problem hiding this comment.
To my knowledge, declarative macros are not flexible enough to support something like bsn!. I'd be stoked if someone found a way, but the parsing and codegen logic go well beyond what I believe is capable in macro_rules!.
bsn! was built with autocomplete / ide integration in mind. It isn't 100% bulletproof atm, but apart from a few corner cases I'm still working on, I think it is pretty close to ideal. I recommend you give it a try so we can discuss the reality of the situation.
There was a problem hiding this comment.
On the topic of formatting, rustfmt would not be able to format bsn! (and would refuse to try in the context of the {} in bsn! {}). The plan here is to write our own BSN formatting tool, which can be used for both rust code and .bsn assets.
There was a problem hiding this comment.
maintaining a formatter sounds like a pretty big maintenance commitment, would that be part of the bevy cli?
There was a problem hiding this comment.
If we're defining a new syntax, I personally think we're obligated to provide a degree of "tooling" for it (grammar files for syntax highlighting, formatting tooling, etc).
Yes it would be part of the Bevy CLI. It is a maintenance commitment, but I believe it would be relatively scoped (largely build it and forget it).
There was a problem hiding this comment.
Note that we already get part way there for formatting just by writing an in-memory-BSN -> .bsn serializer (which we will need to do anyway).
Co-authored-by: Nico Zweifel <34443492+NicoZweifel@users.noreply.github.com> Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
After much iteration, designing and collaborating, it is finally time to land a baseline featureset of Bevy's Next Generation Scene system, often known by its new scene format name ... BSN (Bevy Scene Notation).
This PR adds the following:
Scenes andSceneLists. Inherit from other scenes. Patch component fields. Depend on assets before loading as scene. Resolve Entity references throughout your scene.bsn!andbsn_list!macros: Define Bevy scenes in your code using a new ergonomic Rust-ey syntax, which plays nicely with Rust Analyzer and supports autocomplete, go-to definition, semantic highlighting, and doc hover.Template/GetTemplate: construct types (ex: Components) from a "template context", which includes access to the current entity and access to theWorld. This is a foundational piece of the scene system.Note that this does not include a loader for the BSN asset format, which will be added in a future PR. See the "Whats Next?" section for a roadmap of the future.
Part of #23030
Review Etiquette
This is a big PR. Please use threaded comments everywhere, not top level comments. Even if what you have to say is not anchored in code, find a line to leave your comment on.
Overview
This is a reasonably comprehensive conceptual overview / feature list. This uses a "bottom up" approach to illustrate concepts, as they build on each other. If you just want to see what BSN looks like, scroll down a bit!
Templates
Templateis a simple trait implemented for "template types", which when passed an entity/world context, can produce an output type such as aComponentorBundle:Template is the cornerstone of the new scene system. It allows us to define types (and hierarchies) that require no
Worldcontext to define, but can use theWorldto produce the final runtime state. Templates are notably:Template::clone_template, enabling scenes to be duplicated, supporting copy-on-write behaviors, etc.The poster-child for templates is the asset
Handle<T>. We now have aHandleTemplate<T>, which wraps anAssetPath. This can be used to load the requested asset and produce a strongHandlefor it.Types that have a "canonical"
Templatecan implement theGetTemplatetrait, allowing us to correlate to something'sTemplatein the type system.This is where things start to get interesting.
GetTemplatecan be derived for types whose fields also implementGetTemplate:Internally this produces the following:
Another common use case for templates is
Entity. With templates we can resolve an identifier of an entity in a scene to the finalEntityit points to (for example: an entity path or an "entity reference" ... this will be described in detail later).Both
TemplateandGetTemplateare blanket-implemented for any type that implements both Clone and Default. This means that most types are automatically usable as templates. Neat!It is best to think of
GetTemplateas an alternative toDefaultfor types that require world/spawn context to instantiate. Note that because of the blanket impl, you cannot implementGetTemplate,Default, andClonetogether on the same type, as it would result in two conflicting GetTemplate impls. This is also whyTemplatehas its ownTemplate::clone_templatemethod (to avoid using the Clone impl, which would pull in the auto-impl).Scenes
Templates on their own already check many of the boxes we need for a scene system, but they aren't enough on their own. We want to define scenes as patches of Templates. This allows scenes to inherit from / write on top of other scenes without overwriting fields set in the inherited scene. We want to be able to "resolve" scenes to a final group of templates.
This is where the
Scenetrait comes in:The
ResolvedSceneis a collection of "final"Templateinstances which can be applied to an entity.Scene::resolveapplies theSceneas a "patch" on top of the finalResolvedScene. It stores a flat list of templates to be applied to the top-level entity and typed lists of related entities (ex: Children, Observers, etc), which each have their own ResolvedScene.Scenes are free to modify these lists, but in most cases they should probably just be pushing to the back of them.ResolvedScenecan handle both repeated and unique instances of a template of a given type, depending on the context.Scene::register_dependenciesallows the Scene to register whatever asset dependencies it needs to performScene::resolve. The scene system will ensureScene::resolveis not called until all of the dependencies have loaded.Sceneis always one top level / root entity. For "lists of scenes" (such as a list of related entities), we have theSceneListtrait, which can be used in any place where zero to many scenes are expected. These are separate traits for logical reasons: world.spawn() is a "single entity" action, scene inheritance only makes sense when both scenes are single roots, etc.Template Patches
The
TemplatePatchtype implementsScene, and stores a function that mutates a template. Functionally, aTemplatePatchscene will initialize aDefaultvalue of the patchedTemplateif it does not already exist in theResolvedScene, then apply the patch on top of the current Template in theResolvedScene. Types that implementTemplatecan generate aTemplatePatchlike this:Likewise, types that implement
GetTemplatecan generate a patch for their template type like this:We can now start composing scenes by writing functions that return
impl Scene!The
on()Observer / event handler Sceneonis a function that returns a scene that creates an Observer template:The BSN Format
BSNis a new specification for defining Bevy Scenes. It is designed to be as Rust-ey as possible, while also eliminating unnecessary syntax and context. The goal is to make defining arbitrary scenes and UIs as easy, delightful, and legible as possible.It is intended to be usable as both an asset format (ex:
level.bsnfiles) and defined in code via absn!macro. These are notably compatible with each other. You can define a BSN asset file (ex: in a visual scene editor, such as the upcoming Bevy Editor), then inherit from that and use it inbsn!defined in code.Note that this PR includes the
bsn!macro, but it does not include the BSN asset format. It does include all of the in-memory / in-code support for the asset format. All that remains is defining a BSN asset loader, which will be done in a followup.The
bsn!Macrobsn!is an optional ergonomic syntax for definingSceneexpressions. It was built in such a way that Rust Analyzer autocomplete, go-to definition, doc hover, and semantic token syntax highlighting works as expected pretty much everywhere (but there are some gaps and idiosyncrasies at the moment, which I believe we can iron out).It looks like this:
I'll do a brief overview of each implemented
bsn!feature now.bsn!: Patch SyntaxWhen you see a normal "type expression", that resolves to a
TemplatePatchas defined above.This resolve to the following:
This means you only need to define the fields you actually want to set!
Notice the implicit
.into(). Wherever possible,bsn!provides implicitinto()behavior, which allows developers to skip defining wrapper types, such as theHandleTemplate<Image>expected in the example above.This also works for nested struct-style types:
Note that you can just define the type name if you don't care about setting specific field values / just want to add the component:
To add multiple patches to the entity, just separate them with spaces or newlines:
Enum patching is also supported:
Notably, when you derive GetTemplate for an enum, you get default template values for every variant:
This means that unlike the
Defaulttrait, enums that deriveGetTemplateare "fully patchable". If a patched variant matches the current template variant, it will just write fields on top. If it corresponds to a different variant, it initializes that variant with default values and applies the patch on top.For practical reasons, enums only use this "fully patchable" approach when in "top-level scene entry patch position". Nested enums (aka fields on patches) require specifying every value. This is because the majority of types in the Rust and Bevy ecosystem will not derive
GetTemplateand therefore will break if we try to create default variants values for them. I think this is the right constraint solve in terms of default behaviors, but we can discuss how to support both nested scenarios effectively.Constructors also work (note that constructor args are not patched. you must specify every argument). A constructor patch will fully overwrite the current value of the Template.
You can also use type-associated constants, which will also overwrite the current value of the template:
If you have a type that does not currently implement Template/GetTemplate, you have two options:
bsn!Template patch syntaxTypes that are expressed using the syntax we learned above are expected to implement
GetTemplate. If you want to patch aTemplatedirectly by type name (ex: your Template is not paired with a GetTemplate type), you can do so using@syntax:In most cases, BSN encourages you to work with the final type names (ex: you type
Sprite, notSpriteTemplate).However in cases where you really want to work with the template type directly (such as custom / manually defined templates), "Template patch syntax" lets you do that!
bsn!: Inline function syntaxYou can call functions that return
Sceneimpls inline. Theon()function that adds an Observer (described above) is a particularly common use casebsn!: Relationship Syntaxbsn!provides native support for spawning related entities, in the formatRelationshipTarget [ SCENE_0, ..., SCENE_X ]:Note that related entity scenes are comma separated. Currently they can either be flat or use
()to group them:It is generally considered best practice to wrap related entities with more than one entry in
()to improve legibility.bsn!: Expression Syntaxbsn!supports expressions in a number of locations using{}:Expressions in field position have implicit
into().Expressions are also supported in "scene entry" position, enabling nesting
bsn!insidebsn!:bsn!: Inline variablesYou can specify variables inline:
This also works in "scene entry" position:
Inheritance
bsn!uses:to designate "inheritance". Unlike defining scenes inline (as mentioned above), this will pre-resolve the inherited scene, making your current scene cheaper to spawn. This is great when you inherit from large scene (ex: an asset defined by a visual editor). Scenes can only inherit from one scene at a time, and it must be defined first.You can inherit from scene assets like this:
Note that while there is currently no implemented
.bsnasset format, you can still test this usingAssetServer::load_with_path.You can also inherit from functions that return a
Scene:Note that because inheritance is cached / pre-resolved, function inheritance does not support function parameters. You can still use parameterized scene functions by defining them directly in the scene (rather than using inheritance):
Related entities can also inherit:
Inheritance concatenates related entities:
bsn_list!/ SceneListRelationship expression syntax
{}expects a SceneList. Many things, such asVec<S: Scene>implementSceneListallowing for some cool patterns:The
bsn_list!macro allows defining a list of BSN entries (using the same syntax as relationships). This returns a type that implementsSceneList, making it useable in relationship expressions!This, when combined with inheritance, means you can build abstractions like this:
bsn!: Name SyntaxYou can quickly define
Namecomponents using#Nameshorthand.#MyNameproduces theName("MyName")component output.Within a given
bsn!orbsn_list!scope,#Namecan also be used in value position as anEntityTemplate:These behave a bit like variable names. In the context of inheritance and embedded scenes,
#Nameis only valid within the current "scene scope":In the example above, because
#MyButtonis defined "last" / is the most "specific"Name, the spawned entity will haveName("MyButton")Name references are allowed to conflict across inheritance scopes and they will not interfere with each other.
#Namecan also be used in the context ofbsn_list!, which enables defining graph structures:Name Restructure
The core name component has also been restructured to play nicer with
bsn!. The impl onmainrequiresName::new("MyName"). By making the name string field public and internalizing the prehash logic on that field, and utilizing implicit.into(), we can now define names like this:BSN Spawning
You can spawn scenes using
World::spawn_sceneandCommands::spawn_scene:The
spawn_sceneoperation happens immediately, and therefore assumes that all of theScene's dependencies have been loaded (or alternatively, that there are no dependencies). If the scene has a dependency that hasn't been loaded yet,World::spawn_scenewill return an error (or log an error in the context ofCommands::spawn_scene).If your scene has dependencies, you can use
World::queue_spawn_sceneandCommands::queue_spawn_scene. This will spawn the entity as soon as all of theScene's dependencies have been loaded.There are also
spawn_scene_listvariants for everything above:EntityWorldMutandEntityCommandsalso have some new functionality:For scene assets, you can also just add the
ScenePatchInstance(handle)component, just like the old Bevy scene system.VariantDefaults derive
GetTemplateautomatically generates default values for enum Template variants. But for types that don't useGetTemplate, I've also implemented aVariantDefaultsderive that also generates these methods.What's Next?
Must happen before 0.19
bevy_scenevsbevy_scene2: The current plan is to renamebevy_scenetobevy_ecs_serialization, and remove "scene" terminology from it. That then frees upbevy_scene2to be renamed tobevy_scene. The currentbevy_scenewill need to exist for awhile in parallel to BSN, as BSN is not yet ready for "full world serialization" scenarios.Resolve the Default Handle situation: Currently, to provide Template support forHandle, it implementsGetTemplate. This of course conflicts withimpl Default for Handle. This is pretty disruptive to non-BSN users (which is currently everyone). We'll want to sort out a middleground solution in the short term that ideally allows us to keepimpl Default for Handleduring the transition.bsn!Scenetuples to surpass tuple impl limitsIdeally before 0.19
We likely won't land all of these. The plan is to (ideally) land this PR before Bevy 0.19 RC1, then maybe land a couple more of these before
world.spawn_scene(scene)as aworld.spawn(bundle)replacement will result in a pretty significant performance reduction.#Namereferences in more places: The UI eventing scenario really wants#Nameto be usable in closures. This would functionally be expressed as a template that returns a closure that accesses a specific entity. This unlocks a lot of value for UI devs, so ideally it lands alongside BSN.Playercomponent accessing nested entities like "equipment" when inserted). If we decide to keep things as they are, we probably want to introduce additional "scene ready" entity events that trigger "bottom up"."Root/Child1/GrandChild1"). This is relatively low hanging fruit, especially if we switch to bottom-up spawning order.:button) should also be cached.derive(GetTemplate)generics ergonomics: Currently this requires casting spells:T: GetTemplate<Template: Default + Template<Output = T>>Near Future
.bsnparser / AssetLoader that can produce the currentScenePatchassets.:Button { prop }instead of:button(prop). I'd really like us to explore this being component-tied (ex: associate a scene with a Button component).Scene, every entity defined in the scene is instantiated. Some scenarios would benefit from Scene instances sharing some unique entity. For example: defining assets inside of scenes (this would pair nicely with Assets as Entities) , sharing Observer entities, etc.touch_type::<Nested>()approach could be replaced withlet x: &mut Nestedfor actual type safety (and probably better autocomplete)<Transform as GetTemplate>::Template::from_transform()Longer Term
bsn!hot patching via subsecond: Proof of concept here