Hello,
it will be difficult to show it with a simple sample patch.
In my App, my brushes module is giving me hard time:
when i open gamma and load my project the path are correctly done, but the texture are not loaded in preview in i m Gui, nor in my drawing application
if i recompile F8-F5, everything works.
if i recompile several time also
If i use my standalone Help patch, on open of Gamma the texture are correctly shown on first compilation.
I m a bit connfused on how to fix this problem. If anybody has an advice on how to fix I will gladdly hear it !
Sounds like I have the same issue. When loading the filetextures stay on either IsLoading true and output is NULL or sometimes IsLoading is false, but the output is still NULL. Pressing F9 to reload fixes it.
I was just contemplating how to maybe catch this error and somehow reload the FileTexture node when it outputs NULL. I was thinking with the Try region, but when the output is NULL it didnât actually throw an error:
That proposed IsAssigned region might be nice, but it would also need some way to Reset the Region on Failure like the Try. Or maybe some combination of the 2.
I will also try with ManageProcess and see if I can reset the node (maybe with a limit so it doesnât do it constantly) if the FileTexture outputs NULL, even though it shouldnât.
Could this be because somewhere you are not checking whether your texture is NULL or not? Itâs not clear from the screenshots exactly whatâs going on, and Iâm not sure exactly how the image is being loaded.
But I would like to point out that FileTexture (we are talking about the Stride version, right?) creates an asset with texture path data. This is roughly an asynchronous process, it is not loaded immediately. Until it is loaded, the output is unfortunately NULL.
upd: I took a closer look at the screenshots and it hit me. I think I know whatâs going on. The thing is that loading a texture does not load an image, it creates an asset in the Stride backend. So an entity with the path to the image file is created. Then a function that manages the state of this asset is called on update. And when the file is loaded, this function reports completion and that the file has been loaded. Without calling this function, you will not get the image. And after reloading, everything works immediately because the asset is cached on the backend and the Strideâs cache is not released when the patch is restarted.
You can probably make custom filetexture node and provide asset instead of texture.
I would take a closer look at this problem. Iâm not sure, but for some reason I canât find a node that can be guaranteed to open an image in a blocking style. As a result, there are constant errors related to the texture becoming NULL for a short time. Itâs very hard to keep track of them. Also, as I said above, this node canât be used in some cases because it needs to be constantly updated, otherwise the texture simply wonât go to the output in many cases.
I have a case that uses this node and managing the texture state is turning into a very difficult quest that I canât solve. I need to make sure that all textures are loaded after something has changed in the file list, and only then perform actions. It turns out that I need to somehow deal with asynchronous behavior, but without an asynchronous api.
Thank you @yar yar !
Its quite puzzeling in fact maybe this is also related to first execution order. Is there any way to set a kind of priority in Gamma ?
If you want to use this node, just make it do Update and avoid the cache region. On the output, put a classic scheme with âisAssignedâ and âIFâ region. If something depends on these textures, youâll have to figure out something else next.
I only wrote because Iâve encountered all the peculiarities of using this node myself.
Just had this happening again fairly consistently after first starting. We found that using the TextureReader (Async) instead of FileTexture seems to avoid the issue of NULL output and IsLoading being true. Maybe someone can check what it does differently.
Thatâs an interesting theory @yar that the FileTexture is used inside of some Cache region or some other construct not calling its Update operation every frame. Is that the case in your patches @karistouf@seltzdesign ? Or would you say you call it every frame and still it never outputs anything / only once you hit F9?
I think it would be a better solution to give access to the async API - observables, tasks or channels. Sometimes itâs easier to wait for loading or notify subscribers than to try to deal with the texture at runtime.
Yes, the node is in the update and not inside any Cache and called as the program starts (in my case the FileTexture node actually just loads a default texture, which is later replaced by a texture loaded by the user).
Even if I delete the node, place it again and hook up the file path again, it will just have IsLoading true and NULL output. Itâs only when I press F9 that the node starts working. But it doesnât happen consistently, only maybe 1 out of 10 times.