Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Remove all child objects

    SDK Help
    0
    5
    339
    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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 30/10/2005 at 04:59, xxxxxxxx wrote:

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

      ---------
      Hi,
       
      I need a way to remove all the children of a BaseObject
       
      This is what I currently have

          
          
          
          
          
          
          
          void RemoveChildObjects(BaseObject* op)
          
          
          
          
          {
          
          
          
          
          BaseObject *child = op->GetDown();
          
          
          
          
          while(child)
          
          
          
          
          {
          
          
          
          
          child->Remove();
          
          
          
          
          BaseObject::Free(child);
          
          
          
          
          child=child->GetNext();
          
          
          
          
          }
          
          
          
          
          }
          
          
          
      

      But that doesn't work because child becomes NULL after the first BaseObject::Free

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 30/10/2005 at 05:13, xxxxxxxx wrote:

        get the child before you remove the original.

        BaseObject* temp;
        while(child)
        {
        temp = child->GetNext();
        child->Remove();
        BaseObject::Free(child);
        child = temp;
        }

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 30/10/2005 at 06:49, xxxxxxxx wrote:

          why did I think of that
           
          Thanks

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 30/10/2005 at 12:40, xxxxxxxx wrote:

            I have a question indirect to this discussion. Every time that I Remove() something from a document and try to Free() it, Cinema 4D crashes (Objects, Tags, Materials, you name it). I have since determined that either Cinema 4D handles the deallocation or it is also possible that as long as the object is tied to an Undo, it cannot be deleted (thereafter handled by Cinema 4D). I always add AddUndo(UNDO_NEW) when inserting just-created objects. Could this be why I can't Remove()-Free()?

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 01/11/2005 at 06:21, xxxxxxxx wrote:

              Hi Kuro,

              I don´t think it could be the cause for the crashing. Maybe another plugin is the cause? Try to remove all other plugins, this may help sometimes. Otherwise I don´t see a reason for crashing with Remove & Free(). Never has this issue.

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