ModifyObject and undos

On 21/03/2013 at 15:17, xxxxxxxx wrote:

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

I'm having a bit of cognitive dissonance concerning how to handle undos for a particular feature of my plugin in progress.  Basically, here is how it is working (without undos being implemented) :

My plugin deformer object is childed to object A.  An object, B, that will be used to deform object A is dropped into a linkbox in the deformer plugin.  In a certain mode, the deformation applied to object A by movement of object B can be retained like an imprint by having the deformer object store the changes in a member array.  This can be done any number of times.

First, because the other objects are being manipulated to obtain these changes, there are no messages sent to my deformer plugin. That rules out messages like MSG_DESCRIPTION_INITUNDO and MSG_DESCRIPTION_USERINTERACTION_END completely for storing undos.

Second, you can't store undos in GetVirtualObject(), ModifyObject(), or CheckDirty() due to the threading context and possible crash response.

I know that I can keep another member array to hold the last imprint action.  But how I would utilize it to create an undo for that action before or after the action occurs without messaging or direct access?