Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | MathieuJazz |
Hey folks, I’m having a particular issue… I searched a lot on the internet and what I’m trying to do is quite simple actually, but I can’t find anything to make it work!
So, I want the user to be able to pick a PNG file from a FileDialog window (using file system) and then, my code would copy it in the resource folder (with dir.copy(source, dest)). Everything work fine for this part, but I can’t manage to use this very PNG file freshly imported.
BTW, I noticed that no .import file gets generated while copying the file in the resource folder from code (which really seems to be the problem). If I come back to the editor, the .import file is automatically generated and now, it works.
Is there a way to force a “scan” in the res folder while running? Or force generate a .import file?
Anyway… Any twist or turn around? I’m surely doing it the wrong way… Any advice is welcome!
Here’s a piece of code :
var dir = Directory.new()
dir.copy(source, dest)
#This works!
get_node(txtr_image).texture = load(previs_image)
#This doesn't! No loader found error...
Thank you for your time!
Math
No one can help me?
MathieuJazz | 2022-09-21 14:34
Here’s a related discussion that may be helpful…
Loading a external image if it exists as Sprite2D texture on program start - Archive - Godot Forum
jgodfrey | 2022-09-21 16:48