Observer behaviour on undo/redo

sketchup

#1

Hi,

is there any simple method to know exactly what was undone/redone using observers?

In most cases all the observers are called, but there are some corner cases when that does not happen.

e.g. moving a ComponentInstance

  1. open new project
  2. register observers (ModelObserver, EntitiesObserver)
  3. move guy to a new position
    –> ModelObserver.onTransactionStart
    –> EntitiesObserver.onElementModified (componentInstance)
    –> ModelObserver.onTransactionCommit

so far everything seems ok

  1. undo
    –> EntitiesObserver.onElementModified (componentDefinition)
    –> ModelObserver.onTransactionUndo

  2. redo
    –> ModelObserver.onTransactionRedo

(for better readability I skipped onElementModified for attributeDictionaries)

My question: How can I know the changes done during Undo? How can I know the changes done during Redo?

Thanks for your help,
Simon


#2

Nothing simple. The undo / redo stacks are not exposed in the API.
But there is a undo log file that you might watch. I think it is in the TEMP directory.

Also see this GitHub repo by the SketchUp team: