Open Trouv opened 2 years ago
Good suggestion, thank you :)
For my needs in Unity, I didn't have a problem with this; as long as it had the slice data, then that works for me, as I can already get the width/height of the source texture. But I can see that would be useful to have the source texture width and height in the json.
Adding to this. I've now found a need to access the background image's width/height; To maintain performance, I don't load the texture to check its width/height. So adding a source texture width/height to the json would be very valuable to me as well. 🙂 This feature will be critical for me sometime in the far future.
The
__bgPos
stores a lot of good information about the background image, which makes rendering it pretty easy. However, the total size (not cropped) of the background image isn't stored anywhere, like it is for tileset definitions. This can be a bit annoying when importing into engines that load assets asynchronously.In the case of
bevy
, you give entities an asset handle component for rendering rather than the raw asset data itself, meaning you don't need to wait for the asset to load before assigning said component to an entity. But doing a crop on the image with a texture atlas requires knowing the size of the total image on creation of the texture atlas component. You can't figure out the size of the image from the asset data itself until that asset has finished loading.Storing a
pxHei
andpxWid
, maybe in the__bgPos
, would go a long way to alleviate this problem.