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 @@
#include <stddef.h>
struct ImGuiContext;
struct ImVec2;
namespace imnodes {
......@@ -31,7 +32,17 @@ enum StyleVar
StyleVar_GridSpacing = 0,
StyleVar_NodeCornerRounding,
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
......@@ -77,10 +88,14 @@ struct IO
{
EmulateThreeButtonMouse();
// Controls whether this feature is enabled or not.
bool enabled;
const bool* modifier; // The keyboard modifier to use with the mouse
// left click. Set to &ImGuiIO::KeyAlt by default.
// The keyboard modifier to use in combination with mouse left click to
// pan the editor view. Set to NULL by default. To enable this feature,
// set the modifier to point to a boolean indicating the state of a
// modifier. For example,
//
// imnodes::GetIO().emulate_three_button_mouse.modifier =
// &ImGui::GetIO().KeyAlt;
const bool* modifier;
} emulate_three_button_mouse;
struct LinkDetachWithModifierClick
......@@ -88,9 +103,12 @@ struct IO
LinkDetachWithModifierClick();
// Pointer to a boolean value indicating when the desired modifier is
// pressed. Set to NULL by default (i.e. this feature is disabled). To
// enable the feature, set the link to point to, for example,
// &ImGuiIO::KeyCtrl.
// pressed. Set to NULL by default. To enable the feature, set the
// modifier to point to a boolean indicating the state of a modifier.
// For example,
//
// imnodes::GetIO().link_detach_with_modifier_click.modifier =
// &ImGui::GetIO().KeyCtrl;
//
// Left-clicking a link with this modifier pressed will detach that
// link. NOTE: the user has to actually delete the link for this to
......@@ -99,6 +117,10 @@ struct IO
const bool* modifier;
} 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();
};
......@@ -109,6 +131,7 @@ struct Style
float node_corner_rounding;
float node_padding_horizontal;
float node_padding_vertical;
float node_border_thickness;
float link_thickness;
float link_line_segments_per_length;
......@@ -145,6 +168,23 @@ struct 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
// (created with a single Begin/EndNodeEditor pair)
//
......@@ -166,12 +206,6 @@ EditorContextResetPanning(const ImVec2& pos);
void
EditorContextMoveToNode(const int node_id);
// Initialize the node editor system.
void
Initialize();
void
Shutdown();
IO&
GetIO();
......@@ -205,6 +239,8 @@ PushStyleVar(StyleVar style_item, float value);
void
PopStyleVar();
// id can be any positive or negative integer, but INT_MIN is currently reserved
// for internal use.
void
BeginNode(int id);
void
......
......@@ -119,7 +119,7 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
// Setup Platform/Renderer bindings
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init(glsl_version);
imnodes::Initialize();
imnodes::CreateContext();
irt::application_initialize();
// Load Fonts
......@@ -190,7 +190,7 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
// Cleanup
irt::application_shutdown();
imnodes::Shutdown();
imnodes::DestroyContext();
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
......
......@@ -96,7 +96,8 @@ int main(int, char**)
g_pd3dSrvDescHeap->GetCPUDescriptorHandleForHeapStart(),
g_pd3dSrvDescHeap->GetGPUDescriptorHandleForHeapStart());
imnodes::Initialize();
imnodes::CreateContext();
irt::application_initialize();
// Load Fonts
......@@ -182,8 +183,8 @@ int main(int, char**)
irt::application_shutdown();
imnodes::Shutdown();
imnodes::DestroyContext();
WaitForLastSubmittedFrame();
ImGui_ImplDX12_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