$ show Fattorino/ImNodeFlow
ImNodeFlow is a C++ library that provides node-based editor functionality for Dear ImGui applications. It enables developers to create visual programming interfaces with customizable nodes, input/output pins, and bezier curve connections. The library handles all aspects of the node editor including grid management, node rendering, link rendering, user interactions (dragging, clicking, popup menus), and connection logic. The architecture centers around the ImNodeFlow class which manages the infinite grid, nodes, and links. Custom nodes are created by deriving from BaseNode and implementing the draw() method for node content. The system uses a retained-mode approach for nodes and links while leveraging ImGui's immediate-mode rendering for the UI. Key features include zoom/pan support, connection filtering, customizable styling, and popup events for right-click and dropped links. While primarily a UI component library, the repository includes specialized mathematical utilities that could be reused independently. The bezier math implementation for connection rendering and the context wrapper for zoom/pan functionality demonstrate particularly strong encapsulation and could be extracted for use in other projects.
The LLM identified 3 files worth highlighting for reuse:
A self-contained bezier curve mathematics library implementing curve sampling, length calculation, point projection, curve splitting, and intersection detection. Features include adaptive subdivision, fixed-step sampling, and robust handling of degenerate cases. The code is well-encapsulated with minimal dependencies (only ImGui) and could be extracted for use in any project requiring bezier curve operations.
Provides essential vector and geometry operations for ImGui applications including vector arithmetic, length calculations, rectangle intersection tests, line-rectangle closest point calculations, and easing functions. The header-only implementation has no external dependencies beyond ImGui and offers performance-oriented utilities commonly needed in GUI development.
Manages a contained ImGui context to enable zoom and pan functionality within an ImGui window. Handles coordinate transformation, input event forwarding, zoom smoothing, and reset functionality. The component cleanly separates the concerns of viewport management from application logic and could be reused in any ImGui-based project requiring a zoomable/pannable area.