Skip to content

Commit a7c9885

Browse files
committed
Tweak capture. Fix build.
1 parent 50a029e commit a7c9885

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

source/MaterialXGraphEditor/Graph.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4094,10 +4094,11 @@ mx::ImagePtr Graph::getFrameImage() const
40944094

40954095
// 2. Calculate the ACTUAL right pane dimensions (not just the stored variables)
40964096
ImVec2 rightPanePos = windowPos;
4097-
rightPanePos.x += _leftPaneWidth + _leftPanelIndent + _leftPanelIndent; // leftPane + splitter width
4097+
rightPanePos.x += _leftPaneWidth + _leftPanelIndent + 4;// +_leftPanelIndent; // leftPane + splitter width
4098+
rightPanePos.y += _leftPanelIndent;
40984099

40994100
ImVec2 rightPaneSize;
4100-
rightPaneSize.x = windowSize.x - (_leftPaneWidth + _leftPanelIndent + (2.0f *_leftPanelIndent)); // dynamic width
4101+
rightPaneSize.x = windowSize.x - (_leftPaneWidth + _leftPanelIndent + (_leftPanelIndent)); // dynamic width
41014102

41024103
//rightPaneSize.y = windowSize.y - (windowPos.y - ImGui::GetCursorStartPos().y + 30.0f); // content height
41034104
//rightPaneSize.y = windowSize.y - (windowPos.y + 30.0f); // content height
@@ -4110,7 +4111,7 @@ mx::ImagePtr Graph::getFrameImage() const
41104111
//ImVec2 displaySize = ImGui::GetIO().DisplaySize;
41114112
ImVec2 capturePos = rightPanePos;
41124113
//capturePos.y = displaySize.y - rightPanePos.y - rightPaneSize.y; // Flip Y for OpenGL
4113-
capturePos.y = displaySize.y - rightPanePos.y - rightPaneSize.y; // Flip Y for OpenGL
4114+
capturePos.y = displaySize.y + 4 - rightPanePos.y - rightPaneSize.y; // Flip Y for OpenGL
41144115
std::cout << "Capture Position: " << capturePos.x << ", " << capturePos.y << std::endl;
41154116

41164117
int w = static_cast<int>(rightPaneSize.x);
@@ -4122,7 +4123,7 @@ mx::ImagePtr Graph::getFrameImage() const
41224123
glFlush();
41234124
glReadPixels(
41244125
(int)capturePos.x,
4125-
(int)0/*(capturePos.y*/,
4126+
(int)0,//capturePos.y,
41264127
(int)rightPaneSize.x,
41274128
(int)rightPaneSize.y,
41284129
GL_RGB,
@@ -4196,7 +4197,6 @@ void Graph::drawGraph(ImVec2 mousePos)
41964197
if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) && ImGui::IsKeyPressed(ImGuiKey_B))
41974198
{
41984199
mx::ImagePtr frameImage = getFrameImage();
4199-
static bool showFrameSavedPopup = false;
42004200
std::string filename = "graph_capture.png";
42014201
if (frameImage && _renderer->getImageHandler()->saveImage(filename, frameImage, true))
42024202
{

0 commit comments

Comments
 (0)