Undoing a BaseDocument container change



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

    On 09/11/2005 at 16:11, xxxxxxxx wrote:

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

    ---------
    Hi,
     
    I have a dialog that adds new items to the active BaseDocuments basecontainer.
     
    I would like to support an Undo feature, but im not sure how to make it work in this case. My assumption is this.

        
        
        
        
        
        
        
        doc->StartUndo();
        
        
        
        
        doc->AddUndo(UNDO_CHANGE_SMALL,doc); 
        
        
        
        
        CallFunctionToChangeBaseContainer()
        
        
        
        
        doc->EndUndo();
        
        
        
        
        EventAdd();
        
        
        
    

    but this doesn't seem to work



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

    On 10/11/2005 at 06:57, xxxxxxxx wrote:

    Howdy,

    Are you using any "AddUndo()" lines within the function that you're calling? I think once you branch to another function the undo's might need to be in that function.

    Adios,
    Cactus Dan



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

    On 10/11/2005 at 08:49, xxxxxxxx wrote:

    I tried that, made no difference.
     
    The way Im testing it is Im creating a new document with c4d, I click a button in my dialog that simple adds a few items to the documents base container.
     
    After I added the data I call EventAdd so C4D gets updated, expecting the Undo button to be enabled. But it doesn't
     
    I havn't add much experience with the Undo feature of the SDK, so I might be looking at it wrong



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

    On 10/11/2005 at 22:00, xxxxxxxx wrote:

    I could be incorrect here since I haven't actually done something like this, but is it even possible to add an undo for the document itself? You can do it for objects, tags, materials, tracks, sequences, keys, and so on. But maybe the undos cannot be self-referential - the document adding itself to the undo stack - or are not configured that way. Otherwise, your methodology is correct.



  • On 05/05/2014 at 16:37, xxxxxxxx wrote:

    Yes, I'd be really curious to know if this is possible. I've created a command plugin which calls a dialog that saves/loads it's data in the document's container. I'd like to be able to add undo calls to go back to previous states in the dialog - but best I can tell, there's no way to undo changes to the document's container. Which is really unfortunate, as this is where (at least in part) we've been told to store plugin data.



  • On 06/05/2014 at 02:19, xxxxxxxx wrote:

    Seems not to work for the document. I've forwarded the question to the developers.
    Even via the UI, changing (for instance) the document FPS can not be undone.

    -Niklas



  • On 06/05/2014 at 08:10, xxxxxxxx wrote:

    I think storing the data into one of the SceneHooks that is always available in the document
    should be fine as well. You can add the SceneHook to AddUndo() then.

    ID_BS_HOOK is the ID of the "BaseSettings Hook". Just use BaseDocument::FindSceneHook().

    -Niklas


Log in to reply