Skip to content

Commit

Permalink
move waypoints in TPL to position
Browse files Browse the repository at this point in the history
Imported TPLs leave behind any waypoints in the top level if position is non-zero. I wrote a lil loop to scan the top level nodes's ports and move any waypoints along with them
  • Loading branch information
waterwheels authored and mchaptel committed Jan 18, 2022
1 parent 2199a86 commit 8eec36f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions openHarmony/openHarmony_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2834,6 +2834,24 @@ $.oGroupNode.prototype.importTemplate = function( tplPath, destinationNodes, ext
backdrops[i].x += nodePosition.x;
backdrops[i].y += nodePosition.y;
}

// move waypoints in the top level of the template
for (var i in _nodes) {
var nodePorts = _nodes[i].outPorts;
for (var p = 0; p < nodePorts; p++) {
var theseWP = waypoint.childWaypoints(_nodes[i], p);
if (theseWP.length > 0) {
for (var w in theseWP) {
var x = waypoint.coordX(theseWP[w]);
var y = waypoint.coordY(theseWP[w]);
x += nodePosition.x;
y += nodePosition.y;
waypoint.setCoord(theseWP[w],x,y);
}
}
}
}

}

this.$.endUndo();
Expand Down

0 comments on commit 8eec36f

Please sign in to comment.