alelievr / NodeGraphProcessor

Node graph editor framework focused on data processing using Unity UIElements and C# 4.6
https://github.com/alelievr/NodeGraphProcessor/projects/2
MIT License
2.34k stars 387 forks source link

Node to View Interface #215

Open dannymate opened 2 years ago

dannymate commented 2 years ago

I added ViewDelegates class that sits in a BaseNode which the NodeView assigns Actions/Funcs relating to things like get/set the current size or position. I did this because I wanted to generate a graph on the fly but I couldn't get the size of the node properly. But it's there anyway to be expanded upon if there's anything in the view that's required to enable certain functionalities.

If the NodeView hasn't initialised yet it modifies the initialposition.

Added the ViewDelegates into BaseNode as View so: baseNode.View.GetPosition(). baseNode.View.SetPosition(Vector2) baseNode.View.GetSize() baseNode.View.GetRect() baseNode.View.SetRect(Rect)

dannymate commented 2 years ago

I can foresee a possible bug in the Node Init where if the position has been changed from the initial position to 0,0 then it would move back to the initial position when opening a saved graph.