GetNodeGraphPosition()
Updated: 4 Dec 2023
Updated: 4 Dec 2023
Retrieves the location (X and Y position) of a node within the nodegraph.
Array GetNodeGraphPosition();
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);
}