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

    Multiple Undos with different objects

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 215 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 28/02/2008 at 05:29, xxxxxxxx wrote:

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

      ---------
      hi all.

      is it possible to have undos of various objects and the document in a single undo block between StartUndo() and EndUndo()?

      >      doc->StartUndo(); \>      doc->AddUndo(UNDO_CHANGE, doc);   // no idea how to place this \>      Bool solo= solo_objects(doc, doc->GetFirstObject());   // function contains undos for objects \>      if(solo) doc->GetDataInstance()->GetContainerInstance(SOLO_ID)->SetLong(ID_SOLO_SET, solo); \>      else doc->GetDataInstance()->RemoveData(SOLO_ID); \>      EventAdd(); \>      doc->EndUndo(); \>

      in the code above i have that recursive solo_objects function with an AddUndo() for every object in the scene/object manager. this works fine, everything is undone as intended except for the change to the document. and it doesnt matter whether i put doc->AddUndo(UNDO_CHANGE, doc) before that solo_objects function or inside it, right before the doc is modified. so is it possible at all? btw the only thing i do with the doc is storing a subcontainer in the doc's container but after clicking UNDO the container in the doc is still there, unlike the containers and changes to all the objects - that works fine.
      i hope that was clear enough... thank you very much.

      Yakuza

      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/02/2008 at 10:24, xxxxxxxx wrote:

        Move your StartUndo() and EndUndo() out of the recursion and everything inbetween will be treated as one undo. StartUndo()/EndUndo() represents a single undo step. Simple as that.

        Unfortunately, you can't do undos for the document itself. Only document items can have undos stored (objects, tags, materials, timeline elements, etc.).

        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/02/2008 at 14:33, xxxxxxxx wrote:

          hi Robert.

          thank you for your clarification, so it seems i got everything right. there were no start/endundo() calls in the recursive function, they embrace it (see above code) and that worked well except for the document. now that you confirmed undos do not work for the doc itself i dont need to waste time making it work and i guess my first c++ plugin is finished 😄

          cheers
          Yakuza

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