Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    GetChildren in c++

    SDK Help
    0
    5
    525
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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)

      -Pim

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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?

          -Pim

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            Hi,

            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.

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

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

              Ok, thanks you.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post