-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update imgui (fix issue stack layout / clipping in node with spring)
See ocornut/imgui#846 (comment) + sandbox to reproduce the issue
- Loading branch information
Showing
3 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
bindings/imgui_bundle/demos_cpp/sandbox/sandbox_stacklayout.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
22
bindings/imgui_bundle/demos_python/sandbox/sandbox_stacklayout.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |