Nelarius / imnodes

A small, dependency-free node editor for dear imgui
MIT License
1.97k stars 241 forks source link

Add picture inside of the node #113

Closed aabilityuk closed 2 years ago

aabilityuk commented 3 years ago

Hi, first of all I want to thank the developers for efforts and spent time for lib dev!

Is it possible to add picture to the node background and custom setup the pins distance and positions inside of the node?

If not, is there any plans in future to add this feature?

Thank you!

Nelarius commented 2 years ago

Hi @aabilityuk !

Sorry about the slow response.

Images can be embedded in the node using ImGui::Image(), but that includes the image as a part of the node UI. Adding a custom background image to the node background isn't supported or planned at the moment, but I'm not against reviewing & merging PRs for the feature.

The following pin customization is supported.

Pin offset

// Adjust the horizontal offset of the pin
ImNodes::GetStyle().PinOffset = 10.0f;
Screenshot 2021-09-12 at 12 42 09

Pin geometry

You can select between six different pin geometries, as enumerated in ImNodesPinShape_. These are passed as an argument to ImNodes::BeginInputAttribute and ImNodes::BeginOutputAttribute.

Screenshot 2021-09-12 at 12 45 47