GetChildren in c++

On 14/04/2017 at 06:35, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R16 
Platform:   Windows  ;   
Language(s) :     C++  ;

In python you have the nice function GetChildren().
Is there something similar in c++?

I want to get all the children of a cloner after a SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd)


On 17/04/2017 at 08:41, xxxxxxxx wrote:

Hi Pim,

To loop trough all the children of an object (and also gather them into a BaseArray for instance), call GetDown() on the parent to get the first child, then GetNext() on each of the child while the object returned is not nullptr.
Python API GeListNode.GetChildren() is just as simple as this.

On 18/04/2017 at 03:52, xxxxxxxx wrote:

Ok, so I make my own GetChildren();

I am using SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd) to convert a MoGraph Cloner to separate objects (get all the children of the new null).
After that I use a function that uses a C4DObjectList.

Can I use the result of SendModelingCommand (a AtomArray* result) directly or should I use convert the AtomArray to a C4DObjectList or should I use a BaseArray?

Is C4DObjectList the same as a BaseArray?


On 18/04/2017 at 11:59, xxxxxxxx wrote:


Originally posted by xxxxxxxx

Can I use the result of SendModelingCommand (a AtomArray* result) directly or should I use convert the AtomArray to a C4DObjectList or should I use a BaseArray?
Is C4DObjectList the same as a BaseArray?

The result of SendModelingCommand()+MCOMMAND_CURRENTSTATETOOBJECT for a Cloner is a Null object with all the clones as children.
C4DObjectList was designed to be used with SelectionListCreate() for editor/view selection. It has nothing to do with BaseArray.
I think using this class to just store objects is too much overhead. You should better use BaseArray class.

On 19/04/2017 at 05:05, xxxxxxxx wrote:

Ok, thanks you.