UndoRedo.txt 1.3 KB

1234567891011121314151617181920212223
  1. Undo/Redo can be problematic when moving objects via transform gizmos
  2. - Although I can just trigger it on mouse up
  3. - CmdMoveSO, CmdRotateSO, CmdScaleSO
  4. It will also be problematic when editing text fields
  5. - Technically I can register each character as its own undo operation
  6. Then when I leave the text field I register the entire change?
  7. How will I detect changes in the inspector?
  8. - Just use overriden GUIElements that detect focus lost and changes
  9. Multiple stacks
  10. - Used for pushing finer or more grained commands
  11. - e.g. when starting an edit on an InputBox I do UndoRedo.newStack which returns an unique index I provide when adding commands to UndoRedo.
  12. Then I register each invidual keystroke as a separate command. Once the InputBox loses focus though I do UndoRedo.removeStack.
  13. How do I register undo/redo on generic properties?
  14. - Just use RTTI names for updating/reading those properties
  15. - How will I deal with arrays?
  16. - Just save/restore the entire array, it should be no different than single fields
  17. - What about C# stuff?
  18. - For each Serializable class, on re-compile I go and create instances of "ScriptRTTIType"
  19. - In constructor that class iterates over all serializable fields in the C# class and fills the mFields array same as custom RTTI classes do