#Image Asset Preprocessing

17 messages · Page 1 of 1 (latest)

novel birch
#

I have a resource/material that accepts an image handle. Usually, this image is generated, but I want to support cases where users provide an image from a file. However, the image is supposed to have "dimension: Cube", instead of "dimension: D2". How do I set a handler that can check if the image is loaded and set the metadata to be correct, before the image is used by the material and it encounters this error (image being the wrong dimension)?

#

Image Asset Preprocessing

desert sluice
#

Hello!

#

lol

#

I think there may be a way to deal with this

#

Could this be because the FallbackImage is TextureDimension::D2?

#

Could you use correctly setup "fallback" until they load their image? Then try to use the reinterpret_stacked_2d_as_array() if they supply a D2 image, or pass along if it's already cube?

novel birch
#

Maybe, but I think it's because if I try to change the image too early, it gives me an error that it's not loaded. Then, once it loads it breaks.

#

So maybe I have to fix both.

desert sluice
#

Or actually, it may not be reinterpret_stacked_2d_as_array that you want to use. But rather just change out the descriptor.

novel birch
desert sluice
#

Well, you have to wait for it to load, and put something in place until then

novel birch
#

I think I might just wait till Bevy has a way to specify a loader or callback. It's a pain to add a system that checks for it.

desert sluice
#

There are asset events

#

But isn't not super slick

novel birch
#

Yeah, that seems overkill for a one time thing

desert sluice
#

Maybe since cart is working on asset stuff now we'll get something for 0.10