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

    addUndo in CallCommand?

    General Discussion
    0
    10
    1.5k
    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 20/11/2012 at 15:41, xxxxxxxx wrote:

      This is my script... but not work...

      main(doc,op)
      {
      doc->StartUndo();
      CallCommand(1011183); // Estrudi
      tool()#MDATA_EXTRUDE_OFFSET=100;
      tool()#MDATA_EXTRUDE_CREATECAPS=TRUE;
      CallButton(tool(), MDATA_APPLY); // Esegue il Comando
      doc->AddUndo(MDATA_EXTRUDE_OFFSET, doc);

      CallCommand(450000004); // Estrudi Internamente
      tool()#MDATA_EXTRUDEINNER_OFFSET=10;
      tool()#MDATA_EXTRUDEINNER_ANGLE=1.571;
      CallButton(tool(), MDATA_APPLY); // Esegue il Comando
      doc->EndUndo();

      }

      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 21/11/2012 at 00:34, xxxxxxxx wrote:

        doc->AddUndo(MDATA_EXTRUDE_OFFSET, doc);
        

        Should be changed with:

        doc->AddUndo(UNDOTYPE_CHANGE, op);
        
        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 21/11/2012 at 04:44, xxxxxxxx wrote:

          not work... not undo...

          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 21/11/2012 at 04:52, xxxxxxxx wrote:

            Your code only add an undo on the Extrude Inner changes.

            EDIT: Ok, I see what you want to do.
            AddUndo() always has to be called before a change is made.
            So if you want to be able to undo extrude changes, your code should be:

            main(doc,op)
            {
            doc->StartUndo();
              
            doc->AddUndo(UNDOTYPE_CHANGE, op);
            CallCommand(1011183);
            tool()#MDATA_EXTRUDE_OFFSET=100;
            tool()#MDATA_EXTRUDE_CREATECAPS=TRUE;
            CallButton(tool(), MDATA_APPLY);
              
            doc->AddUndo(UNDOTYPE_CHANGE, op);
            CallCommand(450000004);
            tool()#MDATA_EXTRUDEINNER_OFFSET=10;
            tool()#MDATA_EXTRUDEINNER_ANGLE=1.571;
            CallButton(tool(), MDATA_APPLY);
              
            doc->EndUndo();
            }
            

            This script adds 2 undo: one for the Extrude and another for the Extrude Inner.

            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 23/11/2012 at 09:32, xxxxxxxx wrote:

              Yannick Puech, in possible to annull in one undo click, 2 callcommand?
              Extrude and Extrude Inner? 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 24/11/2012 at 11:03, xxxxxxxx wrote:

                Up

                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 24/11/2012 at 16:35, xxxxxxxx wrote:

                  To the best of my knowledge, CallCommand() can't be included in your own
                  Undo stack. They always follow the document itself.
                  But most CallCommand()'s can be executed as SendModellingCommand()'s instead
                  and thus can be controlled by your own Undo stack.

                  Cheers
                  Lennart

                  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 25/11/2012 at 06:48, xxxxxxxx wrote:

                    tcastudio, how is this code, with SendModellingCommand() ?
                    Thanks! 
                    smain(doc,op)
                    {
                    doc->StartUndo();

                    doc->AddUndo(UNDOTYPE_CHANGE, op);
                    CallCommand(1011183);
                    tool()#MDATA_EXTRUDE_OFFSET=100;
                    tool()#MDATA_EXTRUDE_CREATECAPS=TRUE;
                    CallButton(tool(), MDATA_APPLY);

                    doc->AddUndo(UNDOTYPE_CHANGE, op);
                    CallCommand(450000004);
                    tool()#MDATA_EXTRUDEINNER_OFFSET=10;
                    tool()#MDATA_EXTRUDEINNER_ANGLE=1.571;
                    CallButton(tool(), MDATA_APPLY);

                    doc->EndUndo();
                    }

                    Sorry for my bad English

                    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 25/11/2012 at 09:35, xxxxxxxx wrote:

                      You call the tool you want in the SendModelingCommand()
                      Before that you make a BaseContainer setting the values
                      you want (you can select the tool and from its AM, drag and
                      drop the parameters you want into the scripts manager).

                      In the SendModelingCommand, you pass doc as NULL and
                      you have control over your own Undo stack.

                      Any particular reason why you don't want to use Python?

                      Cheers
                      Lennart

                        
                      main(doc,op)   
                      {   
                      doc->StartUndo();   
                      doc->AddUndo(UNDO_OBJECT,op);   
                        
                      var bc_A = new(BaseContainer);   
                      bc_A->SetData(MDATA_EXTRUDE_OFFSET,100.0);   
                      bc_A->SetData(MDATA_EXTRUDE_CREATECAPS,TRUE);   
                      SendModelingCommand(   
                      ID_MODELING_EXTRUDE_TOOL,   
                      NULL,   
                      op,   
                      bc_A,   
                      MODELINGCOMMANDMODE_POLYGONSELECTION);   
                        
                      var bc_B = new(BaseContainer);   
                      bc_B->SetData(MDATA_EXTRUDEINNER_OFFSET,10.0);   
                      bc_B->SetData(MDATA_EXTRUDEINNER_ANGLE,Degree(90.0) );   
                      SendModelingCommand(ID_MODELING_EXTRUDE_INNER_TOOL,   
                      NULL,   
                      op,   
                      bc_B,   
                      MODELINGCOMMANDMODE_POLYGONSELECTION);   
                        
                      op->Message(MSG_UPDATE);   
                      doc->EndUndo();   
                        
                      }
                      
                      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 25/11/2012 at 09:54, xxxxxxxx wrote:

                        Thank you very much, for your courtesy 🙂

                        don't use Python because I did not find many documentations with examples...
                        hopefully soon switched to python

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