Skip to content

Graph Editor : Add snapshot capability #2430

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

kwokcb
Copy link
Contributor

@kwokcb kwokcb commented May 30, 2025

Changes

Fixes issue #2429

Add in "snapshot" capability for node editor panel.

Interface Changes

New Keys

  • CTRL-I : capture the editor panel
  • CTRL-SHIFT-I : capture the entire window

Help Dialog Update

Each option will bring up file dialog to allow user to input file name to save. Defaults to PNG extension.

Examples:

Example Snapshot
Top Level capture2
Inside Graph capture3
Entire Window capture4

kwokcb added 5 commits May 29, 2025 12:19
- Add in save dialog and help.
- Ad in CTRL-I vs CTRL-SHIFT-I to capture editor or whole window.
Copy link
Contributor Author

@kwokcb kwokcb left a comment

Choose a reason for hiding this comment

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

@lfl-eholthouser : I've added this as a new snapshot utility. Have a look when you have time and let me know what you think. Thanks.

@@ -326,6 +332,14 @@ class Graph

// Options
bool _saveNodePositions;

// Panel information
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make class members to track panel placement / size changes.
Also pull out constant 15 indent to avoid hard-coded numbers.

@@ -4031,6 +4072,65 @@ void Graph::handleRenderViewInputs()
}
}

mx::ImagePtr Graph::performSnapshot(bool captureWindow) const
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Snapshot function : takes into account the current splitter layout and extra formatting (indentation).

static float leftPaneWidth = 375.0f;
static float rightPaneWidth = 750.0f;
splitter(true, 4.0f, &leftPaneWidth, &rightPaneWidth, 20.0f, 20.0f);
splitter(true, 4.0f, &_leftPaneWidth, &_rightPaneWidth, 20.0f, 20.0f);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remove some hard-coded statics and make class members for reuse during snapshot.

@@ -3180,6 +3185,40 @@ void Graph::saveGraphToFile()
_fileDialogSave.open();
}

void Graph::showSnapshotDialog()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some file dialog infrastructure. Save uses the current captured image.

@kwokcb kwokcb changed the title Add snapshot capability to MaterialX Graph Editor Graph Editor : Add snapshot capability May 30, 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.

1 participant