Commit 60d65a1f authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

imnodes: bump to v0.4

parent 5dec4126
This diff is collapsed.
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <stddef.h> #include <stddef.h>
struct ImGuiContext;
struct ImVec2; struct ImVec2;
namespace imnodes { namespace imnodes {
...@@ -31,7 +32,17 @@ enum StyleVar ...@@ -31,7 +32,17 @@ enum StyleVar
StyleVar_GridSpacing = 0, StyleVar_GridSpacing = 0,
StyleVar_NodeCornerRounding, StyleVar_NodeCornerRounding,
StyleVar_NodePaddingHorizontal, StyleVar_NodePaddingHorizontal,
StyleVar_NodePaddingVertical StyleVar_NodePaddingVertical,
StyleVar_NodeBorderThickness,
StyleVar_LinkThickness,
StyleVar_LinkLineSegmentsPerLength,
StyleVar_LinkHoverDistance,
StyleVar_PinCircleRadius,
StyleVar_PinQuadSideLength,
StyleVar_PinTriangleSideLength,
StyleVar_PinLineThickness,
StyleVar_PinHoverRadius,
StyleVar_PinOffset
}; };
enum StyleFlags enum StyleFlags
...@@ -77,10 +88,14 @@ struct IO ...@@ -77,10 +88,14 @@ struct IO
{ {
EmulateThreeButtonMouse(); EmulateThreeButtonMouse();
// Controls whether this feature is enabled or not. // The keyboard modifier to use in combination with mouse left click to
bool enabled; // pan the editor view. Set to NULL by default. To enable this feature,
const bool* modifier; // The keyboard modifier to use with the mouse // set the modifier to point to a boolean indicating the state of a
// left click. Set to &ImGuiIO::KeyAlt by default. // modifier. For example,
//
// imnodes::GetIO().emulate_three_button_mouse.modifier =
// &ImGui::GetIO().KeyAlt;
const bool* modifier;
} emulate_three_button_mouse; } emulate_three_button_mouse;
struct LinkDetachWithModifierClick struct LinkDetachWithModifierClick
...@@ -88,9 +103,12 @@ struct IO ...@@ -88,9 +103,12 @@ struct IO
LinkDetachWithModifierClick(); LinkDetachWithModifierClick();
// Pointer to a boolean value indicating when the desired modifier is // Pointer to a boolean value indicating when the desired modifier is
// pressed. Set to NULL by default (i.e. this feature is disabled). To // pressed. Set to NULL by default. To enable the feature, set the
// enable the feature, set the link to point to, for example, // modifier to point to a boolean indicating the state of a modifier.
// &ImGuiIO::KeyCtrl. // For example,
//
// imnodes::GetIO().link_detach_with_modifier_click.modifier =
// &ImGui::GetIO().KeyCtrl;
// //
// Left-clicking a link with this modifier pressed will detach that // Left-clicking a link with this modifier pressed will detach that
// link. NOTE: the user has to actually delete the link for this to // link. NOTE: the user has to actually delete the link for this to
...@@ -99,6 +117,10 @@ struct IO ...@@ -99,6 +117,10 @@ struct IO
const bool* modifier; const bool* modifier;
} link_detach_with_modifier_click; } link_detach_with_modifier_click;
// Holding alt mouse button pans the node area, by default middle mouse
// button will be used Set based on ImGuiMouseButton values
int alt_mouse_button;
IO(); IO();
}; };
...@@ -109,6 +131,7 @@ struct Style ...@@ -109,6 +131,7 @@ struct Style
float node_corner_rounding; float node_corner_rounding;
float node_padding_horizontal; float node_padding_horizontal;
float node_padding_vertical; float node_padding_vertical;
float node_border_thickness;
float link_thickness; float link_thickness;
float link_line_segments_per_length; float link_line_segments_per_length;
...@@ -145,6 +168,23 @@ struct Style ...@@ -145,6 +168,23 @@ struct Style
Style(); Style();
}; };
struct Context;
// Call this function if you are compiling imnodes in to a dll, separate from
// ImGui. Calling this function sets the GImGui global variable, which is not
// shared across dll boundaries.
void
SetImGuiContext(ImGuiContext* ctx);
Context*
CreateContext();
void
DestroyContext(Context* ctx = NULL); // NULL = destroy current context
Context*
GetCurrentContext();
void
SetCurrentContext(Context* ctx);
// An editor context corresponds to a set of nodes in a single workspace // An editor context corresponds to a set of nodes in a single workspace
// (created with a single Begin/EndNodeEditor pair) // (created with a single Begin/EndNodeEditor pair)
// //
...@@ -166,12 +206,6 @@ EditorContextResetPanning(const ImVec2& pos); ...@@ -166,12 +206,6 @@ EditorContextResetPanning(const ImVec2& pos);
void void
EditorContextMoveToNode(const int node_id); EditorContextMoveToNode(const int node_id);
// Initialize the node editor system.
void
Initialize();
void
Shutdown();
IO& IO&
GetIO(); GetIO();
...@@ -205,6 +239,8 @@ PushStyleVar(StyleVar style_item, float value); ...@@ -205,6 +239,8 @@ PushStyleVar(StyleVar style_item, float value);
void void
PopStyleVar(); PopStyleVar();
// id can be any positive or negative integer, but INT_MIN is currently reserved
// for internal use.
void void
BeginNode(int id); BeginNode(int id);
void void
......
...@@ -119,7 +119,7 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) ...@@ -119,7 +119,7 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
// Setup Platform/Renderer bindings // Setup Platform/Renderer bindings
ImGui_ImplGlfw_InitForOpenGL(window, true); ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init(glsl_version); ImGui_ImplOpenGL3_Init(glsl_version);
imnodes::Initialize(); imnodes::CreateContext();
irt::application_initialize(); irt::application_initialize();
// Load Fonts // Load Fonts
...@@ -190,7 +190,7 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) ...@@ -190,7 +190,7 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
// Cleanup // Cleanup
irt::application_shutdown(); irt::application_shutdown();
imnodes::Shutdown(); imnodes::DestroyContext();
ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown(); ImGui_ImplGlfw_Shutdown();
......
...@@ -96,7 +96,8 @@ int main(int, char**) ...@@ -96,7 +96,8 @@ int main(int, char**)
g_pd3dSrvDescHeap->GetCPUDescriptorHandleForHeapStart(), g_pd3dSrvDescHeap->GetCPUDescriptorHandleForHeapStart(),
g_pd3dSrvDescHeap->GetGPUDescriptorHandleForHeapStart()); g_pd3dSrvDescHeap->GetGPUDescriptorHandleForHeapStart());
imnodes::Initialize(); imnodes::CreateContext();
irt::application_initialize(); irt::application_initialize();
// Load Fonts // Load Fonts
...@@ -182,8 +183,8 @@ int main(int, char**) ...@@ -182,8 +183,8 @@ int main(int, char**)
irt::application_shutdown(); irt::application_shutdown();
imnodes::Shutdown(); imnodes::DestroyContext();
WaitForLastSubmittedFrame(); WaitForLastSubmittedFrame();
ImGui_ImplDX12_Shutdown(); ImGui_ImplDX12_Shutdown();
ImGui_ImplWin32_Shutdown(); ImGui_ImplWin32_Shutdown();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment