What you need is a recursive function

http://www.python-course.eu/recursive_functions.php

http://en.m.wikipedia.org/wiki/Graph_traversal
  ( depth first approach is good for all things Maya related )

  Basically it's a function that keeps calling itself until it doesn't find any 
further branches to climb

  Works great in Maya for all things connected to any other thing, similar to 
how the Houdini tree traversal worked before they botched the core traversal 
with subnets..

It's quite fun to write, in pseudo-code ( am on a phone, just answering since 
you haven't gotten one yet, will send you an actual example later ) :

Def crawl:
  For thing found:
    Tag checked
    Call crawl on all results
  Return

Eventually it runs out of things to do and returns, kind of like a while loop 
but instead of a parameter that stops it, it always stops when there is nothing 
else to do.

  Hope this helps, and you have fun reading the links, the wording in there 
sounds a lot more than the trick is.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/6f49f9a3-5857-44fa-993e-167c860b774a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to