翎玄:Houdini&Shader 笔记目录zhuanlan.zhihu.comhttps://www.sidefx.com/docs/houdini/hom/index.htmlwww.sidefx.comHOM introductionwww.sidefx.com
Houdini Object Model (HOM) 是使用Python和houdini交互的 (API)
实例操作Python Source Editor
Houdini有python的命令行输入窗口:Windows>Python Source Editor
我们输入代码然后按apply,发现生成了一个geometry节点。注意createNode使用的节点名称有些是缩写有些是全称如 geo cam null instance /*这里需要整理一下名称*/
其它实例
//在obj中的main类里面创建null节点
import hou
hou.node("/obj/main").createNode("null")
//查找obj中所有节点的名称
import hou
children = hou.node("/obj/main").children()
for child in children:
print child.name()
//获得节点的Python名称 把节点拖入Source Edior然后 print XXXX.asCode()
print hou.node('/obj/main/sphere1').asCode()
//获得: hou_node = hou_parent.createNode("sphere", "sphere1", ……
//查找名称删除节点
import hou
nodes = hou.node("/obj/main").children()
for node in nodes:
if node.name() == "null2":
node.destroy()Python Shell Windows>Python Shell也是命令行操作界面