Notch Notch Manual 0.9.23
 Light | Dark
GetNodeGraphPosition()

GetNodeGraphPosition()

Purpose #

Retrieves the location (X and Y position) of a node within the nodegraph.

Syntax #

Array GetNodeGraphPosition();
returns The X and Y position of the node in the nodegraph.

Example #

function SortNodesByPosition(a, b)
{
    var nodeAGraphXY = a.GetNodeGraphPosition();
    var nodeBGraphXY = b.GetNodeGraphPosition();
    if (nodeAGraphXY[1] > nodeBGraphXY[1])
        return 1;
    else if (nodeAGraphXY[1] == nodeBGraphXY[1] && nodeAGraphXY[0] > nodeBGraphXY[0])
        return -1;
    return 0;
}

function Update()
{ 
    layer = Document.GetLayer(0);
    nodeList = layer.GetNodes();
    nodeList.sort(SortNodesByPosition);
}