Пример #1
0
    def copy(self):
        """
            Read the selected nodes and do checks to see if there is anything we want to flag to the user.
            then pass the data to the write function.
            
        """
    
        lockedAssets = False

        # Get selected nodes and check if it's a locked asset.
        for node in hou.selectedNodes():
        
            if self.isLocked(node):
        
                lockedAssets = True
                break
            
            # see if the selected node has any children and if so also check them for being locked.
            for childNode in node.allSubChildren():
            
                if self.isLocked(childNode):
        
                    lockedAssets = True
                    break
        
        # If we found a locked assets lets tell the user and we can start doing the writing.
        if lockedAssets:
        
            hou.ui.displayMessage("you have a locked Node in your selection. the file will be saved but the data of that node will be lost.")
        
        
        code = ""
        
        for _node in hou.selectedNodes():
                            
            code += hou.hscript("opscript -r -b " + _node.path())[0]   

        # Nasty Hack we need to do for VopSop. seems that the normal method of writing out the opscript method gives us
        # a problem where the settings will be lost because the vop's inside will automatically override the settings.
        # So we will get the settings for the VopSop and add it to the end just to make sure there being set! Damn SESI

        if self.needVopFix()[0]:

            for _node in self.needVopFix()[1:]:
                
                if not self.isVop(_node.parent()):
                    
                    addCode = hou.hscript("opscript -b " + _node.path())[0]
                    
                    if "opspareds" in addCode:
			
			asCode = "opcf " + _node.parent().path() + "\nopspareds" + addCode.split("opspareds")[1]
			code += asCode
			

        self._write(code, self._copyFile)
Пример #2
0
def sopRopAndRead_MantraToAfanasy():
    sel = hou.selectedNodes()
    for n in range(0,len(sel)):
        current = sel[n]
        # if Mantra node selected
        if str(current.type().name()) == "ifd":
            af = current.createOutputNode("afanasy","af_" + current.name())
            af.setParmExpressions({"trange": "ch(\"../"+current.name()+"/trange\")"})
            af.setParmExpressions({"f1": "ch(\"../"+current.name()+"/f1\")", "f2": "ch(\"../"+current.name()+"/f2\")", "f3": "ch(\"../"+current.name()+"/f3\")"})
            #af.setParmExpressions({"take": "`chs(\"../"+current.name()+"/take\")`"})
            af.parm("take").set("`chs(\"../"+current.name()+"/take\")`")
            af.parm("platform").set("Linux")
            af.parm("enable_extended_parameters").set(1)
            af.parm("hosts_mask").set("tcp.*")
            af.setColor(hou.Color((0,0,0)))	
        
        #if Geometry node selected
        else:
            file_read = current.createOutputNode("file","file_read")
            rop_output = current.createOutputNode("rop_geometry","rop_geo")
            rop_output.setParmExpressions({"f1": "$RFSTART", "f2": "$RFEND"})
            rop_output.parm("alfprogress").set(1)
            #file_read.setParmExpressions({"file": "`chs(\"../"+rop_output.name()+"sopoutput\")`"})
            file_read.parm("file").set("`chs(\"../"+rop_output.name()+"/sopoutput\")`")
            rop_output.parm("sopoutput").set("$DATA/cache/$SCENENAME/`opname(\"..\")`/0000/`opname(\"..\")`.$F4.bgeo")
Пример #3
0
def hideSelected(hide):
    obj = hou.selectedNodes()
    for n in obj:
        if hide:
            n.setDisplayFlag(0)
        else:
            n.setDisplayFlag(1)
    def check(self):
        messageTitle = "Error Creating Image Planes"

        if not hou.selectedNodes():
            hou.ui.displayMessage("No Mantra ROP is Selected, Please make a selection to continue.", title = messageTitle)
            return False

        proceed = True
        for i in hou.selectedNodes():
            if not isinstance(i, hou.RopNode):
                print "%s is not a Rop Node" %i.name()
                proceed = False

        if not proceed:
            hou.ui.displayMessage("Please make sure you have 'only' Mantra ROP's selected.", title = messageTitle)
            return False
Пример #5
0
def keyRight(path):
    for node in hou.selectedNodes():
        m=None
        m=node.parm("Master")
        if m!=None:
            if m.eval()==path: return 1
    return 0
Пример #6
0
def main():
    sel_nodes = hou.selectedNodes()
    if len(sel_nodes) > 1:
        hou.ui.setStatusMessage("Single node slection is only available.",
                            severity=hou.severityType.Error)
        return

    elif sel_nodes[0].type().name() != 'geo':
        hou.ui.setStatusMessage("Geometry Network node is only available.",
        severity=hou.severityType.Error)
        return

    sel_cache = hou.ui.selectFile(title='Select BGEO cache')
    if len(sel_cache) == 0:
        hou.ui.setStatusMessage("Any cache file is not selected.",
                            severity=hou.severityType.Error)
        return


    if len(sel_nodes) == 1 and sel_nodes[0].type().name() == 'geo':
        print 'test'
        for node in sel_nodes:
            dlp = createFileLoader(sel_cache)
            node.setParms({'shop_geometrypath': dlp.path()})

    else:
        dlp = createFileLoader(sel_cache)
        crGeo = hou.node('/obj').createNode('geo', node_name='geo_dlp1', run_init_scripts=True)
        crGeo.setParms({'shop_geometrypath': dlp.path()})
        children = crGeo.children()
        for c in children:
            c.destroy()
    def get_selected_nodes_of_type(self, node_type = None):
        """
        Get list of selected Mantra nodes.
        """

        #node_type None
        if not (node_type):
            #log
            print('No node type given. Returning empty list')
            return []

        #selected_nodes_list
        selected_nodes_list = hou.selectedNodes()

        #matching_nodes_list
        matching_nodes_list = []

        #iterate and append
        for selected_node in selected_nodes_list:

            #selected_node_type
            selected_node_type = selected_node.type().name()

            #type matching
            if (selected_node_type == node_type):

                #append
                matching_nodes_list.append(selected_node)

        
        #return
        return matching_nodes_list
Пример #8
0
def add_to_selection(nodes, kwargs):
    """Extends the current node selection with 'nodes', according to
    the modifier keys in kwargs.

    no modifier:    replace selection
    shift:          add to selection
    ctrl:           remove from selection
    ctrl+shift:     intersect with selection
    """
    haz_shift = kwargs["shiftclick"] or kwargs['altclick']
    haz_ctrl = kwargs["ctrlclick"]

    current = set(hou.selectedNodes())
    sel = set(nodes)

    if haz_shift or haz_ctrl:
        # we got some modifier pressed
        if haz_shift:
            if haz_ctrl:
                # shift+ctrl: intersection
                sel = sel.intersection(current)
            else:
                # shift: union
                sel = sel.union(current)
        else:
            # ctrl: remove from selection
            sel = current.difference(sel)

    if sel is not None:
        hou.clearAllSelected()
        for n in sel:
            n.setSelected(True)
Пример #9
0
def nodes_to_clipboard(fullPaths=False):
    """Copies the names or full paths of selected nodes to the clipboard.
    """
    sep = '\n' if fullPaths else ' '
    nodes = hou.selectedNodes()
    text = sep.join([ n.path() if fullPaths else n.name() for n in nodes ])
    to_clipboard(text)
Пример #10
0
def clearAnimationTool():
    select_assets = hou.selectedNodes()
    if select_assets:
        for asset in select_assets:
            hasset.clearAnimation(asset)
    else:
        print "Please select a asset"
Пример #11
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()
def go():
    global checkout_window
    project = Project()
    environment = Environment()
    
    nodes = hou.selectedNodes()
    if len(nodes) == 1:
        #if selected node is digital asset
        if nodes[0].type().definition() is not None:
            asset = nodes[0]
            asset_name = nodes[0].type().name() #get name of asset
            index = asset_name.find("_main")
            asset_name = asset_name[:index]
            src = nodes[0].type().definition().libraryFilePath()
            current_user = environment.get_current_username()
            
            if asset_name in project.list_assets():
                body = project.get_asset(asset_name)
                
            if os.path.exists(src):
                if body is not None: 
                    if Element.DEFAULT_NAME in body.list_elements(Department.ASSEMBLY):
                        element = body.get_element(Department.ASSEMBLY, Element.DEFAULT_NAME)
                        element_path = element.checkout(current_user)
                        hou.hda.uninstallFile(src, change_oplibraries_file=False)
                        hou.hda.installFile(element_path)
                        asset.allowEditingOfContents()
                        hou.ui.displayMessage("Checkout Successful!", title='Success!')
            
    elif len(nodes) > 1:
        hou.ui.displayMessage("Only one node can be selected for checkout")
    else:
        checkout_window = CheckoutWindow(hou.ui.mainQtWindow(), [Department.LIGHTING, Department.FX])    
        checkout_window.finished.connect(checkout_shot)
Пример #13
0
def get_node_info():

    info = []
    # rop_list = hou.node('/out').allSubChildren()
    rop_list = hou.selectedNodes()
    if len(rop_list) == 0:
        return None

    arnold_rop_list = []

    for rop in rop_list:
        if rop.type().name() == "arnold":
            arnold_rop_list.append(rop)

    """
	for arnold_rop in arnold_rop_list:
		#arnold_rop.parm('execute').pressButton()
		ASS_FILE = hou.expandString(arnold_rop.evalParm('ar_ass_file'))
		print "ASSFILE:" + arnold_rop.evalParm('ar_ass_file')

	"""

    arnold_rop = arnold_rop_list[0]
    # arnold_rop.parm('execute').pressButton()
    info.append(hou.expandString(arnold_rop.parm("ar_ass_file").unexpandedString().replace("$F4", "####")))
    info.append(arnold_rop.path())

    return info
Пример #14
0
	def addSwitchForDebug(self, parentOp = ""):
		'''
		Add switch op to bypass selected node and expose switch input to the parent.
		'''
		
		currentSel = hou.selectedNodes()
		if len(currentSel) == 1:
			current = currentSel[0]
			opName = "switch"
			parentNode = hou.node(current.path()).parent()

			# Get inputs and outputs
			outNodes = current.outputs()
			inNodes = current.inputs()

			#Create switch
			newNode = current.createOutputNode(opName)
			newNode.setName(opName, True)
			newNode.setColor(Color.Default)

			# Set correct inputs to switch node
			if len(inNodes) > 0:
				newNode.setFirstInput(inNodes[0])
				newNode.setNextInput(current)

	
			# Insert switch between current and its immediate output node
			if len(outNodes) > 0:
				currentOut = outNodes[0]
				currentOut.setFirstInput(newNode)
			
			newNode.moveToGoodPosition()
Пример #15
0
def sopToAfanasyAndRead():
    #rop geometry via renderfarm
    sel = hou.selectedNodes()
    for n in range(0,len(sel)):
        current = sel[n]
        null = current.createOutputNode("null","BAKE")
        file_read = null.createOutputNode("file","file_read")
        file_read.parm("file").set("$DATA/cache/$SCENENAME/`opname(\"..\")`/0000/`opname(\"..\")`.$F4.bgeo")
        ropnet = current.parent().createNode("ropnet","rop")
        ropnet.parm("execute").hide(1)
        ropnet.parm("renderdialog").hide(1)
        geo = ropnet.createNode("geometry", "fetch_geo")
        af = geo.createOutputNode("afanasy","af_geo")
        geo.parm("soppath").set(geo.relativePathTo(null))
        geo.setParmExpressions({"f1": "$RFSTART", "f2": "$RFEND"})
        #file_read.parm("file").set("`chs(\"../"+ropnet.name()+"/"+geo.name()+"/sopoutput\")`")
        geo.parm("sopoutput").set("`chs(\"../../"+file_read.name()+"/file\")`")
        geo.parm("trange").set("normal")
        geo.parm("alfprogress").set(1)
        af.setParmExpressions({"trange": "ch(\"../"+geo.name()+"/trange\")"})
        af.setParmExpressions({"f1": "ch(\"../"+geo.name()+"/f1\")", "f2": "ch(\"../"+geo.name()+"/f2\")", "f3": "ch(\"../"+geo.name()+"/f3\")"})
        af.parm("take").set("`chs(\"../"+geo.name()+"/take\")`")
        af.parm("platform").set("Linux")
        af.parm("enable_extended_parameters").set(1)
        af.parm("hosts_mask").set("*")
        af.setColor(hou.Color((0,0,0)))
        #movenodes = []
        #movenodes.append(ropnet)
        #toolutils.moveNodesToGoodPosition(movenodes)
        #current.parent().layoutChildren(movenodes)
        null_pos = null.position()
        ropnet.setPosition(null_pos)
        ropnet.move([2,0.2])
def go():
    global publish_window
    global asset
    global asset_name
    global src
    global is_asset
    is_asset = False
    
    nodes = hou.selectedNodes()
    if len(nodes) == 1:
        if nodes[0].type().definition() is not None:
            is_asset = True
            asset = nodes[0]
            asset_name = nodes[0].type().name() #get name of asset
            index = asset_name.find("_main")
            if index > 0:
                asset_name = asset_name[:index]
            src = nodes[0].type().definition().libraryFilePath()
            publish_window = PublishWindow("", hou.ui.mainQtWindow(), [Department.ASSEMBLY])
        else:
            hou.ui.displayMessage("Node is not a digital asset")
            return
        publish_window.finished.connect(publish_hda)
    
    else:
        scene = hou.hipFile.name()
        publish_window = PublishWindow(scene, hou.ui.mainQtWindow(), [Department.LIGHTING, Department.FX])
        publish_window.finished.connect(publish_shot)
Пример #17
0
def getSelectedNode():
    """Returns the current node if EXACTLY ONE is selected
        Otherwise returns None"""
    node = None
    nodes = hou.selectedNodes()
    if len(nodes) == 1:
        node = nodes[0]
    return node
Пример #18
0
def createNullOut():
    sel = hou.selectedNodes()
    for n in range(0,len(sel)):
        current = sel[n]
        null_out = current.createOutputNode("null","OUT")
        null_out.setColor(hou.Color((0,0,0)))
        null_out.setDisplayFlag(1)
        null_out.setRenderFlag(1)
Пример #19
0
def switchXray():
    nodes=hou.selectedNodes()
    for n in nodes:
        isXray=hou.ObjNode.isUsingXray(n)
        if isXray:
            hou.ObjNode.useXray(n, 0)
        else:
            hou.ObjNode.useXray(n, 1)
Пример #20
0
def runRopInTerminal():
    writeNode = None
    try:
        hou.selectedNodes()[0]
    except IndexError:
        hou.ui.displayMessage(text = 'Select Rop Node')
    else:
        if len(hou.selectedNodes()) == 1:

            if hou.selectedNodes()[0].type().name() in ('dopio', 'filecache'):
            	writeNode = hou.node(''.join([hou.selectedNodes()[0].path(), '/render']))

            else:
                if hou.selectedNodes()[0].type().name() == 'rop_geometry':
                    writeNode = hou.selectedNodes()[0]

                else:
                    hou.ui.displayMessage(text = 'Select Rop Node')
        else:
            hou.ui.displayMessage(text = 'Select Rop Node')

    if writeNode != None:
        file = open("/tmp/file_tmp.py", "w")
        file.write("hou.hipFile.load(" + "'" + hou.hipFile.name() + "'" + ")\n")
    	file.write("writeNode = hou.node(" + "'" + writeNode.path() + "'" + ")\n")
    	file.write("writeNode.parm('execute').pressButton()\n")
    	file.close()

    	commands.getstatusoutput("xterm -e '/Volumes/Resources/Repository/sofrware/installed_software/houdini/13.0.338/bin/hython /tmp/file_tmp.py'")
    	os.remove("/tmp/file_tmp.py")
Пример #21
0
def make_parms():
	#we are going to make a lot of assumptions for now
	#one, you must name the node right to get an effect
	for n in hou.selectedNodes():
		
		ctype = strip_string( strip_digits(n.name()), 'COMP_')
		print ctype

		comp[ctype](n)
def CameraToExr():
  sel = hou.selectedNodes()
  if (len(sel) == 0):
      if hou.ui.displayMessage("Select Rop Node and retry!", buttons=("OK",)) == 0:
	  print "Eror"
  else: 
      for i in range(0,len(sel)):
		expstr = '`pythonexprs("hou.node(hou.parm('+"'camera').eval()).worldTransform().asTuple()"+'")``pythonexprs("hou.parm(hou.parm('+"'camera').eval()+'/focal').eval()"+'")``")"``pythonexprs("hou.parm(hou.parm('+"'camera').eval()+'/aperture').eval()"+'")`'
		sel[i].parm('vm_image_comment').set(expstr)
Пример #23
0
	def test_select_for_all_subchildren_with_type_name_light_and_name_box(self):
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).allSubChildren():
			if i.type().name().find("light") != -1 and i.name().find("box") != -1:
				i.setSelected(True)

		getSelected = list(hou.selectedNodes())
		for i in getSelected:
			i.setSelected(False)

		sq = sQuery.sQuery()
		sel = sq.find("t#*light*").filter("*box*").select()
		getSelectedSq = list(hou.selectedNodes())
		for i in getSelectedSq:
			i.setSelected(False)

		self.assertListEqual(getSelectedSq, getSelected)
    def main(self):
        '''operations to be run on the selected nodes list, when the tool is envoked'''

        self.selection = hou.ui.selectFromList(choices=self.imagePlaneList)
        self.check()

        for i in hou.selectedNodes():
            self.run(i)
            self.test(i)
Пример #25
0
def updateCdl():
	cdl_parm_name = 'cdlFile'
	nodes=hou.selectedNodes()
	if not nodes: raise Exception('It needs selected shop node. Please select node and try again')
	
	for n in nodes:
		nv = hou.node('/shop/__VARIABLES__')
		if not nv: raise Exception('Node __VARIABLES__ not found')
		_updateCdl(nv,n)
Пример #26
0
	def test_select_box1_from_viewport_selection(self):
		for i in hou.selectedNodes():
			i.setSelected(False)
			
		selData = []
		objPath = "/obj"
		for i in hou.node(objPath).children():
			if i.name().find("box1") != -1 or i.name().find("box2") !=-1 or i.name().find("box3") != -1:
				i.setSelected(True)

		selected = list(hou.selectedNodes())

		sq = sQuery.sQuery()
		sel = sq.selection().filter("*box*")

		for i in selected:
			i.setSelected(False)

		self.assertListEqual(sel._data, selected)
Пример #27
0
def selectionToCode():
    sel = hou.selectedNodes()
    if sel:
        code = []
        for s in sel:
            code.append(s.asCode())
        if len(code) == 1:
            return code[0]
        else:
            return '( %s )' % ', '.join(code)
Пример #28
0
def pbColorMe():
    from PyQt4 import QtGui
    
    color = QtGui.QColorDialog.getColor() # it'll return tuple of integer
    myColor = list(color.getRgb()[0:3]) # get rgb value without alpha and make that a list(from tuple)
    
    for c in range(0, 3):
        myColor[c] = float(myColor[c])/255 # convert int to float and fit color to 0 and 1
    
    if color.isValid():
        for node in hou.selectedNodes():
            cd = hou.Color(myColor)
            node.setColor(cd)
            
        if len(hou.selectedNodes()) == 0:
            hou.ui.setStatusMessage('Nothing selected!', severity=hou.severityType.Warning)
    
    if not color.isValid(): # if user closes dialog window
        hou.ui.setStatusMessage('You cancled it!')
Пример #29
0
def pbFindMe():    
    logpath = hou.hscriptExpression('$HIP')+'/pathlog.log'
    found = 0
    
    F = 'Find Me'
    R = 'Replace By'
    
    user_input = hou.ui.readMultiInput('Enter words to replace', (F, R), buttons=('Find', 'Replace', 'Cancle'), close_choice=2, title='pbFindMe')
    find = user_input[1][0]
    replace = user_input[1][1]
    
    if user_input[0] == 0:
        foundlist = '%s in %s\n\n\n' %(find, hou.hipFile.path()) + 'NODE' + ' '*46 + 'PARM' + '\n'
        for node in hou.node('/').allSubChildren():
            for parm in node.parms():
                template = parm.parmTemplate()
                if (template.type() == hou.parmTemplateType.String and
                        template.stringType() == hou.stringParmType.FileReference and
                        len(parm.keyframes()) == 0 and
                        parm.unexpandedString().find(find) >= 0):
                    path = parm.eval()
                    if path:
                        found += 1
                        foundlist += node.path() + ' '*(50 - len(node.path())) + parm.name()+'\n'
    
        if found:
            hou.ui.displayMessage(find + ' Found '+str(found)+' times !!!'+'\n\nLog file saved on: '+ logpath)
            logfile = open(logpath, 'w')
            logfile.write(foundlist)
            logfile.close()
            subprocess.Popen(['gedit',logpath])
            
        else:
            hou.ui.displayMessage('Can not find %s !!!' % find)
            
    if user_input[0] == 1:
        def fixFilePrefixes(node, from_prefix, to_prefix):
            for parm in node.parms():
                template = parm.parmTemplate()
                if (template.type() == hou.parmTemplateType.String and
                        template.stringType() == hou.stringParmType.FileReference and
                        len(parm.keyframes()) == 0 and
                        parm.unexpandedString().find(from_prefix) >= 0):
                    print 'Replacing %s to %s from:' %(find, replace), parm.path()
                    parm.set(parm.eval().replace(from_prefix, to_prefix))
                    
        nodes = hou.selectedNodes()
        if nodes:
            for node in nodes:
                fixFilePrefixes(node, find, replace)
                for child in node.allSubChildren():
                    fixFilePrefixes(child, find, replace)
        else:
            for node in hou.node('/').allSubChildren():
                fixFilePrefixes(node, find, replace)
Пример #30
0
def read_parms():
	for n in hou.selectedNodes():
		for p in n.spareParms():
			if not p.isAtDefault() :
				
				print p.description()
				print p.parmTemplate().type()
				if(p.parmTemplate().type() == hou.parmTemplateType.Menu):
					print p.menuLabels()[p.eval()]
				else:
					print p.eval()
Пример #31
0
    def _on_dialog_close(self, name, combo_text, init_sim, auto_version,
                         auto_publish, frame_range):
        # Call back from the Updater Dialog
        # Creates the actual nodes
        node_select = hou.selectedNodes()

        if node_select:
            out = hou.node('/out')

            for node in node_select:
                # Check if node is a sop node
                if node.type().category().name() == 'Sop':
                    # Check for name
                    if name == '':
                        node_name = node.name()
                    else:
                        node_name = name

                    # Create nodes
                    filenode = node.createOutputNode('sgtk_file', node_name)
                    filenode.setPosition(node.position())
                    filenode.moveToGoodPosition()
                    filenode.setColor(hou.Color(0.8, 0.1, 0.1))

                    outnode = out.createNode('sgtk_geometry', node_name)

                    filenode.parm('rop').set(outnode.path())
                    filenode.parm('rop').pressButton()

                    outnode.parm('soppath').set(filenode.path())
                    outnode.parm('types').set(combo_text)

                    outnode.parm('initsim').set(init_sim)
                    outnode.parm('auto_ver').set(auto_version)
                    outnode.parm('auto_pub').set(auto_publish)
                    outnode.parm('trange').set(frame_range)

                    # trigger refresh of path
                    outnode.parm('types').pressButton()
    def publish(self, value):
        self.name = value[0]
        sequence = self.project.get_sequence(self.name)
        if not sequence:
            sequence = self.project.create_sequence(self.name)
        if not sequence:
            qd.error("Bro, Stephanie really fumbled this one. No such sequence exists.")
            return
        self.element = sequence.get_element(Asset.LIGHTS)

        selection = hou.selectedNodes()
        if len(selection) != 1:
            qd.error(
                'Please select a single Houdini Digital Asset node to publish.')
            return
        if not selection[0].type().definition():
            qd.error(
                'Please select a Houdini Digital Asset node to publish.')
            return

        hda = selection[0]
        definition = hda.type().definition()
        definition.updateFromNode(hda)

        self.nodeName = "sequence_" + self.name + "_lights"
        menuName = "Sequence " + self.name + " Lights"
        self.savePath = os.path.join(self.element._filepath, self.nodeName + "_main.hda")

        definition.copyToHDAFile(self.savePath, new_name=self.nodeName, new_menu_name=menuName)

        publishes = self.element.list_publishes()
        publishes_string_list = ""
        for publish in publishes:
            label = publish[0] + " " + publish[1] + " " + publish[2] + "\n"
            publishes_string_list += label
        
        self.input = qd.HoudiniInput(
            parent=hou.qt.mainWindow(), title="Comment ", info=publishes_string_list)
        self.input.submitted.connect(self.comment_results)
Пример #33
0
def sendSettings(target_clientID, sender, tabTarget, tabClientType=None):

    settingsData = {}

    n = hou.selectedNodes()
    if not n:
        hou.ui.displayMessage("Nothing is selected")
        return False
    sel = n[0]

    settingsData["OTL_TYPE"] = sel.type().name()

    parmDict = {}
    parms = sel.parms()
    for p in parms:
        parmDict[p.name()] = p.eval()

    settingsData["OTL_PARMS"] = parmDict

    result = _sendData(target_clientID, sender, settingsData, "settings",
                       tabTarget)
    return [result, settingsData["OTL_TYPE"] + " settings"]
Пример #34
0
def embed_selected_hdas(kwargs):
    """Embed HDA definitions of selected nodes (interactive only).
    """
    defs = set()

    for s in hou.selectedNodes():
        d = s.type().definition()
        if d and d.libraryFilePath()!="Embedded":
            defs.add(d)

    defs = list(defs)

    if len(defs)==0:
        statmsg("No nodes with embeddable definitions were selected")
        return

    msg = "Embed the following HDA(s) into the current hip file?\n\n"
    msg += "\n".join([ "HDA:  %s\npath:  %s\n" % (d.nodeType().name(), d.libraryFilePath(), ) for d in defs ])

    if ynreq(msg, buttons=("Embed", "Cancel", )):
        for d in defs:
            d.copyToHDAFile("Embedded")
Пример #35
0
 def _replaceContent(self, index):
     try:
         nodes = hou.selectedItems()
     except:
         nodes = hou.selectedNodes()
     if len(nodes) == 0:
         QMessageBox.warning(self, 'cannot replace',
                             'selection is empty')
         return
     item = index.internalPointer()
     good = QMessageBox.warning(
         self, 'sure?',
         'confirm that you want to replace the content of selected item "%s". This operation can not be undone.'
         % item.name(),
         QMessageBox.Ok | QMessageBox.Cancel) == QMessageBox.Ok
     if not good:
         return
     try:
         item.setContent(hpaste.nodesToString(nodes))
     except CollectionSyncError as e:
         QMessageBox.critical(self, 'something went wrong!',
                              'Server error occured: %s' % str(e))
Пример #36
0
def exportSelectedGeom(mgExporter=True):
    selectedNodes = hou.selectedNodes()
    exportList = []
    for selectedNode in selectedNodes:
        childrenList = selectedNode.children()
        for child in childrenList:
            if child.name().startswith("EXPORT_") is True:
                if mgExporter is True:
                    outNodes = hou.node("/out").children()
                    for outNode in outNodes:
                        if child.name() == outNode.name():
                            exportList.append(child)
                else:
                    exportList.append(child)

    idx = 0
    for export in exportList:
        print("------------>>> Processing : " +
              "/".join([str(idx), str(len(exportList))]) + " - " +
              export.name())
    export.parm("render").pressButton()
    idx += 1
Пример #37
0
def extractTrans():
    s = hou.selectedNodes()
    if s:
        node = None
        out = None
        if s[0].type().category().name() == 'Object':
            node = s[0]
            out = hou.node('%s/__display_sop__' % node.path())
        if s[0].type().category().name() == 'Sop':
            out = s[0]
            node = out.parent()
        if node and out:
            pos = out.position()
            shift = node.createNode('timeshift')
            shift.setPosition(pos + hou.Vector2(-1, -1))
            shift.setInput(0, out)
            shift.parm('frame').deleteAllKeyframes()
            shift.parm('frame').set(1)

            black = hou.Color((0, 0, 0))

            static = node.createNode('null', 'STATIC')
            static.setPosition(pos + hou.Vector2(-1, -2))
            static.setInput(0, shift)
            static.setColor(black)

            animated = node.createNode('null', 'ANIMATED')
            animated.setPosition(pos + hou.Vector2(1, -2))
            animated.setInput(0, out)
            animated.setColor(black)

            transform = node.parent().createNode('extractgeo',
                                                 '%s_transform' % node.name())
            transform.setPosition(node.position() + hou.Vector2(2, 0))
            transform.parm('srcpath').set(static.path())
            transform.parm('dstpath').set(animated.path())
            node.setSelected(0)
            transform.setSelected(1)
    return None
Пример #38
0
def _mergeSelection(**kwargs):
    """Merge selected nodes and pick position."""
    if kwargs is not None:
        x = hou.selectedNodes()
        network_editor = kwargs['editor']
        try:
            # for whatever reason, I had to call two functions to get the correct
            # interactions to pick up, so the first call to selectPosition() doesn't do anything
            position = network_editor.selectPosition()
            position = network_editor.selectPosition()

            a = network_editor.pwd().createNode("merge")

            a.setPosition(position)
            if(len(x) > 0):
                for node in x:
                    a.setNextInput(node)

            network_editor.setCurrentNode(a)
            a.setSelected(True, clear_all_selected=1)
        except hou.OperationInterrupted:
            pass
def apply_preset(preset):
    selectedNodes = hou.selectedNodes()

    if len(selectedNodes) == 0:
        geo = hou.node('/obj').createNode('geo')
        for n in geo.children():
            n.destroy()
        selectedNodes = [geo]

    doSelected = len(selectedNodes) == 1

    for node in selectedNodes:
        node.setSelected(False)
        if node.type().name() == 'geo':
            matPath = node.parm('shop_materialpath').evalAsString()
            phxShaderNode = _setup_phx_material_node(node, hou.node(matPath))
            node.parm('shop_materialpath').set(phxShaderNode.parent().path())
            matPath = node.parm('shop_materialpath').evalAsString()
            cacheNode = _setup_phx_cache_node(node)
            _set_phx_presets(preset, phxShaderNode, cacheNode)
            if doSelected:
                cacheNode.setSelected(True)
Пример #40
0
def openFolderFromSelectedNodes(ns=hou.selectedNodes()):

	chooselist = []
	choosedict = {}

	for n in ns:
		getlist,getdict = getFolderParms(n)
		chooselist += getlist
		choosedict.update(getdict)

	#print choosedict,chooselist

	if len(chooselist)>0:
		choose = hou.ui.selectFromList(chooselist, message='Select Parms to bake key')

		for i in choose:
			#print str(chooselist[i])
			foloderpath = choosedict[chooselist[i]]
			if os.path.exists(foloderpath):
				openFolder(foloderpath)
			else:
				print '{} is does not exists.'.format(foloderpath)
Пример #41
0
def execute():
    wrangleClr = hou.Color((1, 0.8, 0.0))
    sopRopClr = hou.Color((0.4, 1, 0.4))
    dopClr = hou.Color((0.4, 1, 1))
    vopClr = hou.Color((1, 1, 0.6))
    objMergeClr = hou.Color((0, 0.6, 1))
    nullClr = hou.Color((0.6, 0.6, 1))
    subnetClr = hou.Color((0.867, 0, 0))
    geoClr = hou.Color((0, 0.267, 0))
    geoFxClr = hou.Color((0.4, 1, 0.4))
    geoRenClr = hou.Color((0.8, 1, 0.8))

    clrSet = [["attribwrangle", wrangleClr], ["volumewrangle", wrangleClr],
              ["solver", dopClr], ["dopnet", dopClr],
              ["object_merge", objMergeClr], ["attribvop", vopClr],
              ["volumevop", vopClr], ["subnet", subnetClr]]

    ### for AL
    clrSet.extend([["cachewrite", sopRopClr], ["cacheread", sopRopClr]])
    ### for IE
    clrSet.append(["ieSopReader", sopRopClr])

    #######################
    currentNode = hou.selectedNodes()

    for node in currentNode:
        #print node.type().name()
        for eachClr in clrSet:
            if node.type().name() == eachClr[0]:
                node.setColor(eachClr[1])

        if node.type().name() == "geo":
            if node.name().find("FX") != -1:
                node.setColor(geoFxClr)
            elif node.name().find("REN") != -1:
                node.setColor(geoRenClr)
            else:
                node.setColor(geoClr)
    def addScriptBlock(self):
        """ ノードにスクリプトのテキストブロックと実行ボタンを追加する """

        script_block_prefix = 'scriptblock_'
        script_folder_label = 'Scripts'

        for node in hou.selectedNodes():
            group = node.parmTemplateGroup()

            # find 'Scripts' folder
            folder = group.findFolder(script_folder_label)

            if not folder:
                folder = hou.FolderParmTemplate(script_block_prefix + 'folder',
                                                script_folder_label)
                group.addParmTemplate(folder)

            # add snipet
            index = 0
            while group.find(script_block_prefix + 'snipet_' + str(index)):
                index += 1

            snipet = hou.StringParmTemplate(
                script_block_prefix + 'snipet_' + str(index), 'Python Script',
                1)
            snipet.setTags(dict(editor='1', editorlang='python'))
            snipet.setDefaultValue(("# node = kwargs['node']", ))
            group.appendToFolder(script_folder_label, snipet)

            # add execute button
            button = hou.ButtonParmTemplate(
                script_block_prefix + 'button_' + str(index), 'Exec')
            button.setScriptCallback(
                "exec(kwargs['node'].parm('{}').eval())".format(snipet.name()))
            button.setScriptCallbackLanguage(hou.scriptLanguage.Python)
            group.appendToFolder(script_folder_label, button)

            node.setParmTemplateGroup(group)
Пример #43
0
    def run(self):
        global showWindowsMuti
        strNumberarr = hou.ui.readInput('Devide catch number',
                                        buttons=['Ok', 'Cancle'])
        strNumber = strNumberarr[1]
        if strNumberarr[0] == 1:
            return 0
        if strNumber == "":
            return 0

        intNumber = 1
        try:
            intNumber = int(strNumber)
            if intNumber > 10:
                print "warning: Request number is too large, may affect the performance of the machine, it is recommended within 10"
            if intNumber > 30:
                intNumber = 30
                print "warning: Too many requests have been changed to 30 "
            elif intNumber <= 0:
                intNumber = 5
                print "Bad request has been changed to 5"
        except:
            print "it's not int number,ex:1 or 5!"

            return

        divide = intNumber

        nodes = list(hou.selectedNodes())
        for node in nodes:
            print "\n\n"
            print node.name(), " start!!!!!!!!!!!!"

            self.writeBat(divide, node)
            self.runBat(node)
            renderNode = node

        return 1
Пример #44
0
def getCacheInfo(mode=0):
	import cache_utils
	reload (cache_utils)

	res = {}
	folders = []
	selNodes = hou.selectedNodes()
	for n in selNodes:
		res - cache_utils.getCacheInfo(n)
		folders.append(res['cacheFolder'])

	displ = ""
	for k in res:
		displ+=" "+str(k)+" = "+str(res[k])+" "+"\n"
	print displ

	if len(selNodes)>0 and mode==1:

		choice = hou.ui.displayMessage(displ, buttons=('OK', 'Open', 'MakeDayly','MakeDaily_frange', 'OpenDaily'))
		if choice == 1:
			for f in folders:
				subprocess.Popen(["caja", f])

		if choice == 2:
			cache_utils.makeDaily(n)

		if choice == 3:
			input_labels = ['start', 'ent']
			info = cache_utils.getCacheInfo(n)
			cache_frange = info['cacheRange']

			initial_contents = (cache_frange[0], cache_frange[1])
			close_choice = 1
			choice, frange = hou.ui.readMultiInput(message="frame_range", buttons=("OK", "Cancel"), initial_contents=initial_contents,input_label=input_labels,close_choice=close_choice)
			if not choice: cache_utils.makeDaily(n, frange)

		if choice == 4
			cache_utils.openDaily(n)
Пример #45
0
    def exchangeSet(self):
        if hou.hipFile.hasUnsavedChanges():
            if hou.ui.displayConfirmation(
                    'The file has unsaved changes. SAVE?'):
                hou.hipFile.save()
            else:
                pass
        ppp = hou.hipFile.path()
        selNodes = hou.selectedNodes()
        if len(selNodes) == 0:
            hou.ui.displayMessage('No selection')
            return -1
        parent = selNodes[0].parent()
        if parent.type().name() != 'obj':
            hou.ui.displayMessage('This must be an object on top level')
            return -1
        arg_path = os.path.normcase(self.ln_path.text() + '/' +
                                    self.ln_name.text())
        if not os.path.exists(arg_path):
            os.makedirs(arg_path)
        if arg_path:
            nodes = []
            for n in selNodes:
                nodes.extend(n.allSubChildren(True))
            params = []
            for n in nodes:
                nodepar = n.globParms('*file* *out*')
                for arg_parm in nodepar:
                    if arg_parm.parmTemplate().dataType(
                    ) == hou.parmData.String:
                        if self.checkExceptions(arg_parm) != 0:
                            params.append(arg_parm)

            if self.coll.isChecked():
                self.copyFiles(params, arg_path)
            parent.saveItemsToFile(selNodes, arg_path + '/nodes.hip')
            self.updateList()
            hou.hipFile.load(ppp, True, True)
Пример #46
0
        def _addItem(self, collection):
            # Please, dont throw from here!
            try:
                nodes = hou.selectedItems()
            except:
                nodes = hou.selectedNodes()
            if len(nodes) == 0:
                QMessageBox.warning(self, 'not created',
                                    'selection is empty, nothing to add')
                return

            while True:
                # btn,(name,desc) = (0,('1','2'))#hou.ui.readMultiInput('enter some information about new item',('name','description'),buttons=('Ok','Cancel'))
                name, desc, public, good = QDoubleInputDialog.getDoubleTextCheckbox(
                    self, 'adding a new item to %s' % collection.name(),
                    'enter new item details', 'name', 'description', 'public',
                    '', 'a snippet', False)
                if not good:
                    return

                if len(name) > 0:
                    break
                    # validity check

            try:
                # print(name)
                # print(desc)
                # print(hpaste.nodesToString(nodes))
                self.model().addItemToCollection(
                    collection,
                    name,
                    desc,
                    hpaste.nodesToString(nodes),
                    public,
                    metadata={'nettype': self.__netType})
            except CollectionSyncError as e:
                QMessageBox.critical(self, 'something went wrong!',
                                     'Server error occured: %s' % str(e))
Пример #47
0
def get_start_end_nodes(nodes=hou.selectedNodes()):

    if len(nodes) < 2:
        hou.ui.displayMessage("Need to select more than one node",
                              severity=hou.severityType.Error)
        return None

    start_nodes = []
    end_node = None

    for node in nodes:

        if all([n not in nodes for n in node.outputs()]):
            if end_node is None:
                end_node = node
            continue

        if all([n not in nodes for n in node.inputs()]):
            if not node in start_nodes:
                start_nodes.append(node)
            continue

    return start_nodes, end_node
Пример #48
0
 def convert_fbx2principle(fbxNode):
     selected = hou.selectedNodes()
     matnet = fbxNode.createNode('matnet')
     newMatDic = {}
     for child in fbxNode.children():
         shopMatPathParm = child.parm('shop_materialpath')
         matPath = shopMatPathParm.eval()
         if len(matPath) == 0:
             continue
         # print 'matPath:',matPath
         matNode = child.node(matPath)
         print 'matNode:', matNode
         matNodeFullPath = matNode.path()
         # seek for exist
         psdNodePath = ''
         if matNodeFullPath in newMatDic:
             psdNodePath = newMatDic[matNodeFullPath]
         else:
             psdNode = matnet.createNode('principledshader::2.0')
             FBXToRS.CopyFbxMatToPrinciple(matNode, psdNode, True)
             psdNodePath = psdNode.path()
             newMatDic[matNodeFullPath] = psdNodePath
         shopMatPathParm.set(psdNodePath)
Пример #49
0
def createNodes():
    for node in hou.selectedNodes():
        curParent = node.parent().name()

        rop = out.createNode("Redshift_Proxy_Output", node.name())
        rop.moveToGoodPosition()
        file = node.parent().createNode("redshift_packedProxySOP")
        file.setPosition(node.position() + hou.Vector2(0, -1))

        try:
            outNode = node.outputs()[0]
            outNode.setInput(0, file)
        except:
            print 'no output'

        rop.parm("RS_archive_sopPath").set(node.path())
        ropOutput = '`chs("' + rop.path() + '/RS_archive_file")`'
        file.parm("RS_proxy_file").set(ropOutput)
        file.parm("prevMode").set(1)

        txt = 'create "' + rop.path() + '" and "' + file.path() + '"'
        hou.ui.setStatusMessage(txt,
                                severity=hou.severityType.ImportantMessage)
Пример #50
0
 def copyKeyframe(self, frame_step):
     """Copy all current keyframes on all selected objects to a specified frame.
     
     INPUTS:
     frame_step -- frame interval
     """
     current_frame = hou.frame()
     nodes = hou.selectedNodes()
     with hou.undos.group("Copy Keys"):
         for node in nodes:
             for parm in node.parms():
                 parm = parm.getReferencedParm()
                 if parm.keyframesBefore(current_frame) != (
                 ) and len(parm.keyframes()) > 0 and type(
                         parm.eval()) == float and parm.isLocked() == False:
                     new_key = hou.Keyframe()
                     new_key.setValue(parm.eval())
                     new_key.setSlopeAuto(1)
                     new_key.setFrame(current_frame + float(frame_step))
                     parm.setKeyframe(new_key)
                 else:
                     pass
         hou.setFrame(current_frame + frame_step)
Пример #51
0
    def addParm(self, node=None, parm="version", value=1):
        def addParmForType(location='Save to File'):
            target = ptg.findIndicesForFolder(
                location)  # find Save to File folder
            # Create the parm to Add
            houParmTmp = hou.IntParmTemplate(parm, parm, 1)
            ptg.appendToFolder(target, houParmTmp)
            node.setParmTemplateGroup(ptg)
            #set default value
            node.parm(parm).set(value)

        #This is only work for adding parm to filecache node type
        if not node:
            node = hou.selectedNodes()[0]  #select the filecache just created
        #create parameters
        ptg = node.parmTemplateGroup()

        ## If node type is file cache
        if 'filecache' in node.type().nameWithCategory():
            addParmForType()
        if 'rop_alembic' in node.type().nameWithCategory():
            addParmForType('Main')
        return parm
Пример #52
0
def main():
    try:
        cam_nd = hou.selectedNodes()[0]
        aperture = cam_nd.parm("aperture")
    except:
        hou.ui.displayMessage(text="请选择一个相机")
    else:
        shutter = hou.ui.readInput('设置相机视角,maya相机视角',
                                   buttons=('确定', '取消'),
                                   title='maya相机视角',
                                   initial_contents='54.43',
                                   close_choice=1,
                                   default_choice=0)
        if shutter[0] == 1:
            return
        angle = 0
        try:
            angle = (float)(shutter[1])
        except:
            hou.ui.displayMessage(text="相机视角是一个浮点数据,请输入一个数值")
            main()
        else:
            aperture.setExpression('tan(%f*0.5)*ch("focal")*2' % angle)
Пример #53
0
def createCacheRops():
    nodelist = hou.selectedNodes()

    for node in nodelist:
        nodeName = node.name()
        isNull = node.type().name().startswith("null")
        isCache = nodeName.startswith("CACHE")
        if isNull & isCache:
            node.setColor(hou.Color((0,.5,0)))
            ropName = nodeName.replace("CACHE_","")

            ropNode = hou.node('/out/').createNode('geometry')
            ropNode.setName(ropName)
            ropNode.setColor(hou.Color((0.75,0.7,0)))

            ropNode.parm('soppath').set(node.path())

            readNode = node.createOutputNode('file')
            readNode.setName(ropName)
            readNode.setColor(hou.Color((0.75,0.7,0)))

            expression = "hou.node('" + ropNode.path() + "').parm('sopoutput').eval()"
            readNode.parm('file').setExpression(expression,hou.exprLanguage.Python)
Пример #54
0
def createNode():
    for node in hou.selectedNodes():
        sort = node.parent().createNode("sort")
        sort.setInput(0, node)

        sort.setPosition(node.position() + hou.Vector2(0, -1))

        sort.parm("ptsort").set("byx")

        wrangle = node.parent().createNode("attribwrangle")
        wrangle.setInput(0, sort)

        wrangle.parm("snippet").set(txt)

        wrangle.setPosition(sort.position() + hou.Vector2(0, -1))

        nul = node.parent().createNode("null")
        nul.setInput(0, wrangle)

        nul.setDisplayFlag(True)
        nul.setRenderFlag(True)

        nul.setPosition(wrangle.position() + hou.Vector2(0, -1))

        parentNode = node.parent()
        parentTxt = parentNode.path()

        parentNode.setDisplayFlag(False)

        lightNode = hou.node("/obj").createNode("hlight")

        lightNode.parm("light_type").set("geo")
        lightNode.parm("light_contribprimary").set(True)
        lightNode.parm("normalizearea").set(False)
        lightNode.parm("areageometry").set(parentTxt)

        lightNode.setPosition(parentNode.position() + hou.Vector2(0, -1))
    def run(self):
        try:
            list_var = os.listdir(self.get_path_w() + "/plate")
            path_w_jpg = self.get_path_w(
            ) + '/' + "plate/" + list_var[-1] + '/jpg'
            # print path_w_jpg
        except:
            list_var = os.listdir(self.get_path_w())
            path_w_jpg = self.get_path_w() + '/' + list_var[-1] + '/jpg'
            # print path_w_jpg

        list_all = os.listdir(path_w_jpg)

        suffix_jpg = []
        for jpg in list_all:
            suffix = jpg.split('.')
            if suffix[-1] == 'jpg':
                suffix_jpg.append(jpg)

        list_jpg = suffix_jpg[0].split('.')
        list_jpg[-2] = '$F4'
        jpg_name = '.'.join(list_jpg)
        # get jpg path
        path_w_jpg = path_w_jpg + '/' + jpg_name

        # set parm
        node_sel = hou.selectedNodes()
        for node in node_sel:
            node.parm('vm_background').set(path_w_jpg)

        # set playbackRange
        list_s_n = suffix_jpg[0].split('.')
        list_e_n = suffix_jpg[-1].split('.')
        s_n = int(list_s_n[-2])
        e_n = int(list_e_n[-2])
        hou.playbar.setPlaybackRange(s_n, e_n)
        hou.setFrame(s_n)
Пример #56
0
def main():
    sel_nodes = hou.selectedNodes()
    path = []

    #下面是一个递归函数
    def search_children(node):
        if node.children():
            for ch in node.children():
                if ch.type().name() == 'file' or ch.type().name() == 'alembic':
                    nodePath = ch.path()
                    path.append(nodePath)
                else:
                    search_children(ch)
        if not node.children():
            #print "no children !"
            if node.type().name() == 'file' or node.type().name() == 'alembic':
                nodePath = node.path()
                path.append(nodePath)
            elif node.type().name() == 'null':
                nodePath = node.path()
                path.append(nodePath)
            else:
                pass

    for node in sel_nodes:
        search_children(node)

    #升序排列并删除重复元素
    path = sorted(list(set(path)))

    #这个geo_list.log文件会生成在houdini_temp临时文件夹里面
    tempdir = tempfile.gettempdir()
    fl = open("%s\\geo_list" % tempdir, "w")
    for node_path in path:
        fl.write(node_path)
        fl.write("\n")
    fl.close()
Пример #57
0
def copyToString(nodes=None):
    # print "\n"*2
    if not nodes:
        nodes = hou.selectedNodes()
    if not nodes:
        return

    parms_checklist = ['ver', 'element', 'version', 'version2']
    res_str_comb = ""
    res_list = []
    parms_dict = {}
    for n in nodes:
        print "node", n
        parms_list = [x for x in n.parms() if x.name() in parms_checklist]
        parms_dict = {p.name(): p.eval() for p in parms_list}
        res_str = ""

        if "element" in parms_dict.keys():
            element = parms_dict['element']
            res_str += 'element:{}'.format(element)

        if "version" in parms_dict.keys():
            version = parms_dict['version']
            res_str += '|version:{}'.format(version)

        if "version2" in parms_dict.keys():
            version2 = parms_dict['version2']
            res_str += '|version2:{}'.format(version2)

        res_list.append(res_str)
    res_str_comb = ",".join(res_list)

    message = "copy from {}\n".format(nodes[0].parent())
    hou.ui.readInput(message=message,
                     buttons=('ok', 'cancel'),
                     initial_contents=res_str_comb)
    return res_str_comb
Пример #58
0
def create_ogl_rop () :
    obj_nodes = hou.selectedNodes()
    ogl_container = hou.node("/obj/rop_OGL")
    if not ogl_container :
        ogl_container = hou.node("/obj").createNode("ropnet", "rop_OGL") 


    for obj_node in obj_nodes :
        name_long = obj_node.name()
        name_short = name_long.split("_")[0]

        # create ROP
        ogl_node = ogl_container.createNode( "opengl", name_short )
        ogl_node.setPosition(obj_node.position())

        # set take
        take_parm = ogl_node.parm("take")
        take_parm.set(name_long)

        
        ogl_node.parm("trange").set(2)
        # set range
        if name_long.find("_") != -1 :
            start = name_long.split("_")[1]
            end   = name_long.split("_")[2]
            ogl_node.parm("f1").set(start)
            ogl_node.parm("f2").set(end)

        
        # gamma
        ogl_node.parm("gamma").set(2.2)
        ogl_node.parm("shadows").set(0)
        ogl_node.parm("hqlighting").set(0)
        
        # set picture name
        path = "$HIP/render/" + name_short + "/" + name_short + "_$F4.png"
        ogl_node.parm("picture").set(path)
Пример #59
0
def create_rs_rop () :
    obj_nodes = hou.selectedNodes()
    rs_container = hou.node("/obj/rop_RS")


    for obj_node in obj_nodes :
        name_long = obj_node.name()
        name_short = name_long.split("_")[0]

        # create ROP
        rs_node = rs_container.createNode( "Redshift_ROP", name_short )
        rs_node.setPosition(obj_node.position())

        # set take
        take_parm = rs_node.parm("take")
        take_parm.set(name_long)

        rs_node.parm("trange").set(2)
        # set range
        if name_long.find("_") != -1 :
            start = name_long.split("_")[1]
            end   = name_long.split("_")[2]
            
            rs_node.parm("f1").deleteAllKeyframes()
            rs_node.parm("f2").deleteAllKeyframes()

            rs_node.parm("f1").set(start)
            rs_node.parm("f2").set(end)

        # 
        rs_node.parm("RS_nonBlockingRendering").set(0)
        rs_node.parm("RS_renderToMPlay").set(0)
        rs_node.parm("RS_outputFileFormat").set(3) # .png

        # set picture name
        path = "$HIP/render/" + name_short + "/" + name_short + "_$F4.png"
        rs_node.parm("RS_outputFileNamePrefix").set(path)
Пример #60
0
def null_ctrl_points():
	nodes = hou.selectedNodes()
	node = nodes[0].displayNode()
	geo = node.geometry()
	pts = geo.points()
	if len(pts)>0:
		for pt in pts:
			pos = pt.position()
			name = 'pt_'+str(pt.number())
			null_node = hou.node("/obj").createNode("null", name)
			null_node.moveToGoodPosition()
			null_node.setParms({'tx': pos[0], 'ty': pos[1], 'tz': pos[2]})
		wr = node.createOutputNode('python')
		r = "node = hou.pwd()\n"
		r += "geo = node.geometry()\n"
		r += "pts = geo.points()\n"
		r += "for pt in pts:\n"
		r += "\tpath = '/obj/pt_' + str(pt.number())\n"
		r += "\tnull_node = hou.node(path)\n"
		r += "\tt = null_node.parmTuple('t')\n"
		r += "\tpt.setPosition((t[0].eval(), t[1].eval(), t[2].eval()))\n"
		wr.parm('python').set(r)
		wr.setDisplayFlag(True)
		wr.setRenderFlag(True)