Browse Source

updated documentation for undo/redo commands

Daniel 9 years ago
parent
commit
7241967b19
1 changed files with 14 additions and 0 deletions
  1. 14 0
      editor/docs/Implementing additional commands for undo-redo.md

+ 14 - 0
editor/docs/Implementing additional commands for undo-redo.md

@@ -7,6 +7,18 @@ After evaluating different design patterns for undo/redo we decided to use the [
 
 This means that every action is encapsulated in a command-object which contains all the relevant information to restore the previous state.
 
+In our implementation we store the old and the new state separately (we don't store the complete state but rather the attribute and value which has changed).
+It would also be possible to only store the difference between the old and the new state.
+
+**Before implementing your own command you should look if you can't reuse one of the already existing ones.**
+
+For numbers, strings or booleans the CmdSet...Value-commands can be used.
+Then there are separate commands for:
+- setting a color property (THREE.Color)
+- setting maps (THREE.Texture)
+- setting geometries
+- setting materials
+- setting position, rotation and scale
 
 ### Template for new commands ###
 
@@ -102,3 +114,5 @@ within a short period of time should be merged into one.
 leads to hundreds of minor changes to the x-position.
 The user expectation is not to undo every single change that happened while he dragged
 the mouse cursor but rather to go back to the position before he started to drag his mouse.
+
+When editing a script the changes are also merged into one undo-step.