To make the nodes moveable took me a while to work out. What I did though, was in my BaseNode class (thats the class that represents a node as a whole, similiar to BaseObject in C4D SDK), I stored and X and Y location, and it’s width and height.
Then using an VB.NET MouseMove event ([i]an event that's called everytime the mouse has moved, i'm not familiar with c++ window programming so not sure how this is done[/i]) I would loop through an array of BaseNodes, and execute a boundary checking function in there. It was more of brute force check, but it worked. It might have been slower with many many nodes but I never got that far to test it out.
Note - I can't remember [i]exactly[/i] how I did it, Don't have the code available no more
PSUEDO(ish) EXAMPLE
class BaseNode
{
_x
_y
_width
_height
public:
Bool CheckBoundary(MousePositionX, MousePointionY);
void SetLocation(X,Y);
}
BaseNode::CheckBoundary(MousePositionX, MousePointionY)
{
if(
(MousePositionX > _x) && (MousePositionX < (_x+_width)) &&
(MousePositionX > _y) && (MousePositionY < (_y+_height))
)
return TRUE
return FALSE;
}
BaseNode::SetLocation(X,Y)
{
_x=X;
_y=Y;
}
// General MouseMove event
OnMouseMove(MouseX,MouseY)
{
for (int i =0; i < NodeCount; i++)
{
if(NodeArray[i].CheckBoundary(MouseX,MouseY))
{
// ** Mouse cursor is in Nodes boundary **
// Check to see if mouse button is held down
if( MouseButtonPressed())
{
// Set new location of node
NodeArray[i].SetLocation(MouseX,MouseY);
}
}
}
// Update workspace
RefreshDisplay();
}
The RefreshDisplay() method would simply loop through all the nodes, draw all the nodes using the BaseNode location variables (Infact I had a function BaseNode::Draw()) then I would draw the connecting lines.
The Connecting lines are simple bezier curves with 2 control points arranged so there’s no wierd bending effects.
http://www.cubic.org/~submissive/sourcerer/bezier.htm
That’sa good explanation

And no I’m not copying their MEL syntax… completely… hehehe…