def run(self): import toolutils import soptoolutils activepane = toolutils.activePane(kwargs) if activepane.type() == hou.paneTabType.SceneViewer: # Get the current context. sceneviewer = toolutils.sceneViewer() # Create a SOP container. container = soptoolutils.createSopNodeContainer( sceneviewer, "curve_object1") # Create the curve. newnode = soptoolutils.createSopNodeGenerator( container, "curve", None) # Turn on the highlight flag so we see the SOPs selected output. newnode.setHighlightFlag(True) if sceneviewer.isCreateInContext(): newnode.setCurrent(True, True) sceneviewer.enterCurrentNodeState() toolutils.homeToSelectionNetworkEditorsFor(newnode) else: container.setCurrent(True, True) toolutils.homeToSelectionNetworkEditorsFor(container) activepane.setPwd(container.parent()) activepane.setCurrentState("objcurve") elif activepane.type() == hou.paneTabType.NetworkEditor: soptoolutils.genericTool(kwargs, "curve") else: raise hou.Error("Can't run the tool in the selected pane.")
def run(self): import toolutils import soptoolutils kwargs['bbox'] = hou.BoundingBox(-1.0, -1., -.0, 1.0, 1., .0) sphere = soptoolutils.genericTool(kwargs, 'circle') sphere.parm("type").set("poly")
def run(self): import toolutils import soptoolutils size = 4.0 kwargs['bbox'] = hou.BoundingBox(-size / 2.0, 0, -size / 2.0, size / 2.0, 0, size / 2.0) grid = soptoolutils.genericTool(kwargs, 'grid') grid.parm("sizex").set(size) grid.parm("sizey").set(size)
def run(self): import toolutils import soptoolutils rad = 0.5 kwargs['bbox'] = hou.BoundingBox(-rad, -rad, -rad, rad, rad, rad) sphere = soptoolutils.genericTool(kwargs, 'sphere') sphere.parm("type").set("polymesh") sphere.parm("radx").set(rad) sphere.parm("rady").set(rad) sphere.parm("radz").set(rad)
def run(self): import toolutils import soptoolutils kwargs['bbox'] = hou.BoundingBox(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5) sphere = soptoolutils.genericTool(kwargs, 'box') sphere.parm("type").set("polymesh") sphere.parm("divrate1").set(2) sphere.parm("divrate2").set(2) sphere.parm("divrate3").set(2)
def run(self): import toolutils import soptoolutils orad = 0.5 irad = 0.25 kwargs['bbox'] = hou.BoundingBox(-orad - irad, -irad, -orad - irad, orad + irad, irad, orad + irad) torus = soptoolutils.genericTool(kwargs, 'torus') torus.parm("type").set("poly") torus.parm("radx").set(orad) torus.parm("rady").set(irad)
def run(self): import toolutils import soptoolutils rad = 0.5 height = 1.0 kwargs['bbox'] = hou.BoundingBox(-rad, -height / 2., -rad, rad, height / 2., rad) tube = soptoolutils.genericTool(kwargs, 'tube') tube.parm("type").set("poly") tube.parm("radscale").set(rad) tube.parm("height").set(height)
def run(kwargs): selNodes = hou.selectedNodes() for node in selNodes: if not hou.NodeType.category(node.type()) == hou.sopNodeTypeCategory(): hou.ui.displayMessage("Please select SOP-Level Nodes") return mrg = soptoolutils.genericTool(kwargs, 'merge') for x, node in enumerate(selNodes): mrg.setNextInput(node) mrg.setDisplayFlag(True) mrg.setRenderFlag(True)
def run(kwargs): #Get Selected Node selNodes = hou.selectedNodes() #Create Node mrg = soptoolutils.genericTool(kwargs, 'polyextrude::2.0') #Set Parms curNode = kwargs["pane"].currentNode() curNode.parm('xformfront').set("1") curNode.parm('xformspace').set("global") #Set Display Flag mrg.setDisplayFlag(True) mrg.setRenderFlag(True)
def run(self): import soptoolutils soptoolutils.genericTool(kwargs, 'polyfill')
# groupname.py # Input code for group node in Houdini to auto name group # based on node name ######################################################### # Import relevant libs import toolutils import soptoolutils # Set var to identify group node creation grp = soptoolutils.genericTool(kwargs, 'groupcreate') # Set parm to auto name the group based on the node name grp.parm("groupname").set("`opname('.')`")
import soptoolutils selection = None if type(kwargs['pane']) is hou.SceneViewer: viewer = kwargs['pane'] selection = viewer.selectGeometry(geometry_types=(hou.geometryType.Primitives, hou.geometryType.Edges,)) n = soptoolutils.genericTool(kwargs, '$HDA_NAME') if selection is not None: selstring = '' for sel in selection.selectionStrings(): selstring += sel selstring += ' ' if len(selstring) != 0: geotype = selection.geometryType() if geotype == hou.geometryType.Edges: n.setParms({'group':selstring, 'grouptype':'edges'}) if geotype == hou.geometryType.Primitives: n.setParms({'group':selstring, 'grouptype':'prims'})
import soptoolutils # Store nodes that are selected selNodes = hou.selectedNodes() # Creates the merge node mrg = soptoolutils.genericTool(kwargs, 'merge') # Use a for loop and store each node in an iterable format using enumerate for x, node in enumerate(selNodes): # Test the printing of selected nodes # node.name() # print node.name() # Attached a wire from each selected node to the new merge node # stored in the mrg variable mrg.setNextInput(node) # Sets the display and render flags for merge mrg.setDisplayFlag(True) mrg.setRenderFlag(True)