-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added image icons in content browser #569
Conversation
Just so you know... that for loop with iterator will Never call |
Well, now i don't get what you're saying with the last 4 screenshots, sorry! (EDIT: I just read your message again, and now i understand what you mean by the images 🙂) |
Btw, just a little FYI: you're not deleting the thumbnail icons for png's when going into another folder 😉 |
Yeah, I probably could've explained it a bit better sorry about that haha. I'm not sure why it's slow for you, when I tried to reload the image from disk constantly its slow but all it should be running is checking if a couple of paths exist. Then again, I've only does this with about 2-3 images, I haven't tested performance with a high amount of images.
If you mean that it doesn't clear the cache every folder change (rather than it doesn't DETECT deletes/renames in non-open folders, because that should work with how its written) then that's true. My thought process though, is that it's only going to load around 20-30 images at once (most probably being in a single folder) so I'm not sure if it's worth to clear the cache every folder change. But! It wouldn't be hard to write it to support that if Cherno sees it and requests so. I would be happy to commit the change. |
yeah let's see if/when cherno reacts to this, and if he chooses to write his own 😉 |
With the addition of the filewatcher, #595 is a better implementation of this system. |
Currently textures/images in the Content Browser panel display the default file icon, as a QOL feature I've changed it to use the image itself.
To avoid having to recreate the texture every frame I add it to a cache (unordered map of file path string to texture). An issue with this approach is that if the file is deleted it wouldn't be removed from the cache so I added the code below to remove the textures from cache if the file no longer exists.
Unfortunately the for loop has to be written in this way since a normal
auto [key, val]
for loop breaks when you try to remove a key while iterating it.