Delete Without Children



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

    On 26/01/2010 at 02:51, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R11.5 
    Platform:      Mac OSX  ; 
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hi there. That's my first post here:)
    Feeling kinda newbee :)))

    Any ways, I have a little question. in COFFEE I am trying to use CallCommand(1019951); // Delete Without Children command. Unfortunatly, I cannot find a way to add Undo step to it. Here's a code:

    	var deleteme = doc->GetActiveObject();
    	deleteme->SetBit(BIT_ACTIVE);
    	doc->AddUndo(UNDO_DELETE, deleteme);
    
    	CallCommand(1019951); // Delete Without Children
    

    :((((
    Any help to solve this would be sweet:)
    Thanks in advance.

    Tomas Sinkunas.



  • 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



  • 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:(



  • 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



  • 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?



  • 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.



  • 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.



  • 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:(



  • 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



  • 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.



  • 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


Log in to reply