-
Notifications
You must be signed in to change notification settings - Fork 407
Add file image preview for Graph Editor #2710
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
base: main
Are you sure you want to change the base?
Add file image preview for Graph Editor #2710
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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! |
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