imgui-node-editor removed
This commit is contained in:
parent
738ed42673
commit
92ed7f47d7
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -12,10 +12,6 @@
|
||||
path = dependencies/imgui
|
||||
url = https://github.com/Timerix22/imgui.git
|
||||
branch = docking_cbuild
|
||||
[submodule "imgui-node-editor"]
|
||||
path = dependencies/imgui_node_editor
|
||||
url = https://github.com/Timerix22/imgui-node-editor.git
|
||||
branch = develop_cbuild
|
||||
[submodule "imnodes"]
|
||||
path = dependencies/imnodes
|
||||
url = https://github.com/Timerix22/imnodes
|
||||
|
||||
5
Makefile
5
Makefile
@ -24,9 +24,6 @@ rebuild_kerep:
|
||||
rebuild_imgui:
|
||||
@cbuild/rebuild_dep.sh libimgui.a 2>&1 | tee make_raw.log
|
||||
|
||||
rebuild_imgui_node_editor:
|
||||
@cbuild/rebuild_dep.sh libimgui-node-editor.a 2>&1 | tee make_raw.log
|
||||
|
||||
rebuild_imnodes:
|
||||
@cbuild/rebuild_dep.sh libimnodes.a 2>&1 | tee make_raw.log
|
||||
|
||||
@ -35,7 +32,7 @@ rebuild_imnodes:
|
||||
embed_fonts:
|
||||
@cbuild/call_task.sh embed_fonts
|
||||
|
||||
rebuild_all: rebuild_kerep rebuild_imgui rebuild_imgui_node_editor rebuild_imnodes embed_fonts
|
||||
rebuild_all: rebuild_kerep rebuild_imgui rebuild_imnodes embed_fonts
|
||||
|
||||
######################################
|
||||
###### Launch tasks #######
|
||||
|
||||
@ -24,8 +24,7 @@ DEPS_BASEDIR="dependencies"
|
||||
# dependency_dir='...'"
|
||||
DEPS="kerep='build_static_lib bin libkerep.a'
|
||||
imgui='build_static_lib bin libimgui.a'
|
||||
imnodes='build_static_lib bin libimnodes.a'
|
||||
imgui_node_editor='build_static_lib bin libimgui-node-editor.a'"
|
||||
imnodes='build_static_lib bin libimnodes.a'"
|
||||
|
||||
# OBJDIR structure:
|
||||
# ├── objects - dir where compiled *.o files are stored. cleans every call of build task
|
||||
|
||||
1
dependencies/imgui_node_editor
vendored
1
dependencies/imgui_node_editor
vendored
@ -1 +0,0 @@
|
||||
Subproject commit 50f39362c22fb7d21312adb07cea66d56da3166a
|
||||
@ -1,117 +0,0 @@
|
||||
#include "gui_internal.hpp"
|
||||
#include "../../dependencies/imgui_node_editor/imgui_node_editor.h"
|
||||
namespace NE = ax::NodeEditor;
|
||||
|
||||
NE::EditorContext* editor_context=nullptr;
|
||||
const char* editor_title;
|
||||
|
||||
void draw_example_node(const char* title);
|
||||
|
||||
|
||||
void node_editor_create(const char* title){
|
||||
NE::Config config;
|
||||
config.SettingsFile = "node_editor.json";
|
||||
editor_context=NE::CreateEditor(&config);
|
||||
editor_title=title;
|
||||
//NE::Style& style=NE::GetStyle();
|
||||
}
|
||||
|
||||
void node_editor_destroy(){
|
||||
NE::DestroyEditor(editor_context);
|
||||
editor_context=nullptr;
|
||||
}
|
||||
|
||||
u32 node_id_next;
|
||||
u32 pin_id_next;
|
||||
u32 link_id_next;
|
||||
|
||||
void draw_node_editor(){
|
||||
if(editor_context==nullptr)
|
||||
return;
|
||||
|
||||
node_id_next=0;
|
||||
pin_id_next=0;
|
||||
link_id_next=0;
|
||||
ImGui::Begin(editor_title);
|
||||
ImGui::SetWindowSizeMin(300,300);
|
||||
NE::SetCurrentEditor(editor_context);
|
||||
NE::Begin(editor_title);
|
||||
// Start drawing nodes.
|
||||
draw_example_node("node A");
|
||||
// ImVec2 node_pos=NE::GetNodePosition(node_id_next-1);
|
||||
// NE::SetNodePosition(node_id_next, ImVec2Add(node_pos, ImVec2(50, 20)));
|
||||
draw_example_node("node B");
|
||||
|
||||
|
||||
// Handle creation action, returns true if editor want to create new object (node or link)
|
||||
if (NE::BeginCreate())
|
||||
{
|
||||
NE::PinId inputPinId, outputPinId;
|
||||
if (NE::QueryNewLink(&inputPinId, &outputPinId))
|
||||
{
|
||||
// QueryNewLink returns true if editor want to create new link between pins.
|
||||
//
|
||||
// Link can be created only for two valid pins, it is up to you to
|
||||
// validate if connection make sense. Editor is happy to make any.
|
||||
//
|
||||
// Link always goes from input to output. User may choose to drag
|
||||
// link from output pin or input pin. This determine which pin ids
|
||||
// are valid and which are not:
|
||||
// * input valid, output invalid - user started to drag new ling from input pin
|
||||
// * input invalid, output valid - user started to drag new ling from output pin
|
||||
// * input valid, output valid - user dragged link over other pin, can be validated
|
||||
|
||||
if (inputPinId && outputPinId) // both are valid, let's accept link
|
||||
{
|
||||
// NE::AcceptNewItem() return true when user release mouse button.
|
||||
if (NE::AcceptNewItem())
|
||||
{
|
||||
// Draw new link.
|
||||
NE::Link(link_id_next++, inputPinId, outputPinId);
|
||||
}
|
||||
|
||||
// You may choose to reject connection between these nodes
|
||||
// by calling NE::RejectNewItem(). This will allow editor to give
|
||||
// visual feedback by changing link thickness and color.
|
||||
}
|
||||
}
|
||||
}
|
||||
NE::EndCreate(); // Wraps up object creation action handling.
|
||||
|
||||
|
||||
// Handle deletion action
|
||||
if (NE::BeginDelete())
|
||||
{
|
||||
// There may be many links marked for deletion, let's loop over them.
|
||||
NE::LinkId deletedLinkId;
|
||||
while (NE::QueryDeletedLink(&deletedLinkId))
|
||||
{
|
||||
// If you agree that link can be deleted, accept deletion.
|
||||
if (NE::AcceptDeletedItem())
|
||||
{
|
||||
}
|
||||
|
||||
// You may reject link deletion by calling:
|
||||
// NE::RejectDeletedItem();
|
||||
}
|
||||
}
|
||||
NE::EndDelete(); // Wrap up deletion action
|
||||
|
||||
|
||||
NE::End();
|
||||
NE::SetCurrentEditor(nullptr);
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void draw_example_node(const char* title){
|
||||
NE::BeginNode(node_id_next++);
|
||||
ImGui::Text(title);
|
||||
NE::BeginPin(pin_id_next++, NE::PinKind::Input);
|
||||
ImGui::Text("-> In");
|
||||
NE::EndPin();
|
||||
ImGui::SameLine();
|
||||
NE::BeginPin(pin_id_next++, NE::PinKind::Output);
|
||||
ImGui::Text("Out ->");
|
||||
NE::EndPin();
|
||||
NE::EndNode();
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user