本文整理汇总了Python中hou.node方法的典型用法代码示例。如果您正苦于以下问题:Python hou.node方法的具体用法?Python hou.node怎么用?Python hou.node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hou
的用法示例。
在下文中一共展示了hou.node方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_container
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def parse_container(container):
"""Return the container node's full container data.
Args:
container (hou.Node): A container node name.
Returns:
dict: The container schema data for this container node.
"""
data = lib.read(container)
# Backwards compatibility pre-schemas for containers
data["schema"] = data.get("schema", "avalon-core:container-1.0")
# Append transient data
data["objectName"] = container.path()
data["node"] = container
return data
示例2: maintained_selection
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [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)
示例3: run
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def run():
netBoxLists = {
#-name-:[ ---Position---- , -----Size------ , -----------Color------------,]
'Camera':[hou.Vector2(5,-0), hou.Vector2(20,2),hou.Color((0.10, 0.10, 0.10)),],
'Light':[hou.Vector2(5,-3), hou.Vector2(20,2),hou.Color((1.00, 0.98, 0.67)),],
'Import-Stage':[hou.Vector2(5,-7), hou.Vector2(20,3),hou.Color((0.62, 0.87, 0.77)),],
'Import-Chr':[hou.Vector2(5,-12),hou.Vector2(20,4),hou.Color((0.62, 0.77, 0.87)),],
'Import-Prop':[hou.Vector2(5,-16),hou.Vector2(20,3),hou.Color((0.77, 0.77, 0.87)),],
'Work':[hou.Vector2(5,-21),hou.Vector2(20,4),hou.Color((0.56, 0.10, 0.10)),],
'Shader':[hou.Vector2(5,-24),hou.Vector2(20,2),hou.Color((0.99, 0.65, 0.65)),],
'Render':[hou.Vector2(5,-31),hou.Vector2(20,6),hou.Color((0.57, 0.49, 0.86)),],
}
obj = hou.node('/obj')
for nName,nAttr in netBoxLists.items():
box = obj.createNetworkBox()
box.setComment(nName)
box.setName('nm_{}'.format(nName))
box.setPosition(nAttr[0])
box.setColor(nAttr[2])
box.setSize(nAttr[1])
示例4: addpointvel
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def addpointvel(n,creatednodes,usevel=True):
parent = n.parent()
raster = toolutils.findOutputNodeOfType(n,'volumerasterizeattributes')
inn = raster.inputs()[0]
velocity = parent.createNode("pointvelocity")#, "get_velocity")
if usevel:
velocity.parm("init").set(1)
velocity.parm("addobjectmotion").set(False)
velocity.parm("objpath").set("`opfullpath('..')`")
velocity.setInput(0,inn)
raster.insertInput(0,velocity)
visType = hou.viewportVisualizers.types()[0]
vis = hou.viewportVisualizers.createVisualizer(visType,category=hou.viewportVisualizerCategory.Node,node=velocity)
vis.setIsActive(1, viewport=None)
vis.setName('source_velocity')
vis.setParm('style','vector')
vis.setParm('attrib','v')
vis.setParm('unitlength',hou.fps())
creatednodes.insert(2,velocity)
return velocity,creatednodes
示例5: run
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def run(pane):
node = hou.node('/obj').createNode('geo','work_')
node.setPosition(pane.cursorPosition())
lockattrs = [
'tx','ty','tz',
'rx','ry','rz',
'sx','sy','sz',
'px','py','pz',
'prx','pry','prz',
'scale'
]
for attr in lockattrs:
node.parm(attr).lock(True)
node.setSelectableInViewport(False)
示例6: createWedge
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def createWedge(nName,nColor,sourcePath):
outRop = hou.node('/out').createNode('wedge',nName)
tpl = hou.StringParmTemplate("source", "Source", 1, string_type=hou.stringParmType.NodeReference)
outRop.addSpareParmTuple(tpl)
outRop.setParms({
"source" : sourcePath,
"prefix" : "",
"driver" : "`chs('source')`/To_Fetch",
"wedgeparams" : 1,
"random" : 0,
})
outRop.setParmExpressions({
"range1y" : 'ch("steps1")-1',
})
outRop.setColor(nColor)
return outRop
示例7: get_output_nodes
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def get_output_nodes(cls):
"""returns the rop nodes in the scene
"""
rop_context = hou.node('/out')
# get the children
out_nodes = rop_context.children()
exclude_node_types = [
hou.nodeType(hou.nodeTypeCategories()["Driver"], "wedge"),
hou.nodeType(hou.nodeTypeCategories()["Driver"], "fetch")
]
# remove nodes in type in exclude_node_types list
new_out_nodes = [node for node in out_nodes
if node.type() not in exclude_node_types]
return new_out_nodes
示例8: get_shot_node
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def get_shot_node(self):
"""returns or creates qLib shot node
"""
ql_shot_node_type = "qLib::shot_ql::1"
obj_context = hou.node("/obj")
for child in obj_context.children():
if child.type().name() == ql_shot_node_type:
return child
# so we couldn't find the shot node
# creat a new one
try:
shot_node = obj_context.createNode(ql_shot_node_type)
except hou.OperationFailed:
return
else:
return shot_node
示例9: rename_selected_nodes
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [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))
示例10: insert_light_samples
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def insert_light_samples(self, item, column):
for node in lights:
if item.text(0) == node.path():
for i in range(len(lights[node])):
sample_parm = lights[node][i][0]
ui_samples = lights[node][i][1]
try:
amount_samples = node.parm(sample_parm).eval()
except:
amount_samples = None
ui_samples.setText("")
ui_samples.setDisabled(False)
if amount_samples != None:
ui_samples.setText(str(amount_samples))
else:
ui_samples.setDisabled(True)
示例11: select_deadline_machine_list_callback
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def select_deadline_machine_list_callback(script_args):
"""
GUI callback to select machines and set the appropriate parameter. It is designed to be able to be used by
multiple parameter & button pairs. To do this, it assumes that the button has the same name as the target parm
but with "_browse_button" on the end
Args:
script_args (dict): The Houdini "kwargs" dictionary
Returns:
None
"""
rop_node = script_args["node"]
target_parm_name = script_args["script_parm"].replace("_browse_button", "")
target_parm = rop_node.parm(target_parm_name)
result = select_deadline_machine_list(target_parm.eval())
if result is not None:
target_parm.set(result)
示例12: select_deadline_limits_callback
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def select_deadline_limits_callback(script_args):
"""
GUI callback to select limits and set the appropriate parameter. It is designed to be able to be used by
multiple parameter & button pairs. To do this, it assumes that the button has the same name as the target parm
but with "_browse_button" on the end
Args:
script_args (dict): The Houdini "kwargs" dictionary
Returns:
None
"""
rop_node = script_args["node"]
target_parm_name = script_args["script_parm"].replace("_browse_button", "")
target_parm = rop_node.parm(target_parm_name)
result = select_deadline_limit_groups(target_parm.eval())
if result is not None:
target_parm.set(result)
示例13: select_deadline_dependencies_callback
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def select_deadline_dependencies_callback(script_args):
"""
GUI callback to select dependencies and set the appropriate parameter. It is designed to be able to be used by
multiple parameter & button pairs. To do this, it assumes that the button has the same name as the target parm
but with "_browse_button" on the end
Args:
script_args (dict): The Houdini "kwargs" dictionary
Returns:
None
"""
rop_node = script_args["node"]
target_parm_name = script_args["script_parm"].replace("_browse_button", "")
target_parm = rop_node.parm(target_parm_name)
result = select_deadline_dependencies(target_parm.eval())
if result is not None:
target_parm.set(result)
# --------------------------------------------------------------------------
# Button GUI Callbacks
# --------------------------------------------------------------------------
示例14: submit_branch_button_callback
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def submit_branch_button_callback(script_args):
"""
GUI callback to submit the node and its dependents to the farm.
If "hf_validate_only" parameter is set to True then it won't submit; it will only do the validation stage.
Validation is only done for this node and its dependents.
Args:
script_args (dict): The Houdini "kwargs" dictionary
Returns:
None
"""
with RopErrorList(None) as error_list_obj:
rop_node = script_args["node"]
validate_only = rop_node.parm("hf_validate_only").eval() == 1
rop_list = hou_farm_tools.get_rop_process_list(rop_node, False)
submit_rop_list(rop_list, validate_only, error_list_obj)
示例15: submit_node_button_callback
# 需要导入模块: import hou [as 别名]
# 或者: from hou import node [as 别名]
def submit_node_button_callback(script_args):
"""
GUI callback to submit only this node to the farm. No other dependent nodes will be submitted.
If "hf_validate_only" parameter is set to True then it won't submit; it will only do the validation stage.
Validation is only done for this node.
Args:
script_args (dict): The Houdini "kwargs" dictionary
Returns:
None
"""
with RopErrorList(None) as error_list_obj:
rop_node = script_args["node"]
validate_only = rop_node.parm("hf_validate_only").eval() == 1
submit_rop_list([rop_node], validate_only, error_list_obj)