Updated imgui-node-editor to commit 32dc92e
This commit is contained in:
@@ -69,15 +69,12 @@ endif()
|
||||
if (OpenGL_FOUND)
|
||||
set(HAVE_OPENGL YES)
|
||||
|
||||
find_package(gl3w REQUIRED)
|
||||
# Explicitly select embedded GL3W loader
|
||||
target_compile_definitions(application PRIVATE IMGUI_IMPL_OPENGL_LOADER_GL3W)
|
||||
|
||||
target_include_directories(application PRIVATE ${OPENGL_INCLUDE_DIR})
|
||||
target_link_libraries(application PRIVATE ${OPENGL_gl_LIBRARY} gl3w)
|
||||
target_link_libraries(application PRIVATE ${OPENGL_gl_LIBRARY})
|
||||
list(APPEND _Application_Sources
|
||||
source/imgui_impl_opengl3.cpp
|
||||
source/imgui_impl_opengl3.h
|
||||
source/imgui_impl_opengl3_loader.h
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# pragma once
|
||||
# include <imgui.h>
|
||||
|
||||
# if !defined(IMGUI_VERSION_NUM) || (IMGUI_VERSION_NUM < 18822)
|
||||
|
||||
# include <type_traits>
|
||||
|
||||
// https://stackoverflow.com/a/8597498
|
||||
@@ -46,3 +49,17 @@ static inline int GetEnumValueForD()
|
||||
{
|
||||
return KeyTester_ImGuiKey_D::Get<ImGuiKey_>(nullptr);
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
static inline ImGuiKey GetEnumValueForF()
|
||||
{
|
||||
return ImGuiKey_F;
|
||||
}
|
||||
|
||||
static inline ImGuiKey GetEnumValueForD()
|
||||
{
|
||||
return ImGuiKey_D;
|
||||
}
|
||||
|
||||
# endif
|
||||
+479
-222
File diff suppressed because it is too large
Load Diff
+24
-45
@@ -1,31 +1,36 @@
|
||||
// dear imgui: Renderer for modern OpenGL with shaders / programmatic pipeline
|
||||
// dear imgui: Renderer Backend for modern OpenGL with shaders / programmatic pipeline
|
||||
// - Desktop GL: 2.x 3.x 4.x
|
||||
// - Embedded GL: ES 2.0 (WebGL 1.0), ES 3.0 (WebGL 2.0)
|
||||
// This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..)
|
||||
// This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
|
||||
// [x] Renderer: Desktop GL only: Support for large meshes (64k+ vertices) with 16-bit indices.
|
||||
// [x] Renderer: Large meshes support (64k+ vertices) with 16-bit indices (Desktop OpenGL only).
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
|
||||
// If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp.
|
||||
// https://github.com/ocornut/imgui
|
||||
// About WebGL/ES:
|
||||
// - You need to '#define IMGUI_IMPL_OPENGL_ES2' or '#define IMGUI_IMPL_OPENGL_ES3' to use WebGL or OpenGL ES.
|
||||
// - This is done automatically on iOS, Android and Emscripten targets.
|
||||
// - For other targets, the define needs to be visible from the imgui_impl_opengl3.cpp compilation unit. If unsure, define globally or in imconfig.h.
|
||||
|
||||
// About Desktop OpenGL function loaders:
|
||||
// Modern Desktop OpenGL doesn't have a standard portable header file to load OpenGL function pointers.
|
||||
// Helper libraries are often used for this purpose! Here we are supporting a few common ones (gl3w, glew, glad).
|
||||
// You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own.
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// Learn about Dear ImGui:
|
||||
// - FAQ https://dearimgui.com/faq
|
||||
// - Getting Started https://dearimgui.com/getting-started
|
||||
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
|
||||
// - Introduction, links and more at the top of imgui.cpp
|
||||
|
||||
// About GLSL version:
|
||||
// The 'glsl_version' initialization parameter should be NULL (default) or a "#version XXX" string.
|
||||
// The 'glsl_version' initialization parameter should be nullptr (default) or a "#version XXX" string.
|
||||
// On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es"
|
||||
// Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp.
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
#ifndef IMGUI_DISABLE
|
||||
|
||||
// Backend API
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL);
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = nullptr);
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data);
|
||||
@@ -40,48 +45,22 @@ IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
||||
//#define IMGUI_IMPL_OPENGL_ES2 // Auto-detected on Emscripten
|
||||
//#define IMGUI_IMPL_OPENGL_ES3 // Auto-detected on iOS/Android
|
||||
|
||||
// Attempt to auto-detect the default Desktop GL loader based on available header files.
|
||||
// If auto-detection fails or doesn't select the same GL loader file as used by your application,
|
||||
// you are likely to get a crash in ImGui_ImplOpenGL3_Init().
|
||||
// You can explicitly select a loader by using one of the '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
|
||||
// You can explicitly select GLES2 or GLES3 API by using one of the '#define IMGUI_IMPL_OPENGL_LOADER_XXX' in imconfig.h or compiler command-line.
|
||||
#if !defined(IMGUI_IMPL_OPENGL_ES2) \
|
||||
&& !defined(IMGUI_IMPL_OPENGL_ES3) \
|
||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \
|
||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \
|
||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \
|
||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD2) \
|
||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING2) \
|
||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_GLBINDING3) \
|
||||
&& !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
||||
&& !defined(IMGUI_IMPL_OPENGL_ES3)
|
||||
|
||||
// Try to detect GLES on matching platforms
|
||||
#if defined(__APPLE__)
|
||||
#include "TargetConditionals.h"
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
|
||||
#define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
#elif defined(__EMSCRIPTEN__) || defined(__amigaos4__)
|
||||
#define IMGUI_IMPL_OPENGL_ES2 // Emscripten -> GL ES 2, "#version 100"
|
||||
|
||||
// Otherwise try to detect supported Desktop OpenGL loaders..
|
||||
#elif defined(__has_include)
|
||||
#if __has_include(<GL/glew.h>)
|
||||
#define IMGUI_IMPL_OPENGL_LOADER_GLEW
|
||||
#elif __has_include(<glad/glad.h>)
|
||||
#define IMGUI_IMPL_OPENGL_LOADER_GLAD
|
||||
#elif __has_include(<glad/gl.h>)
|
||||
#define IMGUI_IMPL_OPENGL_LOADER_GLAD2
|
||||
#elif __has_include(<GL/gl3w.h>)
|
||||
#define IMGUI_IMPL_OPENGL_LOADER_GL3W
|
||||
#elif __has_include(<glbinding/glbinding.h>)
|
||||
#define IMGUI_IMPL_OPENGL_LOADER_GLBINDING3
|
||||
#elif __has_include(<glbinding/Binding.h>)
|
||||
#define IMGUI_IMPL_OPENGL_LOADER_GLBINDING2
|
||||
#else
|
||||
#error "Cannot detect OpenGL loader!"
|
||||
#endif
|
||||
#else
|
||||
#define IMGUI_IMPL_OPENGL_LOADER_GL3W // Default to GL3W embedded in our repository
|
||||
// Otherwise imgui_impl_opengl3_loader.h will be used.
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
||||
|
||||
@@ -93,7 +93,11 @@ bool ImGui_ImplWin32_Init(void* hwnd)
|
||||
io.KeyMap[ImGuiKey_Space] = VK_SPACE;
|
||||
io.KeyMap[ImGuiKey_Enter] = VK_RETURN;
|
||||
io.KeyMap[ImGuiKey_Escape] = VK_ESCAPE;
|
||||
# if defined(IMGUI_VERSION_NUM) && (IMGUI_VERSION_NUM >= 18604)
|
||||
io.KeyMap[ImGuiKey_KeypadEnter] = VK_RETURN;
|
||||
# else
|
||||
io.KeyMap[ImGuiKey_KeyPadEnter] = VK_RETURN;
|
||||
# endif
|
||||
io.KeyMap[ImGuiKey_A] = 'A';
|
||||
io.KeyMap[ImGuiKey_C] = 'C';
|
||||
io.KeyMap[ImGuiKey_V] = 'V';
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
# include "platform.h"
|
||||
# include <algorithm>
|
||||
# include <cstdint> // std::intptr_t
|
||||
|
||||
# if PLATFORM(WINDOWS)
|
||||
# define NOMINMAX
|
||||
@@ -31,8 +32,10 @@ using namespace gl;
|
||||
# include <glbinding/glbinding.h>// Initialize with glbinding::initialize()
|
||||
# include <glbinding/gl/gl.h>
|
||||
using namespace gl;
|
||||
# else
|
||||
# elif defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM)
|
||||
# include IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||
# else
|
||||
# include "imgui_impl_opengl3_loader.h"
|
||||
# endif
|
||||
|
||||
struct ImTexture
|
||||
|
||||
+28
-14
@@ -1,10 +1,9 @@
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include <application.h>
|
||||
#include "utilities/builders.h"
|
||||
#include "utilities/widgets.h"
|
||||
|
||||
#include <imgui_node_editor.h>
|
||||
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include <imgui_internal.h>
|
||||
|
||||
#include <string>
|
||||
@@ -648,7 +647,9 @@ struct Example:
|
||||
ImGui::DragFloat("Node Rounding", &editorStyle.NodeRounding, 0.1f, 0.0f, 40.0f);
|
||||
ImGui::DragFloat("Node Border Width", &editorStyle.NodeBorderWidth, 0.1f, 0.0f, 15.0f);
|
||||
ImGui::DragFloat("Hovered Node Border Width", &editorStyle.HoveredNodeBorderWidth, 0.1f, 0.0f, 15.0f);
|
||||
ImGui::DragFloat("Hovered Node Border Offset", &editorStyle.HoverNodeBorderOffset, 0.1f, -40.0f, 40.0f);
|
||||
ImGui::DragFloat("Selected Node Border Width", &editorStyle.SelectedNodeBorderWidth, 0.1f, 0.0f, 15.0f);
|
||||
ImGui::DragFloat("Selected Node Border Offset", &editorStyle.SelectedNodeBorderOffset, 0.1f, -40.0f, 40.0f);
|
||||
ImGui::DragFloat("Pin Rounding", &editorStyle.PinRounding, 0.1f, 0.0f, 40.0f);
|
||||
ImGui::DragFloat("Pin Border Width", &editorStyle.PinBorderWidth, 0.1f, 0.0f, 15.0f);
|
||||
ImGui::DragFloat("Link Strength", &editorStyle.LinkStrength, 1.0f, 0.0f, 500.0f);
|
||||
@@ -682,7 +683,7 @@ struct Example:
|
||||
ImGui::EndHorizontal();
|
||||
|
||||
static ImGuiTextFilter filter;
|
||||
filter.Draw("", paneWidth);
|
||||
filter.Draw("##filter", paneWidth);
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
@@ -765,6 +766,9 @@ struct Example:
|
||||
}
|
||||
|
||||
bool isSelected = std::find(selectedNodes.begin(), selectedNodes.end(), node.ID) != selectedNodes.end();
|
||||
# if IMGUI_VERSION_NUM >= 18967
|
||||
ImGui::SetNextItemAllowOverlap();
|
||||
# endif
|
||||
if (ImGui::Selectable((node.Name + "##" + std::to_string(reinterpret_cast<uintptr_t>(node.ID.AsPointer()))).c_str(), &isSelected))
|
||||
{
|
||||
if (io.KeyCtrl)
|
||||
@@ -793,7 +797,11 @@ struct Example:
|
||||
|
||||
auto drawList = ImGui::GetWindowDrawList();
|
||||
ImGui::SetCursorScreenPos(iconPanelPos);
|
||||
# if IMGUI_VERSION_NUM < 18967
|
||||
ImGui::SetItemAllowOverlap();
|
||||
# else
|
||||
ImGui::SetNextItemAllowOverlap();
|
||||
# endif
|
||||
if (node.SavedState.empty())
|
||||
{
|
||||
if (ImGui::InvisibleButton("save", ImVec2((float)saveIconWidth, (float)saveIconHeight)))
|
||||
@@ -813,7 +821,11 @@ struct Example:
|
||||
}
|
||||
|
||||
ImGui::SameLine(0, ImGui::GetStyle().ItemInnerSpacing.x);
|
||||
# if IMGUI_VERSION_NUM < 18967
|
||||
ImGui::SetItemAllowOverlap();
|
||||
# else
|
||||
ImGui::SetNextItemAllowOverlap();
|
||||
# endif
|
||||
if (!node.SavedState.empty())
|
||||
{
|
||||
if (ImGui::InvisibleButton("restore", ImVec2((float)restoreIconWidth, (float)restoreIconHeight)))
|
||||
@@ -837,7 +849,9 @@ struct Example:
|
||||
}
|
||||
|
||||
ImGui::SameLine(0, 0);
|
||||
# if IMGUI_VERSION_NUM < 18967
|
||||
ImGui::SetItemAllowOverlap();
|
||||
# endif
|
||||
ImGui::Dummy(ImVec2(0, (float)restoreIconHeight));
|
||||
|
||||
ImGui::PopID();
|
||||
@@ -1537,17 +1551,6 @@ struct Example:
|
||||
|
||||
if (ed::BeginDelete())
|
||||
{
|
||||
ed::LinkId linkId = 0;
|
||||
while (ed::QueryDeletedLink(&linkId))
|
||||
{
|
||||
if (ed::AcceptDeletedItem())
|
||||
{
|
||||
auto id = std::find_if(m_Links.begin(), m_Links.end(), [linkId](auto& link) { return link.ID == linkId; });
|
||||
if (id != m_Links.end())
|
||||
m_Links.erase(id);
|
||||
}
|
||||
}
|
||||
|
||||
ed::NodeId nodeId = 0;
|
||||
while (ed::QueryDeletedNode(&nodeId))
|
||||
{
|
||||
@@ -1558,6 +1561,17 @@ struct Example:
|
||||
m_Nodes.erase(id);
|
||||
}
|
||||
}
|
||||
|
||||
ed::LinkId linkId = 0;
|
||||
while (ed::QueryDeletedLink(&linkId))
|
||||
{
|
||||
if (ed::AcceptDeletedItem())
|
||||
{
|
||||
auto id = std::find_if(m_Links.begin(), m_Links.end(), [linkId](auto& link) { return link.ID == linkId; });
|
||||
if (id != m_Links.end())
|
||||
m_Links.erase(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
ed::EndDelete();
|
||||
}
|
||||
|
||||
+4
-8
@@ -7,8 +7,8 @@
|
||||
// CREDITS
|
||||
// Written by Michal Cichon
|
||||
//------------------------------------------------------------------------------
|
||||
# include "builders.h"
|
||||
# define IMGUI_DEFINE_MATH_OPERATORS
|
||||
# include "builders.h"
|
||||
# include <imgui_internal.h>
|
||||
|
||||
|
||||
@@ -72,15 +72,11 @@ void util::BlueprintNodeBuilder::End()
|
||||
headerColor, GetStyle().NodeRounding, 1 | 2);
|
||||
#endif
|
||||
|
||||
|
||||
auto headerSeparatorMin = ImVec2(HeaderMin.x, HeaderMax.y);
|
||||
auto headerSeparatorMax = ImVec2(HeaderMax.x, HeaderMin.y);
|
||||
|
||||
if ((headerSeparatorMax.x > headerSeparatorMin.x) && (headerSeparatorMax.y > headerSeparatorMin.y))
|
||||
if (ContentMin.y > HeaderMax.y)
|
||||
{
|
||||
drawList->AddLine(
|
||||
headerSeparatorMin + ImVec2(-(8 - halfBorderWidth), -0.5f),
|
||||
headerSeparatorMax + ImVec2( (8 - halfBorderWidth), -0.5f),
|
||||
ImVec2(HeaderMin.x - (8 - halfBorderWidth), HeaderMax.y - 0.5f),
|
||||
ImVec2(HeaderMax.x + (8 - halfBorderWidth), HeaderMax.y - 0.5f),
|
||||
ImColor(255, 255, 255, 96 * alpha / (3 * 255)), 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# include "drawing.h"
|
||||
# define IMGUI_DEFINE_MATH_OPERATORS
|
||||
# include "drawing.h"
|
||||
# include <imgui_internal.h>
|
||||
|
||||
void ax::Drawing::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2& b, IconType type, bool filled, ImU32 color, ImU32 innerColor)
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# include "widgets.h"
|
||||
# define IMGUI_DEFINE_MATH_OPERATORS
|
||||
# include "widgets.h"
|
||||
# include <imgui_internal.h>
|
||||
|
||||
void ax::Widgets::Icon(const ImVec2& size, IconType type, bool filled, const ImVec4& color/* = ImVec4(1, 1, 1, 1)*/, const ImVec4& innerColor/* = ImVec4(0, 0, 0, 0)*/)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# include <imgui.h>
|
||||
# define IMGUI_DEFINE_MATH_OPERATORS
|
||||
# include <imgui.h>
|
||||
# include <imgui_internal.h>
|
||||
# include <imgui_canvas.h>
|
||||
# include <application.h>
|
||||
|
||||
Reference in New Issue
Block a user