| 1234567891011121314151617181920212223 |
- Undo/Redo can be problematic when moving objects via transform gizmos
- - Although I can just trigger it on mouse up
- - CmdMoveSO, CmdRotateSO, CmdScaleSO
- It will also be problematic when editing text fields
- - Technically I can register each character as its own undo operation
- Then when I leave the text field I register the entire change?
- How will I detect changes in the inspector?
- - Just use overriden GUIElements that detect focus lost and changes
- Multiple stacks
- - Used for pushing finer or more grained commands
- - 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.
- Then I register each invidual keystroke as a separate command. Once the InputBox loses focus though I do UndoRedo.removeStack.
- How do I register undo/redo on generic properties?
- - Just use RTTI names for updating/reading those properties
- - How will I deal with arrays?
- - Just save/restore the entire array, it should be no different than single fields
- - What about C# stuff?
- - For each Serializable class, on re-compile I go and create instances of "ScriptRTTIType"
- - In constructor that class iterates over all serializable fields in the C# class and fills the mFields array same as custom RTTI classes do
|