Jump to content

opunhide all nodes using python


younglegend

Recommended Posts

  • younglegend changed the title to opunhide all nodes using python
23 minutes ago, anim said:

hou.hscript("opunhide Sop point")

should work

oh you're right, it does. Had to restart houdini for some reason.

ok so hou.hscript("opunhide Sop") gives me all the hidden sop nodes but since it's returns a string, how do you make it a list so that i can loop for each node and say hou.hscript("opunhide Sop <node_name>")

 

sop_list = []
for i in hou.hscript("opunhide Sop"):
    sop_list.append(str(i))

for sop in _sop_list:
  node _name = (sop.split(" ")[-1])
  print node_name

This won't work as i realized t's returning a string, not list of nodes  :blink:

Link to comment
Share on other sites

sop_list = hou.hscript("opunhide Sop")[0].split()[2::3]
for sop in sop_list:
    hou.hscript("opunhide Sop {}".format(sop))

or if you want to unhide all nodes of all types

all = hou.hscript("opunhide")[0].split()
node_list = [all[i+1:i+3] for i in range(0, len(all), 3) ]
for node in node_list:
    hou.hscript("opunhide {} {}".format(node[0], node[1]))
Edited by anim
  • Like 1
Link to comment
Share on other sites

1 hour ago, anim said:

sop_list = hou.hscript("opunhide Sop")[0].split()[2::3]
for sop in sop_list:
    hou.hscript("opunhide Sop {}".format(sop))

or if you want to unhide all nodes of all types


all = hou.hscript("opunhide")[0].split()
node_list = [all[i+1:i+3] for i in range(0, len(all), 3) ]
for node in node_list:
    hou.hscript("opunhide {} {}".format(node[0], node[1]))

That's perfect. Thanks Tomas ^_^

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.

Guest
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...