hoffstadt / DearPyGui

Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
https://dearpygui.readthedocs.io/en/latest/
MIT License
13.31k stars 691 forks source link

NodeEditor : Prevent multiple link connections to an input attribute #2255

Closed EssenOH closed 10 months ago

EssenOH commented 10 months ago

Is your feature request related to a problem? Please describe. For the node connection cases with link, current DPG allows input connection from multiple nodes.

Describe the solution you'd like the node connections, it should support 1:N attribute connections, but it should not allow N:1 connections. if a node wants to get multiple inputs, each attribute should be a dedicated attribute and it should allow connecting with only single link.

image

v-ein commented 10 months ago

If I remember correctly, DPG itself doesn't add links, it only notifies your program that the user dragged a link onto an attribute - by calling a callback provided by you. Can't you just ignore excessive link calls in your callback? That is, instead of creating the link right away, first check whether the attribute has already got another link.

EssenOH commented 10 months ago

Gotcha!... thanks for your quick insight I fixed it with adding a check routine whether the input attribute is already occupied or not.