Skip to content

Add file image preview for Graph Editor#2710

Merged
jstone-lucasfilm merged 11 commits intoAcademySoftwareFoundation:mainfrom
kwokcb:editor_image_preview
Mar 4, 2026
Merged

Add file image preview for Graph Editor#2710
jstone-lucasfilm merged 11 commits intoAcademySoftwareFoundation:mainfrom
kwokcb:editor_image_preview

Conversation

@kwokcb
Copy link
Contributor

@kwokcb kwokcb commented Dec 3, 2025

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:

  • Adds a per filename input image preview
  • Default size is 256 px but is settable from the command line using the --previewWidth argument. A size of <= 0 will turn off previews.
  • Preview size will resize to fit up to the maximum property editor panel width if desired preview size is greater than the editor width.

Implementation notes

  • Adds fix to use document "resolved" image path otherwise relative path images may not be found (e.g. std surface brick)

Caveats

  • There is no software (C++) color management support to display images in the input color space.

Examples

  • Image node (resizing)
Resized to fit Full preview size
image image
2nd Image node Usd Texture
image image
gltf Texture tri-planar
image image

@kwokcb
Copy link
Contributor Author

kwokcb commented Dec 3, 2025

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
Copy link
Contributor Author

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);
Copy link
Contributor Author

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);
Copy link
Contributor Author

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),
Copy link
Contributor Author

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.

Copy link
Contributor

@lfl-eholthouser lfl-eholthouser Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Sorry about that. It's a typo in comment. I meant to say "off" not "on".

@jstone-lucasfilm
Copy link
Member

This looks like a great contribution, thanks @kwokcb, and I'm CC'ing @lfl-eholthouser for a more formal review!

@jstone-lucasfilm jstone-lucasfilm changed the title GraphEditor: Add file image preview Add file image preview for Graph Editor Dec 4, 2025
@kwokcb kwokcb closed this Jan 13, 2026
@kwokcb
Copy link
Contributor Author

kwokcb commented Mar 2, 2026

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!

@kwokcb kwokcb reopened this Mar 2, 2026
Copy link
Contributor

@lfl-eholthouser lfl-eholthouser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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),
Copy link
Contributor

@lfl-eholthouser lfl-eholthouser Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@kwokcb kwokcb requested a review from lfl-eholthouser March 4, 2026 12:33
Copy link
Member

@jstone-lucasfilm jstone-lucasfilm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me as well, thanks @kwokcb!

@jstone-lucasfilm jstone-lucasfilm merged commit 5f68d1d into AcademySoftwareFoundation:main Mar 4, 2026
33 checks passed
@kwokcb kwokcb deleted the editor_image_preview branch March 4, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants