#bindings #imgui #node #ui #context #editor #imnodes

sys imnodes-sys

Raw FFI bindings to imnodes

4 releases

0.2.2 Jan 14, 2024
0.2.1 Jan 14, 2024
0.2.0 Sep 5, 2023
0.1.0 Apr 19, 2023

#795 in GUI

29 downloads per month
Used in imnodes

MIT/Apache

5MB
14K SLoC

PowerShell 4K SLoC // 0.2% comments C++ 4K SLoC // 0.1% comments Lua 2K SLoC // 0.0% comments Visual Studio Project 1K SLoC Rust 839 SLoC // 0.0% comments Python 587 SLoC // 0.2% comments Perl 449 SLoC // 0.1% comments Shell 305 SLoC // 0.2% comments Ruby 87 SLoC Visual Studio Solution 65 SLoC Batch 41 SLoC // 0.3% comments C 27 SLoC // 0.6% comments BASH 10 SLoC // 0.3% comments Zsh 7 SLoC Bitbake 1 SLoC

Contains (DOS exe, 20KB) tls12-download.exe

imnodes-rs

Tests

These are bindings for imnodes using cimnodes for imgui-rs.

They are inspsired by implot-rs.

example image

docs

cargo doc --no-deps --open

TODO/ Ideas

  • add example with salsa or some other incremental computation lib
  • IO
    • all Mouse/ Modifier helpers

nice to have:

  • use Serde to make it possible to declare graphs and render them
    • load and save as well using imnode_* functions
  • add comments to everything
    • figure out good descriptions of coordinate systems
  • review types in unsafe code
    • especially -> &mut sys::Style

Example (see imnodes-wgpu-examples/src/hello_world.rs)

fn show(ui: &imgui::Ui, context: &mut imnodes::EditorContext) {
    let mut id_generator = context.new_identifier_generator();

    imnodes::editor(context, |mut editor| {
        editor.add_node(id_generator.next_node(), |mut node| {
            node.add_titlebar(|| ui.text("simple node :)"));

            node.add_input(
                id_generator.next_input_pin(),
                imnodes::PinShape::Circle,
                || ui.text("input"),
            );

            node.add_output(
                id_generator.next_output_pin(),
                imnodes::PinShape::QuadFilled,
                || ui.text("output"),
            );
        });
    });
}

Dependencies

~12MB
~215K SLoC