Allow ImageNode with a texture atlas to be construct in BSN, fixes #24889#24965
Allow ImageNode with a texture atlas to be construct in BSN, fixes #24889#24965bitblocks-dev wants to merge 2 commits into
ImageNode with a texture atlas to be construct in BSN, fixes #24889#24965Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨ |
| /// This defaults to a [`TRANSPARENT_IMAGE_HANDLE`], which points to a fully transparent 1x1 texture. | ||
| pub image: Handle<Image>, | ||
| /// The (optional) texture atlas used to render the image. | ||
| #[template(built_in)] |
There was a problem hiding this comment.
Hmm, does this mean something is wrong with built_in? As far as I know from the original PR https://github.com/bevyengine/bevy/pull/23699/changes#diff-227e59a8188aa92faa1fb6bd502828d6aad148bebff25ee72528b408d6c5078dL26, this was meant to replace the verbosity of OptionTemplate<TextureAtlasTemplate>
There was a problem hiding this comment.
Maybe? I'm not super familiar with how built_in functions... I just tried replacing it and that worked. Definitely worth looking into
There was a problem hiding this comment.
Strange yeah built_in exists to avoid needing to manually specify final template in these cases. I'll need to look into it.
Its worth noting that my WIP Assets as Entities branch removes built_in completely and generally reduces the weirdness factor for these types by removing the need for a separate OptionTemplate.
Objective
Allow
ImageNodewith a texture atlas to be construct in BSN, fixes #24889Solution
Replaces
with
which makes it possible to construct
ImageNodewith a texture atlas, though the ergonomics could use some work.Testing
Tested using the following code, adapted from the UI Texture Atlas Slice example.
Click to view