Jump to content

Add selected node to a networkbox


Recommended Posts

Hi all, I am new to python scripting in Houdini, just wondering how can I add a bunch of nodes to a networkbox, the only function I found relative to add node to networkbox is the addNode function, which seems to only add single node to a networkbox.

Any advance would be much appreciated.


Link to comment
Share on other sites

Looking at the docs for hou.NetworkBox looks like all the planned methods for the class have been implemented so it would seem addNode is the best that we will be getting for now. However this is really more than enough since we can just loop to add our nodes. Doing something like the following code should work, assuming you create a tool that you can access in the tab menu. It gets the selected nodes, looks for a selected network box to use and if not it creates a new one. Can't guarantee this code actually works since I haven't tried it but it should provide the general idea if not.

activepane = kwargs["pane"]

if not isinstance(activepane, hou.NetworkEditor):
	raise hou.Error("No Network Editor found.")

cwd = activepane.pwd()

netboxes = cwd.networkBoxes()

current_box = None
for box in netboxes:
	if box.isPicked():
		current_box = box
	current_box = cwd.createNetworkBox()

selected_nodes = hou.selectedNodes()

for node in selected_nodes:


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...