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

    NodeData Undo

    Cinema 4D SDK
    r20 r19 r21 c++
    3
    13
    1.9k
    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.
    • C4DSC
      C4DS @Manuel
      last edited by

      @m_magalhaes
      I did try with DESCFLAGS_SET::
      NONE
      PARAMSET
      USERINTERACTION

      But none of these 3 triggered the message.
      I will try to send the messaeg myself.

      1 Reply Last reply Reply Quote 0
      • C4DSC
        C4DS @Manuel
        last edited by

        @m_magalhaes said in NodeData Undo:

        uu.descid = &m_LinkID;

        Seeing this makes me assume I will need to provide a member variable for each description ID I intend to have an undo for?
        And I would need to send a message for each and every description ID?

        I'd much rather prefer going with the single call to perform an AddUndo instead.

        1 Reply Last reply Reply Quote 0
        • ManuelM
          Manuel
          last edited by

          Hi,

          well, the structure DescriptionInitUndo have a descid variable you can provide.

          As you react to MSG_DESCRIPTION_INITUNDO this descid can be whatever you need to trigger the action you want.

          Cheers,
          Manuel

          MAXON SDK Specialist

          MAXON Registered Developer

          C4DSC 1 Reply Last reply Reply Quote 0
          • C4DSC
            C4DS @Manuel
            last edited by

            @m_magalhaes said in NodeData Undo:

            well, the structure DescriptionInitUndo have a descid variable you can provide.

            As you react to MSG_DESCRIPTION_INITUNDO this descid can be whatever you need to trigger the action you want.

            Right, but that uu.descid expects a pointer.
            Which means you cannot simply pass the description ID of a gadget, but need to allocate some memory and keep that active until the message has been processed.

            With RECTANGLE_ROTATION_ID defined in the desription header
            I can simply set the parameter via:

            node->SetParameter(RECTANGLE_ROTATION_ID ...
            

            I cannot do:

            uu.descid = RECTANGLE_ROTATION_ID
            
            1 Reply Last reply Reply Quote 0
            • ManuelM
              Manuel
              last edited by

              Hi,

              this should work.

              DescriptionInitUndo uu;
              uu.doc = doc;
              // define the descid
              
              uu.descid = &DescID(RECTANGLE_ROTATION_ID);
              // or 
              DescID tid = MSG_DESCRIPTION_INITUNDO;
              uu.descid = &tid;
              
              

              Cheers,
              Manuel

              MAXON SDK Specialist

              MAXON Registered Developer

              C4DSC 1 Reply Last reply Reply Quote 0
              • C4DSC
                C4DS @Manuel
                last edited by

                @m_magalhaes said in NodeData Undo:

                this should work.

                DescriptionInitUndo uu;
                uu.doc = doc;
                uu.descid = &DescID(RECTANGLE_ROTATION_ID);

                Unfortunately!
                That's exactly what I had tried from the start but while the message gets delivered the descid didn't survive.

                848746f2-955f-4c75-96d2-1a8c3386a3bb-image.png

                1 Reply Last reply Reply Quote 0
                • C4DSC
                  C4DS
                  last edited by

                  Looking at the content of uData.descid when manually changing the gadget, I see it contains
                  10050 = the ID of the description float field ((RECTANGLE_ROTATION_ID)
                  1057224 = the plugin ID of the NodeData description.

                  Should the plugin ID of the NodeData description be passed somewhere during:

                  DescriptionInitUndo uu;
                  uu.doc = doc;
                  uu.descid = &(RECTANGLE_ROTATION_ID);
                  obj->Message(MSG_DESCRIPTION_INITUNDO, &uu);
                  

                  ?

                  1 Reply Last reply Reply Quote 0
                  • ManuelM
                    Manuel
                    last edited by

                    Hi,

                    Sorry i forgot this thread. what version of cinema4D are you using (just in case)

                    Cheers,
                    Manuel

                    MAXON SDK Specialist

                    MAXON Registered Developer

                    C4DSC 1 Reply Last reply Reply Quote 0
                    • C4DSC
                      C4DS @Manuel
                      last edited by

                      @m_magalhaes
                      At the moment I am using R20.

                      1 Reply Last reply Reply Quote 0
                      • ManuelM
                        Manuel
                        last edited by

                        Hi,

                        sorry for that huge delay.

                        I tried again and it's working even on R20. The descid isn't something to consider. I mean i have the same kind of result, count = 0 and 0x00000 address but it's working.

                        The undo is added correctly, if the undo arrow is grey out, it become active. That mean an undo step has been added.
                        Just in case, what's important is to call the message before the change happen because CHANGE_SMALL must be called before.

                        Cheers,
                        Manuel

                        MAXON SDK Specialist

                        MAXON Registered Developer

                        1 Reply Last reply Reply Quote 0
                        • ferdinandF
                          ferdinand
                          last edited by

                          Hello @C4DS,

                          without any further questions, we will consider this topic as solved by Monday, the 25th and flag it accordingly.

                          Thank you for your understanding,
                          Ferdinand

                          MAXON SDK Specialist
                          developers.maxon.net

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