Created
February 2, 2021 17:34
-
-
Save mp5gosu/c99a7acf018426b8700122d4a65eaf87 to your computer and use it in GitHub Desktop.
Cinema 4D Hierarchy Iterator helper for iterating over all object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def GetNextObject(op, op_stop=None): | |
""" | |
Hierarchy iteration helper from https://developers.maxon.net/?p=596 | |
:param op_stop: The object to stop at. Returns None when this object is found. | |
:type op_stop: c4d.BaseObject | |
:param op: the object to get the next node from | |
:return: The next object | |
""" | |
if op is None: | |
return None | |
if op.GetDown(): | |
return op.GetDown() | |
while not op.GetNext() and op.GetUp(): | |
op = op.GetUp() | |
if op == op_stop: | |
return None | |
if op == op_stop: | |
return None | |
return op.GetNext() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment