Seneral / Node_Editor_Framework

A flexible and modular Node Editor Framework for creating node based displays and editors in Unity
https://nodeeditor.seneral.dev
MIT License
2.01k stars 415 forks source link

Connections Curves Improvement #111

Closed Nopey closed 7 years ago

Nopey commented 7 years ago

I felt the need to do something small to get acquainted with this codebase, so I made the curves prettier. They used to snap to a different angle when you crossed the space above or below a knob with the mouse while drawing a new connection from it. Comparison of curves: (Blue is improved, Red is previous. Top right connection is most important change) screenshot 2016-12-24 11 48 47

TODO: Move the 100f in Node.cs and NodeEditor.cs to a single location somewhere. Either fully remove NodeEditorGUI.GetSecondConnectionVector or re-enable it. TLDR: I made the connections act a little more like blenders, and have stopped using the NodeEditorGUI.GetSecondConnectionVector function

Seneral commented 7 years ago

Hi, thanks for the improvement! Looks way better now indeed, there were some behaviours I didn't like though, f.E. when a node input is right above a node output (offset.x is 0) then the connection is completely straight. So, I made some more adjustements based on yours and added three parameters (including your 100f). Basically it now also has a minimum direction when offset is stretched in one direction but is sill straight when positions are very close to each other;) Here's a test showing all positions: curvetestanim Will update code right now, I also wrapped everything neatly in parameters and a function in NodeEditorGUI...

Seneral commented 7 years ago

You want to add anything or should I merge?