Click Here to view all the amazing entries to Rookie Awards 2024
Python - SpeedTree to Houdini Tool
Share

Python - SpeedTree to Houdini Tool

Keiran Froom
by keiranfroom on 6 Apr 2019

A shelf tool developed with Python to enable an easy workflow between SpeedTree and Houdini Wire Dynamics.

0 2337 0
Round of applause for our sponsors

SAMPLE OF SCRIPT - FOR USE IN A SHELF TOOL
nullNodes = []
ancestors = []
nDict = {}
#Grab selected
selNodes = hou.selectedNodes()
first = selNodes[0].children()
first[0].setCurrent(True,True)
selNodeNew = hou.selectedNodes()
#Create init Node Tree
BranchNode = hou.node('/obj/').createNode('geo','Hierarchy_Setup', run_init_scripts=False)
def getNextBranch():
global selNodeNew
#for loop to select next branch
for n in enumerate(selNodeNew):
selNodeNew = n[1].outputs()
ancestor = len(n[1].inputAncestors())
ancestors.append(ancestor)
nDict[n[1]] = ancestor
getNextBranch()
getNextBranch()
#Create Merge Node Two For Each Heirachy
for i in range((max(ancestors)+1)):
mrgNodeAnc = hou.node('/obj/Hierarchy_Setup').createNode('merge',('Branch_'+ str(i)))
for p, y in nDict.items():
if y == i:
objMrgTwo = hou.node('/obj/Hierarchy_Setup').createNode('object_merge')
pathName = objMrgTwo.name()
objMrgTwoPath = hou.parm('/obj/Hierarchy_Setup/'+pathName+'/objpath1')
objMrgTwoPath.set('/obj/'+selNodes[0].name()+'/'+str(p))
objMrgTwo.parm('xformtype').set(1)
mrgNodeAnc.setNextInput(objMrgTwo)
#Layout Children
BranchNode.layoutChildren()
#Return to obj level && set sim_Splines as Current
objLevel = hou.node('obj/Hierarchy_Setup')
objLevel.setCurrent(True,True)


Comments (0)

This project doesn't have any comments yet.