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
    • Recent
    • Tags
    • Users
    • Login

    Delete Without Children

    Scheduled Pinned Locked Moved SDK Help
    11 Posts 0 Posters 958 Views
    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 Offline
      Helper
      last edited by

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

      On 26/01/2010 at 03:14, xxxxxxxx wrote:

      CallCommand(...) automatically adds an undo step.

      cheers,
      Matthias

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

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

        On 26/01/2010 at 03:21, xxxxxxxx wrote:

        well, in my case it just don't work:)

        every step, until this command is called, works with UNDO. But when I add this call command function, I need to press 2 times UNDO button to come back to original state:(

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

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

          On 26/01/2010 at 03:58, xxxxxxxx wrote:

          Originally posted by xxxxxxxx

          ...I need to press 2 times UNDO button to come back to original state...

          As I said CallCommand() adds automatically an undo step. You can't collect CallCommand() undo steps to undo them all in one go.

          cheers,
          Matthias

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

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

            On 26/01/2010 at 04:31, xxxxxxxx wrote:

            I see:( That's sad:(

            But maybe there's a different way to make the same action as this CallCommand(1019951); // Delete Without Children does? I mean instead of calling command, I could code some lines to perform this particular action?

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

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

              On 26/01/2010 at 05:57, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              I see:( That's sad:(

              But maybe there's a different way to make the same action as this CallCommand(1019951); // Delete Without Children does? I mean instead of calling command, I could code some lines to perform this particular action?

              Yes, you can. Do the according actions yourself. Copy Children -> Delete Original hierarchy -> ReInsert copied children-> Add Undo.

              You find all necessary information on the operations here in the forum and in the docs.

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

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

                On 26/01/2010 at 06:15, xxxxxxxx wrote:

                this method you described sounds good, but unfortunately I have no clue how to COPY object:(( For deleting and inserting, I think I can handle, but COPYING - please help.

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

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

                  On 26/01/2010 at 08:21, xxxxxxxx wrote:

                  Please, guys, help.

                  I have a null object as a parent and a cube as a child of that null. Null object has one position coordinates, cube has different coordinates. I need to move that cube out of that null object but still stay at same position. I mean cubes position should be changed, when it was pulled out the null.

                  That is why I use this Delete Without Children command, but I cannot set UNDO step here.

                  Man, I cannot figure this out by myself how to make it works. Please, guys, help me with this little script:(

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

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

                    On 27/01/2010 at 08:30, xxxxxxxx wrote:

                    Here is a COFFEE function that does exactly the same as Delete Without Children but you can insert in your Start/EndUndo calls. Basically it steps through the hierarchy of the selected object and removes the child objects and inserts them in the document's top hierarchy. Then it deletes the original selected object.

                      
                    DeleteWithoutChildren(doc,obj)  
                    {  
                      var child = obj->GetDown();  
                      
                      while (child)  
                      {  
                          var orig = child;  
                          child = child->GetNext();  
                      
                          doc->AddUndo(UNDO_OBJECT_DEL,orig);  
                          orig->Remove();  
                            
                          doc->InsertObject(orig,NULL,NULL);  
                          doc->AddUndo(UNDO_OBJECT_NEW,orig);  
                      }  
                      
                      doc->AddUndo(UNDO_OBJECT_DEL,obj);  
                      obj->Remove();  
                    }  
                      
                    main(doc,op)  
                    {  
                      doc->StartUndo();  
                      DeleteWithoutChildren(doc,doc->GetActiveObject());  
                      doc->EndUndo();  
                    }  
                    

                    cheers,
                    Matthias

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

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

                      On 28/01/2010 at 06:20, xxxxxxxx wrote:

                      highly appreciated, Matthias. Thank you very much.

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

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

                        On 28/01/2010 at 06:30, xxxxxxxx wrote:

                        FYI, there was a little mistake in the code of my last post.

                        doc- >AddUndo(UNDO_OBJECT_NEW,orig) has to called after inserting the object.

                        I corrected the code.

                        cheers,
                        Matthias

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