C4D Crashes on Getting All Specific Type of Objects
bentraje last edited by
I'm trying list an object with a specific type using the recursive code from the documentation. But currently, it crashes/freezes the program.
Here's the code so far:
def recurse_hierarchy(op): obj_list =  while op: if op.GetType() == c4d.Ospline: # the line where it freezes obj_list.append(op) obj_list+= recurse_hierarchy(op.GetDown()) op = op.GetNext() return obj_list all_spline_objects = recurse_hierarchy(doc.GetFirstObject())
Is there a way around this?
zipit last edited by
you have to unindent
op = op.GetNext()one tab or the
while loopcondition will always be
Trueunless your whole document consists of spline objects.
m_magalhaes last edited by m_magalhaes
nothing to add, as @zipit answer (thanks again), be careful to change op or it will be "true" for ever.
And please, don't forget to use the "Ask as question" mark for the thread and solved ^^
bentraje last edited by bentraje
Thanks for the response and clarification. Works as expected
Sorry about that. Will be more careful next time.