Filetexture not loading when Opening Gamma but doing it when F8-F5 recompilation

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.

This is with the patch running. No errors. The output is NULL on both. After F9 they are loaded.

Maybe some regression in the Filetexture node?

1 Like

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:

(in this instance I just input an invalid path).

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.

if it shouldnt isnt it a bug rather than a special technique to apply ?

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.

thank you @yar . when i will have found to fix my broken stride i will rush on it !

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.

1 Like

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.

Here is what it looks like:

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?

@seltzdesign I’ve tried this node

Could be the solution
Can provide texture from ‘default’ until it loads the file.

But there are still a number of challenges (e.g. you cannot find out if the texture is loaded or not)

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.

Could be related to this: