Пример #1
0
def groupSelectedById():
    """ Promote all material parameters from the Material SHOP
        to the node.
    """
    sel = hou.selectedNodes()
    for n in range(0,len(sel)):
        current = sel[n]
    # Obtain a geometry selection
    geo_types = (hou.geometryType.Points, )
    selection = scene_viewer.selectGeometry("Select the points to group by 'id' and press Enter to complete",
        geometry_types = geo_types,
        allow_obj_sel = True)
    # The following will raise an exception if nothing was selected.
    if len(selection.nodes()) == 0:
        raise hou.Error("Nothing was selected.")
       
# Create a new SOP container with the merged geometry 
    container = soptoolutils.createSopNodeContainer(scene_viewer, "extract_object1")
    merge_sop = selection.mergedNode(container, nodetypename, True, True)
# Turn back on the display flag for merged nodes
    for sop in selection.nodes():
        sop.parent().setDisplayFlag(True)

# Change our viewer to the new object
    scene_viewer.setPwd(merge_sop.parent())
    merge_sop.setDisplayFlag(True)
    merge_sop.setRenderFlag(True)
    merge_sop.setHighlightFlag(True)
    merge_sop.setCurrent(True, True)
    merge_sop.moveToGoodPosition()
    toolutils.homeToSelectionNetworkEditorsFor(merge_sop)
    scene_viewer.enterCurrentNodeState()
Пример #2
0
 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.")
Пример #3
0
def groupSelectedById():
    """ Promote all material parameters from the Material SHOP
        to the node.
    """
    sel = hou.selectedNodes()
    for n in range(0, len(sel)):
        current = sel[n]
    # Obtain a geometry selection
    geo_types = (hou.geometryType.Points, )
    selection = scene_viewer.selectGeometry(
        "Select the points to group by 'id' and press Enter to complete",
        geometry_types=geo_types,
        allow_obj_sel=True)
    # The following will raise an exception if nothing was selected.
    if len(selection.nodes()) == 0:
        raise hou.Error("Nothing was selected.")

# Create a new SOP container with the merged geometry
    container = soptoolutils.createSopNodeContainer(scene_viewer,
                                                    "extract_object1")
    merge_sop = selection.mergedNode(container, nodetypename, True, True)
    # Turn back on the display flag for merged nodes
    for sop in selection.nodes():
        sop.parent().setDisplayFlag(True)

# Change our viewer to the new object
    scene_viewer.setPwd(merge_sop.parent())
    merge_sop.setDisplayFlag(True)
    merge_sop.setRenderFlag(True)
    merge_sop.setHighlightFlag(True)
    merge_sop.setCurrent(True, True)
    merge_sop.moveToGoodPosition()
    toolutils.homeToSelectionNetworkEditorsFor(merge_sop)
    scene_viewer.enterCurrentNodeState()
Пример #4
0
def extractChildren():
	scene_viewer = toolutils.sceneViewer()
	cwd = scene_viewer.pwd()
	selected = [child for child in cwd.children() if child.isSelected()]
	extractNode = hou.node(cwd.path()).createNode("geo", "extract_node", run_init_scripts=False )	# create empty geo node
	merge_sop = extractNode.createNode("object_merge")
	
	num_objs = len(selected)
	merge_paths_dict = {}
	i = 1
	for sel in selected:
		merge_paths_dict["objpath"+str(i)] = sel.path() + "/OUT"
		i = i + 1		
	
	parm_dict = {"numobj":num_objs, "xformtype":1}
	merge_sop.setParms(parm_dict)
	merge_sop.setParms(merge_paths_dict)
		
	scene_viewer.setPwd(merge_sop.parent())
	toolutils.homeToSelectionNetworkEditorsFor(merge_sop)	
	extractNode.setColor(hou.Color((0,0,0)))
	extractNode.moveToGoodPosition()
Пример #5
0
def extractChildren():
    scene_viewer = toolutils.sceneViewer()
    cwd = scene_viewer.pwd()
    selected = [child for child in cwd.children() if child.isSelected()]
    extractNode = hou.node(cwd.path()).createNode(
        "geo", "extract_node", run_init_scripts=False)  # create empty geo node
    merge_sop = extractNode.createNode("object_merge")

    num_objs = len(selected)
    merge_paths_dict = {}
    i = 1
    for sel in selected:
        merge_paths_dict["objpath" + str(i)] = sel.path() + "/OUT"
        i = i + 1

    parm_dict = {"numobj": num_objs, "xformtype": 1}
    merge_sop.setParms(parm_dict)
    merge_sop.setParms(merge_paths_dict)

    scene_viewer.setPwd(merge_sop.parent())
    toolutils.homeToSelectionNetworkEditorsFor(merge_sop)
    extractNode.setColor(hou.Color((0, 0, 0)))
    extractNode.moveToGoodPosition()
Пример #6
0
#
# Create Simulation
#
debris = container.parent().createNode('geo', 'debris', False)
debris.moveToGoodPosition()

dopimport = debris.createNode('dopimport')
dopimport.parm('doppath').set(dopnet.path())
dopimport.parm('objpattern').set('popobject*')
dopimport.parm('importstyle').set('fetch')
dopimport.moveToGoodPosition()


attribrandomize = debris.createNode('attribrandomize')
attribrandomize.setName('randomize_pscale',unique_name=True)
attribrandomize.parm('name').set('pscale')
attribrandomize.parm('minx').set(0.5)
attribrandomize.parm('scale').set(0.035)

attribrandomize.setInput(0,dopimport)
attribrandomize.setDisplayFlag(1)
attribrandomize.setRenderFlag(1)


# Change our viewer to the dop network
scene_viewer.setPwd(popsolver)
popsolver.setCurrent(True, True)
toolutils.homeToSelectionNetworkEditorsFor(popsolver)
scene_viewer.enterCurrentNodeState()