Jump to content

Selecting nodes by name


MikeRhone

Recommended Posts

Hey all. I'm trying to evolve a procedure I found here: . Basically, I want to be able to return a list of objects based on their name. I'm pretty new to OOP, but I know MEL well. Is this the standard way to select by name/type in Houdini through Python?

My code:

def printSearch(term):

li = []

for n in hou.node('/').allSubChildren():

if n.name().startswith(term):

#print n.path()

li.append(n.path)

printSearch("Rock")

print li

Error:

Traceback (most recent call last):

File "tool_5", line 11, in <module>

NameError: name 'li' is not defined

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