tomwyn Posted March 2, 2015 Share Posted March 2, 2015 HI all, My question: Can I 'extract contents' of multiple alembic container nodes simultaneously? I have an imported alembic geometry sequence, and I want to group certain areas of the geo for use in various dops sims. I loaded the alembic as 'Houdini geometry', however, inside the alembic at obj level, I have hundreds of individual alembic 'container' nodes that have individual Houdini geo nodes inside them. This would be fine if it was just a few nodes, as I can obviously rmb > extract contents. However this doesn't work for me on multiple nodes. Is there some-kind of shelf tool/script I can run? Or a certain check box on alembic import I may have missed that will give me 100% Houdini geo nodes? Sorry if this is a bit of a layperson question - One of the pitfalls of being self taught Thanks! (H 14.0.201.13) Quote Link to comment Share on other sites More sharing options...
gui Posted March 2, 2015 Share Posted March 2, 2015 well, I had the same problema and created a shelf tool. Just create a new tool and paste this script. Hope it still works. ----- import hou # selection functions # this one selects node objs and textures and return the selection def importer_selectNodeObjsNTextures(): import toolutils # Get active sceneViewer sViewer = toolutils.sceneViewer() # Ask user select nodes to switch tex selection = sViewer.selectObjects('Select nodes to switch tex, press enter to confirm', allowed_types=('geo',), allow_multisel=True) # Check that selection wasnt empty if selection == (): hou.ui.displayMessage('Nothing selected, terminating tool', severity=hou.severityType.Error) return (None) selection[0].setSelected(0, True) # Ask user select the parent no to generate the inverse matrix texture = hou.ui.selectNode() #parent = sViewer.selectObjects('Select parent, press enter to confirm', allowed_types=('*',), allow_multisel=False) # Check that selection wasnt empty if texture == (): hou.ui.displayMessage('Nothing selected, terminating tool', severity=hou.severityType.Error) return (None) return (selection, texture) # this one select node objs and return the selection def importer_selectNodeObjs(): import toolutils # Get active sceneViewer sViewer = toolutils.sceneViewer() # Ask user select nodes selection = sViewer.selectObjects('Select nodes, press enter to confirm', allowed_types=("geo",), allow_multisel=True) # Check that selection wasnt empty if selection == (): hou.ui.displayMessage('Nothing selected, terminating tool', severity=hou.severityType.Error) return (None) return (selection) def importer_copyObjs(selection): if selection[0].parent() != None: geoName = 'NEW_' + selection[0].parent().name() else: geoName = 'newGeo' newGeo = hou.node('/obj').createNode('geo', geoName) newGeo.setColor(hou.Color((1, 1, 0))) newGeo.children()[0].destroy() # iterates throught selection to find for 'alembic' nodes and outputs a list with these nodes oldList = selection loop = 1 while loop == 1: outputList = [] alembicNum = 0 for obj in oldList: childNum = len(obj.children()) if childNum > 0: for child in obj.children(): outputList.append(child) if child.type().name() == 'alembic': alembicNum+=1 if obj.type().name() == 'alembic': outputList.append(obj) alembicNum+=1 oldList = outputList if len(outputList) == 0: print 'No alembic nodes in the selection' return if len(outputList) > 0 and len(outputList) == alembicNum: loop = 0 for sopFile in outputList: geo = sopFile.parent() grpNode = sopFile.createOutputNode('group', geo.name()) grpNode.parm('crname').set(geo.name()) xform = geo.worldTransform() xformNode = grpNode.createOutputNode('xform', 'parent_xform') xformNode.parmTuple('t').set(xform.extractTranslates('srt')) xformNode.parmTuple('r').set(xform.extractRotates('srt')) xformNode.parmTuple('s').set(xform.extractScales('srt')) xformNode.parmTuple('p').deleteAllKeyframes() xformNode.parmTuple('p').set((0, 0, 0)) #grpNode.setDisplayFlag(1) #grpNode.setRenderFlag(1) hou.copyNodesToClipboard([grpNode, sopFile, xformNode]) hou.pasteNodesFromClipboard(newGeo) grpNode.destroy() xformNode.destroy() # connect all groups to a merge node mergeAll = newGeo.createNode('merge') i = 0 for child in newGeo.children(): if child.type().name() == 'xform': mergeAll.setInput(i, child) i+=1 mergeAll.setDisplayFlag(1) mergeAll.setRenderFlag(1) outputGeo = mergeAll.createOutputNode('rop_geometry', 'Output_geo') return outputGeo importer_copyObjs(importer_selectNodeObjs()) Quote Link to comment Share on other sites More sharing options...
tomwyn Posted March 2, 2015 Author Share Posted March 2, 2015 Hey gui, Thanks so much for that! It doesn't work straight out of the box, but certainly enough here for me to get my chops around & get something going! Quote Link to comment Share on other sites More sharing options...
gui Posted March 2, 2015 Share Posted March 2, 2015 Hey gui, Thanks so much for that! It doesn't work straight out of the box, but certainly enough here for me to get my chops around & get something going! What doesnt work? If you can share some hip, I will fix it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.