Finding a camera under a null and activate it

On 12/01/2016 at 06:30, xxxxxxxx wrote:

Hi Community,

i have a noobish python question, but maybe someone can help me out:

i have a certain null object and somewhere under that null is a camera.
I now need some code which iterates through the hierarchy of that null (starting from that null), testing if there's a camera nested and then activate it as scene camera.

I know how to activate the Camera with SetSceneCamera() but i'm stuck in this iteration process.

Thanks in advance! 🙂
Greetings, Martin

On 12/01/2016 at 10:53, xxxxxxxx wrote:

Scroll down to the Python section on this page:


EDIT: Corrected url

On 13/01/2016 at 01:23, xxxxxxxx wrote:

@Bonsak: you links is broken. You find the content of the former C4DProgramming blog now also on

There are ways for both recursive and non-recursive hierarchy iterations:

best wishes,

On 13/01/2016 at 01:33, xxxxxxxx wrote:

Thanks Sebastian and bonsak! That should help!

On 13/01/2016 at 16:14, xxxxxxxx wrote:

@Sebastian Thanks.