nodeslicer/infra/blender/blender_bridge.py
2026-10-14 12:02:15 +03:00

15 lines
No EOL
533 B
Python

from __future__ import annotations
def get_all_children(obj, visited=None):
if visited is None:
visited = set()
children = []
children_attr = getattr(obj, "children", [])
if "Mock" in type(children_attr).__name__ or not isinstance(children_attr, (list, tuple, set)):
return []
for child in children_attr:
if child not in visited:
visited.add(child)
children.append(child)
children.extend(get_all_children(child, visited))
return list(set(children))