Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

make more operations undo-able #18

Open
radiatoryang opened this issue Oct 15, 2018 · 0 comments
Open

make more operations undo-able #18

radiatoryang opened this issue Oct 15, 2018 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@radiatoryang
Copy link
Owner

to get undo support working, Merino uses a secret temporary ScriptableObject (MerinoTreeData serializedTreeData) so that it can use Undo.RecordObject() with it... but I think I don't quite understand the undo system well enough to fix various bugs / extend the functionality

Merino also keeps its own stack of undo snapshots, so that it can compare those snapshots to Unity's undo stack, diff strings, and move the keyboard caret cursor back to the undo point (see MerinoEditorWindow.OnUndo())

we still need undo support for:

  • drag and drop in TreeView... reordering tree (maybe hook into OnTreeChanged()?)
  • AddNewNode()
  • DeleteNodes() (this is tricky because I also don't understand the undo system too well, and I suspect you also have to revert the currentFiles and fileToNodeID dictionary as well... should we store this data in serializedTreeData somehow?)

I suspect there's probably some much more elegant way to do all of this, instead of manually recording undo snapshots everywhere in all these different methods... again, help would be appreciated from someone who understands Unity's undo system better, and can explain more about how to handle all this

@radiatoryang radiatoryang added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Oct 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant