fragcastle / fragengine

our very own game engine and editor.
2 stars 0 forks source link

Level Designer should be able to undo changes in FragEd #6

Open codeimpossible opened 11 years ago

codeimpossible commented 11 years ago

A level designer needs to be able to undo changes made in FragEd.

codeimpossible commented 11 years ago

Some links on undo/redo in c# winforms:

http://stackoverflow.com/questions/597792/c-how-to-implement-good-and-efficient-undo-redo-functionality-for-a-textbox http://msdn.microsoft.com/en-us/library/system.componentmodel.ieditableobject.aspx http://www.codeproject.com/Articles/33384/Multilevel-Undo-and-Redo-Implementation-in-C-Part http://pradeep1210.wordpress.com/2011/04/09/add-undoredo-or-backforward-functionality-to-your-application/

I don't want to spend a lot of time with the codebase to get this feature in. This is a must-have for v1 so if we have to compromise on the cleanliness of our codebase to get this done then we should do that.

codeimpossible commented 11 years ago

I definitely wish I had attempted a different development pattern for our FragEd code. It probably would have made this a lot easier to do.

codeimpossible commented 11 years ago

Did some research on Undo/Redo support into FragEd. I'm thinking that the easiest way will be to add a class UndoStep:

public class UndoStep {
    public object PreviousValue { get; set; }
    public object NewValue { get; set; }
    public string Type { get; set; }
}

and create a List<UndoStep> called UndoHistory in each Level Editor Form. When changes are made via the form new UndoSteps will be added to the UndoHistory. When a user triggers an Undo we'll invoke a handler, determined by the Type property, with the two arguments PreviousValue and NewValue. The handler will be responsible for performing the actual Undo/Redo.

codeimpossible commented 11 years ago

When a user presses [ctrl] + [z], what happens next?

codeimpossible commented 10 years ago

going to move this out of v1 milestone. This will take a long time and shouldn't block our first release.

jbubriski commented 10 years ago

What are the pain points that are going to be caused by not having an undo feature? Maybe we can handle those few scenarios with different behaviors... Ex. if the user deletes an object from the level, maybe we just store it's data in a "deleted entities" collection so they can grab it back if they need it. Just a thought.

On Sun, Nov 17, 2013 at 6:22 PM, Jared Barboza notifications@github.comwrote:

going to move this out of v1 milestone. This will take a long time and shouldn't block our first release.

— Reply to this email directly or view it on GitHubhttps://github.com/fragcastle/fragengine/issues/6#issuecomment-28667430 .