Advertisement
yashpolke

connect_all_nodes

May 21st, 2015
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. import hou
  2. import math
  3.  
  4. def main():
  5. ###**** First we will select the number of nodes we wan to connect and then basically use this as a list to connect all of them ****###
  6.     limit = len(hou.selectedNodes())
  7. ####**** Then we create a list if the nodes w.r.t direction and then later sort them based on direction and connect them ****####
  8.     yPos = []
  9.     for aNode in hou.selectedNodes():
  10.         yPos.append([aNode.position()[1], aNode])
  11.         yPos = sorted(yPos)
  12.     for i in xrange(len(yPos) - 1):
  13.         yPos[i][1].setInput(0,yPos[i+1][1])
  14.     for yNode in hou.selectedNodes():
  15.         yFit = math.floor(yNode.position()[0])
  16.         mean = (yNode.position()[1]) - (yFit) / (limit)
  17.     xPos = []
  18.     for xNode in hou.selectedNodes():
  19.         xPos.append([xNode.position()[1], xNode])
  20.         xPos = sorted(xPos)
  21.     for i in xrange(len(xPos) - 1):
  22.         meanPos = math.floor(((xPos[i+1][0]) + (xPos[i][0])) / (2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement