node editor - half links

This commit is contained in:
Mikulas Florek 2022-10-30 15:14:16 +01:00
parent 3469a0c08b
commit db3c06cc43
2 changed files with 10 additions and 0 deletions

View file

@ -50,6 +50,7 @@ IMGUI_API void EndNodeTitleBar();
IMGUI_API void BeginNode(ImGuiID id, ImVec2& screen_pos, bool* selected);
IMGUI_API void EndNode();
IMGUI_API void Pin(ImGuiID id, bool is_input, PinShape shape = PinShape::CIRCLE);
IMGUI_API bool GetHalfLink(ImGuiID* from);
IMGUI_API bool GetNewLink(ImGuiID* from, ImGuiID* to);
IMGUI_API void NodeLink(ImGuiID from, ImGuiID to);
IMGUI_API void NodeLinkEx(ImGuiID from, ImGuiID to, ImU32 color, ImU32 active_color);

View file

@ -124,6 +124,15 @@ namespace ImGuiEx {
}
}
bool GetHalfLink(ImGuiID* from) {
ASSERT(g_node_editor.between_begin_end_editor);
if (g_node_editor.new_link_from && IsMouseReleased(0) && !g_node_editor.new_link_to) {
*from = g_node_editor.new_link_from;
return true;
}
return false;
}
bool GetNewLink(ImGuiID* from, ImGuiID* to) {
ASSERT(g_node_editor.between_begin_end_editor);
if (g_node_editor.new_link_to) {