Skip to content

Commit

Permalink
Update imgui (fix issue stack layout / clipping in node with spring)
Browse files Browse the repository at this point in the history
See ocornut/imgui#846 (comment)

+ sandbox to reproduce the issue
  • Loading branch information
pthom committed Jul 9, 2024
1 parent 6846ebf commit 25256ee
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 1 deletion.
57 changes: 57 additions & 0 deletions bindings/imgui_bundle/demos_cpp/sandbox/sandbox_stacklayout.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include "imgui.h"
#include "immapp/immapp.h"
#include "imgui-node-editor/imgui_node_editor.h"

namespace ed = ax::NodeEditor;


void GuiNode()
{
// Basically a vertical layout with 2 inner horizontal layouts that contain text elements + a spring element
ImGui::BeginVertical("V");
{
ImGui::BeginHorizontal("H");
{
ImGui::Text("Hello");
ImGui::Spring();
ImGui::Text("world"); // With the new version, this is clipped out!
}
ImGui::EndHorizontal();

ImGui::BeginHorizontal("H2");
{
ImGui::Text("Hello");
ImGui::Spring();
ImGui::Text("world");
ImGui::Text("And again");
}
ImGui::EndHorizontal();
}
ImGui::EndVertical();
}


void Gui()
{
// A simple node editor with a single node
ed::Begin("Node editor");
ed::BeginNode(ed::NodeId(1));
{
GuiNode();
}
ed::EndNode();
ed::End();
}


int main(int, char**)
{
// Run the application using ImmApp (from ImGui Bundle)
// This is simply a way to quickly setup an application with ImGui + Node Editor
HelloImGui::RunnerParams runnerParams;
runnerParams.callbacks.ShowGui = Gui;
ImmApp::AddOnsParams addOnsParams;
addOnsParams.withNodeEditor = true;
ImmApp::Run(runnerParams, addOnsParams);
return 0;
}
22 changes: 22 additions & 0 deletions bindings/imgui_bundle/demos_python/sandbox/sandbox_stacklayout.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from imgui_bundle import imgui, immapp, imgui_ctx, imgui_node_editor as ed


def gui():
with imgui_ctx.begin_vertical("V"):
ed.begin("Node editor")
ed.begin_node(ed.NodeId(1))
with imgui_ctx.begin_horizontal("H"):
imgui.text("Hello")
imgui.spring()
imgui.text("world")

with imgui_ctx.begin_horizontal("H2"):
imgui.text("Hello")
imgui.spring()
imgui.text("world")
imgui.text("And again")
ed.end_node()
ed.end()


immapp.run(gui, with_node_editor=True)
2 changes: 1 addition & 1 deletion external/imgui/imgui
Submodule imgui updated 1 files
+0 −36 imgui_stacklayout.cpp

0 comments on commit 25256ee

Please sign in to comment.