Skip to content

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.

@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
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.

2 participants