Add file image preview for Graph Editor#2710
Add file image preview for Graph Editor#2710jstone-lucasfilm merged 11 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.
There was a problem hiding this comment.
Hi @kwokcb ! Just to clarify, I think I may misunderstanding something, but with a value of 0 as the preview size would drawPreview not be false?
There was a problem hiding this comment.
Ah. Sorry about that. It's a typo in comment. I meant to say "off" not "on".
|
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! |
lfl-eholthouser
left a comment
There was a problem hiding this comment.
This is a really great change! Thanks @kwokcb! I just have one question regarding the preview size.
| _autoLayout(false), | ||
| _frameCount(INT_MIN), | ||
| _fontScale(1.0f), | ||
| _previewSize(previewWidth), |
There was a problem hiding this comment.
Hi @kwokcb ! Just to clarify, I think I may misunderstanding something, but with a value of 0 as the preview size would drawPreview not be false?
jstone-lucasfilm
left a comment
There was a problem hiding this comment.
This looks good to me as well, thanks @kwokcb!
5f68d1d
into
AcademySoftwareFoundation:main
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