houdini调用老版节点代码

 

import hou

def my_createNode(node_type_name, nodes = None):
plane = hou.ui.paneTabOfType(hou.paneTabType.NetworkEditor)
pos = plane.selectPosition()
parent = plane.pwd()

creatingNode = parent.createNode(node_type_name)
creatingNode.setPosition(pos)
if len(nodes):
creatingNode.setFirstInput(nodes[0], 0)

def add_nodeToLists():
node_type = hou.ui.readInput('input the node name ', title='add node to lists')[1]
list_temp = list(lists)
list_temp.insert(-3, node_type)

def remove_nodeToLists():
pass

def main():
lists = ('fluidsource', 'paint', 'foreach', 'point', '我要自己输入', '我要添加自定义', '我要删除自定义')
lists_len = len(lists)
node_index = hou.ui.selectFromList(lists, default_choices=[0], exclusive=True, column_header='the node you can Choices')[0]
node_type = lists[node_index]
nodes = hou.selectedNodes()
if node_index < lists_len - 3:
try:
my_createNode(node_type, nodes)
except:
print('创建的地方不太对吧~~!!')

if node_index == lists_len - 3:
try:
node_type = hou.ui.readInput('input the node name ', title='create node use python')[1]
my_createNode(node_type, nodes)
except:
print('输入有误,找不到你要的那个节点啊~~!!')

if node_index == lists_len - 2:
add_nodeToLists()

 

点赞

发表回复

昵称和uid可以选填一个,填邮箱必填(留言回复后将会发邮件给你)
tips:输入uid可以快速获得你的昵称和头像