I'm unsure whether this is something I need a ResourceLoader for or if I need to do coroutines to do this.
I am setting up an application where you can drag in a set of folders and it will load up a set of processed images based on the files within said folders.
I want to make a progress indicator for these operations so that the user can get an idea of how far along the process is rather than have the application seemingly lock up until the operation is complete. I am unclear on how to achieve this or what resources I need to read over to set this up.
I looked at the Background Loading page in the docs, but this seems to be more for polling a single file to be loaded, rather than a group of files? Or perhaps I'm not understanding the subject matter here properly.
could this be something I need to be running Coroutines with? by running a function, running a yield and doing updates in the calling function which would loop and do the resumes?
A sample of the situation I'm working with:
func _on_files_dropped(files, _screen):
for file in files:
# Search file directory for a pair of valid file paths for base images needed to create composite image.
# return an array or null
var test = validate(file)
if test:
processing_list.append(test)
for build in processing_list:
# Load files from processing list into Images, draw new image pixel by pixel from the components
# Store new composited image into an array
loaded.append(parse_image(build[0], build[1]))
Validate is simply searching directories and testing the contents to find the 2 pieces needed to composite an image. There could be a large number of invalid files in the directory fed into the function. I'm omitting the code as it's just a rats nest of string verification via substring searches.
Parse Image iterates through the mapping component image pixel by pixel and replaces them with a color found in the palette component image. I would use a shader instead of this operation but I need to save the resultant data, and I can't pull that data from a shader without processing and waiting for a Viewport Texture to update).
I'm trying to make it so if this process is fed 300-ish folders (a real possibility) it doesn't lock up the program and instead shows a loading progress bar, but have no concept of what methods are required for such a task. Potentially the parse image function would take the longest here as I may end up iterating over a 1024x1024 image reading values and drawing a new image based on whatever pixels didn't have 0 alpha.