當前位置: 首頁>>代碼示例>>Python>>正文


Python hou.selectedNodes方法代碼示例

本文整理匯總了Python中hou.selectedNodes方法的典型用法代碼示例。如果您正苦於以下問題:Python hou.selectedNodes方法的具體用法?Python hou.selectedNodes怎麽用?Python hou.selectedNodes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hou的用法示例。


在下文中一共展示了hou.selectedNodes方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: maintained_selection

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def maintained_selection():
    """Maintain selection during context
    Example:
        >>> with maintained_selection():
        ...     # Modify selection
        ...     node.setSelected(on=False, clear_all_selected=True)
        >>> # Selection restored
    """

    previous_selection = hou.selectedNodes()
    try:
        yield
    finally:
        # Clear the selection
        # todo: does hou.clearAllSelected() do the same?
        for node in hou.selectedNodes():
            node.setSelected(on=False)

        if previous_selection:
            for node in previous_selection:
                node.setSelected(on=True) 
開發者ID:getavalon,項目名稱:core,代碼行數:23,代碼來源:lib.py

示例2: openFolderFromSelectedNodes

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
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) 
開發者ID:ShoheiOkazaki,項目名稱:Nagamochi,代碼行數:24,代碼來源:openFolders.py

示例3: rename_selected_nodes

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def rename_selected_nodes(cls, search_str, replace_str, replace_in_child_nodes=False):
        """Batch renames selected nodes

        :param str search_str: Search for this
        :param str replace_str: And replace with this
        :return:
        """
        import hou
        selection = hou.selectedNodes()
        for node in selection:
            name = node.name()
            node.setName(name.replace(search_str, replace_str))
            if replace_in_child_nodes:
                for child_node in node.children():
                    name = child_node.name()
                    child_node.setName(name.replace(search_str, replace_str)) 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:18,代碼來源:toolbox.py

示例4: get_selected_rops_for_patching

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def get_selected_rops_for_patching():
    """
    Gets a list of ROPs from the current selection that are able to be patched.

    Returns:
        List: A list of ROPs to patch
    """
    # TODO: Need to do more checks on what is selected. Maybe allow the ROP SOP Output Driver?
    rop_list = []
    sel_nodes = list(hou.selectedNodes())
    for rop_node in sel_nodes:
        network_type = rop_node.parent().childTypeCategory().name()
        if network_type == "Driver" or rop_node.type().name().startswith("rop_"):
            parm_tg = rop_node.parmTemplateGroup()
            entry = parm_tg.parmTemplates()[0]
            if entry.name() != "hf_orig_parms":
                rop_list.append(rop_node)
    return rop_list 
開發者ID:fxnut,項目名稱:hou_farm,代碼行數:20,代碼來源:tools.py

示例5: get_selected_rops_for_unpatching

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def get_selected_rops_for_unpatching():
    """
    Gets a list of ROPs from the current selection that are able to be unpatched.

    Returns:
        List: A list of ROPs to unpatch
    """
    rop_list = []
    sel_nodes = list(hou.selectedNodes())
    for rop_node in sel_nodes:
        network_type = rop_node.parent().childTypeCategory().name()
        if network_type == "Driver" or rop_node.type().name().startswith("rop_"):
            parm_tg = rop_node.parmTemplateGroup()
            entry = parm_tg.parmTemplates()[0]
            if entry.name() == "hf_orig_parms":
                rop_list.append(rop_node)
    return rop_list 
開發者ID:fxnut,項目名稱:hou_farm,代碼行數:19,代碼來源:tools.py

示例6: _addItem

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
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'%e.message) 
開發者ID:pedohorse,項目名稱:hpaste,代碼行數:26,代碼來源:hpastecollectionwidget.py

示例7: copy_node_path

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def copy_node_path(cls):
        """copies path to clipboard
        """
        import hou
        node = hou.selectedNodes()[0]
        hou.ui.copyTextToClipboard(node.path()) 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:8,代碼來源:toolbox.py

示例8: process

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def process(self):
        """This is the base functionality to create instances in Houdini

        The selected nodes are stored in self to be used in an override method.
        This is currently necessary in order to support the multiple output
        types in Houdini which can only be rendered through their own node.

        Default node type if none is given is `geometry`

        It also makes it easier to apply custom settings per instance type

        Example of override method for Alembic:

            def process(self):
                instance =  super(CreateEpicNode, self, process()
                # Set paramaters for Alembic node
                instance.setParms(
                    {"sop_path": "$HIP/%s.abc" % self.nodes[0]}
                )

        Returns:
            hou.Node

        """

        if (self.options or {}).get("useSelection"):
            self.nodes = hou.selectedNodes()

        # Get the node type and remove it from the data, not needed
        node_type = self.data.pop("node_type", None)
        if node_type is None:
            node_type = "geometry"

        # Get out node
        out = hou.node("/out")
        instance = out.createNode(node_type, node_name=self.name)
        instance.moveToGoodPosition()

        lib.imprint(instance, self.data)

        return instance 
開發者ID:getavalon,項目名稱:core,代碼行數:43,代碼來源:pipeline.py

示例9: launch

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def launch(switch):   

    n = hou.selectedNodes()[0]

    if switch == False:
        if n.type().name() == 'ifd':
            run_mplay(n,'vm_picture')        
        elif n.type().name() == 'opengl':
            run_mplay(n,'picture')
        elif n.type().name() == 'arnold':
            run_mplay(n,'ar_picture')
        elif n.type().name() == 'comp':
            run_mplay(n,'copoutput')
        elif n.type().name() == 'ris::22':
            run_mplay(n,'ri_display_0')

    elif switch == True:
        if n.type().name() == 'ifd':
            run_rv(n,'vm_picture')        
        elif n.type().name() == 'opengl':
            run_rv(n,'picture')
        elif n.type().name() == 'arnold':
            run_rv(n,'ar_picture')
        elif n.type().name() == 'comp':
            run_rv(n,'copoutput')
        elif n.type().name() == 'ris::22':
            run_rv(n,'ri_display_0')

    # else:
    #     hou.ui.displayMessage('Plz select Mantra ROP') 
開發者ID:ShoheiOkazaki,項目名稱:Nagamochi,代碼行數:32,代碼來源:launchMplayFromNode.py

示例10: run

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def run():
	slnode = hou.selectedNodes()[0]
	if slnode.type().name()=='dopnet':
	    uiText = 'Change OpenCL value on all children nodes in this %s' % slnode.path()
	    value = hou.ui.displayMessage(title='OpenCL', text=uiText, buttons=("Deactive", "Active"))
	    switchOpenCl(slnode,value) 
開發者ID:ShoheiOkazaki,項目名稱:Nagamochi,代碼行數:8,代碼來源:openClSwitcher.py

示例11: blackbox_definitions

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def blackbox_definitions(out_folder):
    # given the selected nodes, create a blackboxed definition for each asset and save to out_folder.
    nodes = hou.selectedNodes()
    for node in nodes:
        definition = node.type().definition()
        if definition:
            def_filename = definition.libraryFilePath()
            out_file = os.path.join(out_folder, os.path.basename(def_filename))
            print("saving blackboxed file: {}".format(out_file))
            definition.save(file_name=out_file, template_node=node, compile_contents=True, black_box=True) 
開發者ID:toadstorm,項目名稱:MOPS,代碼行數:12,代碼來源:mops_tools.py

示例12: setupMutationFromMarkedWedgesUI

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def setupMutationFromMarkedWedgesUI():

	try:
		anchor_node = hou.selectedNodes()[-1]
		if anchor_node.type() != hou.nodeType("Top/wedge"):
			raise Exception("No Wedge Node selected.")
	except:
		print "No Wedge Node selected."


	wedge_sel_str = hou.ui.readInput("Enter Wedge Index List, i.e. '0_1,3_0,4_1'")[1]
	wedge_sel_list = wedge_sel_str.split(",")

	mode = hou.ui.selectFromList(["Convert to Takes (del. existing Takes)", "Convert to Takes (keep existing Takes)", "Convert to TOP Wedge (del. existing Takes)"], default_choices=([0]), exclusive=True, message="Please choose how to convert Marked Wedges", title="Conversion Mode", column_header="Choices", num_visible_rows=3, clear_on_cancel=True, width=400, height=180)
	if mode == ():
		raise Exception("Cancelled.")
	mode = mode[0]

	setupMutationFromMarkedWedges(wedge_sel_list, anchor_node, mode)







#function to create new root wedge node from current mutagen viewer selection 
開發者ID:MeyerAdrian,項目名稱:pdg_mutagen,代碼行數:29,代碼來源:pdg_mutagen.py

示例13: _replaceContent

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
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'%e.message) 
開發者ID:pedohorse,項目名稱:hpaste,代碼行數:17,代碼來源:hpastecollectionwidget.py

示例14: orderSelected

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def orderSelected():
	return orderNodes(hou.selectedNodes()) 
開發者ID:pedohorse,項目名稱:hpaste,代碼行數:4,代碼來源:hpaste.py

示例15: export_rsproxy_data_as_json

# 需要導入模塊: import hou [as 別名]
# 或者: from hou import selectedNodes [as 別名]
def export_rsproxy_data_as_json(cls, geo=None, path=''):
        """exports RSProxy Data on points as json
        """
        import hou
        if geo is None:
            node = hou.selectedNodes()[0]
            geo = node.geometry()

        # Add code to modify contents of geo.
        # Use drop down menu to select examples.
        pos = geo.pointFloatAttribValues("P")
        rot = geo.pointFloatAttribValues("rot")
        sca = geo.pointFloatAttribValues("pscale")
        instance_file = geo.pointStringAttribValues("instancefile")
        node_name = geo.pointStringAttribValues("node_name")
        parent_name = geo.pointStringAttribValues("parent_name")

        import os
        import tempfile
        if path == '':
            path = os.path.normpath(
                os.path.join(
                    tempfile.gettempdir(),
                    'rsproxy_info.json'
                )
            )

        pos_data = []
        rot_data = []
        for i in range(len(pos) / 3):
            pos_data.append((pos[i * 3], pos[i * 3 + 1], pos[i * 3 + 2]))
            rot_data.append((rot[i * 3], rot[i * 3 + 1], rot[i * 3 + 2]))

        json_data = {
            "pos": pos_data,
            "rot": rot_data,
            "sca": sca,
            "instance_file": instance_file,
            "node_name": node_name,
            "parent_name": parent_name
        }

        import json
        with open(path, "w") as f:
            f.write(json.dumps(json_data)) 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:47,代碼來源:toolbox.py


注:本文中的hou.selectedNodes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。