StarBeat / nged

A Node Graph EDitor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NGED: A Node Graph EDitor

This is the result of my attempt to make an easy to use, myself-friendly node graph editor.

Core components of this project are ngdoc.h (node graph document) and nged.h (node graph editor), and with this project comes with two demos, which in hope will give you some basic ideas of what they can do - if you are also looking for a node graph editor that is standalone, customizable, scriptable, efficient, beautiful, ergonomic and cross-platform.

  • visual s7 is lisp visualized in form of node graph, it looks like this: ngs7

  • pydemo is a functional python scripting environment, it looks like this: pydemo

What they share in common is the beautiful UI and friendly operations.

Features

Cross platform

Tested on:

  • Windows 10 x64
  • Windows 11 x64
  • Ubuntu 22 x64
  • Raspberry Pi OS Arm

Nice looking link paths

linkpath

dense or sparse, it's easy to keep track on the relationship of nodes and links:

path-eg1

path-eg2

Fuzzy search

fuzzy-search

Routers

router

Groups, Comments, Arrows and Tints

comment_and_tint

Subgraphs

subgraph

Multiple views on one graph

multiview

Focus

focus

// press F to focus selection; or with nothing selected, press F to focus the entire graph

Cut links with stroke

cut

// press Y to cut links

Drag links, Swap links

edit_link

// drag link with Shift pressed, the link will be swaped if the drop target has existing link

Find node

find_node

Select, add to selection, remove from selection

selection

Command palette

valign

Recursion (only for python demo)

recursion

Parmscript (only for python demo)

It's worth mention this other side project of mine: parmscript

With this, it's very easy to customize parameter interface on each node, and it can handle serialization / deserialization / evaluate to & from Python with no extra effort.

parmscript

Other

  • Undo, Redo
  • Copy, Paste
  • Read-only view
  • Headless (doc without UI and editor is fully functional)

Limits

  • One input pin can connect to at most one output pin. And I think this is the correct way - if you do want to connect multiple links into one input, you should always declare the logic between those multiple inputs, like or, and, merge &etc. - and by adding another node, this can be done.

Building

Requirements:

  • xmake
  • A C++17 compatible compiler, tested on
    • MSVC 2017
    • MSVC 2019
    • Clang 14
    • GCC 11.4
  • python & setuptools & pip, if you need the python binding and/or the pydemo

To build:

> xmake

to build with python:

> python setup.py build

or

> python -m pip install .

Options:

Graphic backend can be choosen between

  • DirectX 11 (default for windows)
  • DirectX 12
  • OpenGL 3
  • OpenGL 2 (default for non-windows)
  • Vulkan

to config:

> xmake f --backend=(dx11|dx12|gl3|gl2|vulkan)

Development

If you want to dive into the code, and/or make contribution, it's strongly adviced to use (neo|g)?vim editor with foldmethod=marker and foldmarker={{{,}}} set, otherwise the code look will likely to be not as tidy:

gvim

and please respect .editorconfig and .clang-format

tips: xmake project -k compile_commands can generate compile_commands.json for C++ LSPs.

To Make Your Own NodeGraph

Refer to demo/main.cpp as the starting point.

Basically, define your own NodeFactory, and off you go.

About

A Node Graph EDitor

License:Apache License 2.0


Languages

Language:C 68.2%Language:C++ 29.2%Language:Python 1.3%Language:Scheme 1.2%Language:Lua 0.1%