Undo for NodeData plugins [SOLVED]

On 26/03/2015 at 07:28, xxxxxxxx wrote:

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


I am trying to get a NodeData plugin react to undo commands. The Plugin is attached to the document via a SceneHookData and inspectable via my own TreeView manager. It's also possible to change it's parameters in the AttributeManager, using the active object manager library.

But these changes in the AM, do not react to undo commands. I tryied to override the NodeData::IsDocumentRelated() and NodeData::GetDocument() Methods, but it didn't work. Maybe i'm doing it wrong or missing something else.

It is basically the same structure which we discussed in this thread and maybe it's part of the same problem.


On 27/03/2015 at 08:12, xxxxxxxx wrote:

Hello Heinrich,

do you process the MSG_DESCRIPTION_INITUNDO?
Your code could look like so:

  DescriptionInitUndo* uData = static_cast<DescriptionInitUndo*>(node);
  if (!uData || !uData->doc)
  uData->doc->AddUndo(UNDOTYPE_CHANGE_SMALL, node);
  return true;

On 27/03/2015 at 09:22, xxxxxxxx wrote:

That did the trick. Thank you very much.