GetNodeGraphPosition()
Purpose #
Retrieves the location (X and Y position) of a node within the nodegraph.
Syntax #
Array GetNodeGraphPosition();
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);
}