Add file image preview for Graph Editor#2710
Add file image preview for Graph Editor#2710kwokcb wants to merge 9 commits intoAcademySoftwareFoundation:mainfrom
Conversation
|
This is another port from my editor. For now there is no way to support colorspace transforms via C++ thus images do not consider input space. Let me know what you think. Thanks. |
| { | ||
| count++; | ||
|
|
||
| // Add space for image previews |
There was a problem hiding this comment.
Since we are using a fixed height, we need to take into consideration space for image previews.
| { | ||
| unsigned int textureId = 0; | ||
| int width = 0, height = 0; | ||
| mx::ImagePtr image = imageHandler->acquireImage(filePath); |
There was a problem hiding this comment.
This will reusage images from the handler's cache if found.
| float aspect = (height > 0) ? (float)width / (float)height : 1.0f; | ||
| ImVec2 imagePreviewSize(previewSize, previewSize / aspect); | ||
|
|
||
| ImGui::Image((void*)(intptr_t)textureId, imagePreviewSize); |
There was a problem hiding this comment.
This is just preview scaling not actual image pixels resizing.
| _autoLayout(false), | ||
| _frameCount(INT_MIN), | ||
| _fontScale(1.0f), | ||
| _previewSize(previewWidth), |
There was a problem hiding this comment.
A size of 0 will turn on previews.
|
This looks like a great contribution, thanks @kwokcb, and I'm CC'ing @lfl-eholthouser for a more formal review! |
|
I had temporarily closed this as I was unsure if I had time to follow-up. As I have some time, I'm re-opening. @lfl-eholthouser let me know if your thoughts on this one for 1.39.5. Thanks! |
Feature Update
For better user feedback on what images are being used from the UI, this change adds image previews for file image nodes
Details:
filenameinput image preview256px but is settable from the command line using the--previewWidthargument. A size of <= 0 will turn off previews.Implementation notes
Caveats
Examples