younglegend Posted February 17, 2020 Share Posted February 17, 2020 How do you opunhide all nodes in a particular category or a bunch of specific nodes using python? I wish to add this in my startup script. a simple hou.hscriptExpression("opunhide Sop point") dosent seem to work. Nor does hou.hscript(). What am i doing wrong? Quote Link to comment Share on other sites More sharing options...
anim Posted February 17, 2020 Share Posted February 17, 2020 11 minutes ago, younglegend said: Nor does hou.hscript() hou.hscript("opunhide Sop point") should work 1 Quote Link to comment Share on other sites More sharing options...
younglegend Posted February 17, 2020 Author Share Posted February 17, 2020 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 Quote Link to comment Share on other sites More sharing options...
anim Posted February 17, 2020 Share Posted February 17, 2020 (edited) 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 February 17, 2020 by anim 1 Quote Link to comment Share on other sites More sharing options...
younglegend Posted February 17, 2020 Author Share Posted February 17, 2020 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.