目录
hou.selectedNodes —— 返回被选择节点的列表
hou.selectedItems —— 返回被选择节点等的列表
hou.selectedConnections —— 返回连接线的列表
hou.evalParmTuple —— 计算指定路径的参数元组
hou.expandString —— 计算指定路径的参数元组
Nodes
hou.pwd —— 返回全局当前节点
pwd() → hou.Node
- 此函数是 hou.node('.') 的缩写;
- python和hscript分享相同的全局当前节点,如在hscript改变当前节点也将反应在python上;
hou.parent —— 返回当前节点父节点
parent() → hou.Node or None
- 此函数是 hou.node('..') 的缩写;
hou.cd —— 改变全局当前节点
cd(path)
- 如路径不存在,返回hou.OperationFailed;
hou.setPwd —— 将给定节点设置为当前节点
setPwd(node)
- 等价于 hou.cd(node.path()) ;
- 如对应节点不存在,返回hou.ObjectWasDeleted;
//将geo2设置为当前节点
node = hou.node('/obj/geo2')
hou.setPwd(node)
print(hou.pwd())
//将geo1设置为当前节点
hou.cd('/obj/geo1')
print(hou.pwd())
hou.root —— 返回根节点
root() → hou.Node
- 此函数是 hou.node('/') 的缩写;
hou.node —— 返回指定路径的节点
node(path) → hou.Node or None
- 以’/‘,则根据绝对路径,否则依据当前节点的相对路径;
- 不要和类hou.Node混淆;
hou.nodes —— 返回指定一系列路径的节点元组
nodes(path_tuple) → tuple of hou.Node
paths = ["/obj/geo1", "/obj/geo2", "/obj/geo3"]
nodes = hou.nodes(paths)
//等价于
nodes = [hou.node(path) for path in paths]
hou.item —— 返回指定路径的item
item(path) → hou.NetworkMovableItem or None
- NetworkMovableItem,为所有可见的元素如node、network box、sticky note;
hou.item('/obj/geo')
hou.item('/obj/__netbox1')
hou.item('/obj/__stickynote1')
hou.item('/obj/__dot1')
hou.items —— 返回指定一系列路径的item元组
items(path_tuple) → tuple of hou.NetworkMovableItem or None
- 等价于 items = [hou.item(path) for path in paths] ;
paths = ["/obj/geo1", "/obj/geo2", "/obj/geo3"]
items = hou.items(paths)
//等价于
items = [hou.item(path) for path in paths]
hou.selectedNodes —— 返回被选择节点的列表
selectedNodes(include_hidden=False) → tuple of hou.Node
- 默认include_hidden为假,表示不包括隐藏的节点;
selected = hou.selectedNodes()
for node in selected:
print(node.path())
hou.selectedItems —— 返回被选择节点等的列表
selectedItems(include_hidden=False) → tuple of hou.NetworkMovableItem
- 可选择nodes、network boxes、sticky notes、subnet indirect inputs、network dotes;
- 默认include_hidden为假,表示不包括隐藏的节点;
for n in hou.selectedItems():
print(n.position())
hou.selectedConnections —— 返回连接线的列表
selectedConnections() → tuple of hou.NodeConnection
for conn in hou.selectedConnections():
print(conn.inputNode().name())
Parameters
hou.parm —— 返回指定路径的参数
parm(path) → hou.Parm or None
hou.parmTuple —— 返回指定路径的参数元组
parmTuple(path) → hou.ParmTuple or None
hou.parm('/obj/geo/tx')
hou.parmTuple('/obj/geo/t')
hou.evalParm —— 计算指定路径的参数
evalParm(path) → int, float, or string
- 此函数是 hou.parm(path).eval() 的缩写;
hou.evalParmTuple —— 计算指定路径的参数元组
evalParmTuple(path) → tuple of int , float , or str , or hou.Ramp
- 此函数是 hou.parmTuple(path).eval() 的缩写;
Scripting
hou.expandString —— 计算指定路径的参数元组
expandString(str) -> str
- 此方法已被弃用,使用hou.text.expandString();