-
Notifications
You must be signed in to change notification settings - Fork 418
Undo redo #4382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Undo redo #4382
Conversation
Testing more systems is definitely welcome! Are you able to add the tests first, or would it not compile? |
I could probably make the tests be the first commit. I only added them when I was trying to figure out why there was a check for frame 0 and why there was a minus 1, but I never did actually figure that out. Both were added with commits that say they fix things without details so I assume they were not super obscure bugs, and probably related to some other code that has since changed. I also don't think the tests are really relevant to the commits that are before the testing commit. I could try to add some more, but most of the changes are in TAStudio logic which isn't easily testable. |
This. |
So it turns out that tying undo batching to TAStudio batching isn't a great idea, because they are two different things and handling the edge cases correctly is confusing. I've re-done this PR (see updated OP for new approach and implications), including more bug fixes and tests. |
Probably, tho can't tell if it has a functional difference too. |
eaf0074
to
27974dc
Compare
Force push added a new commit batching recording mode edits. #2301 should be fully resolved with this. |
Can we go ahead and merge this? |
I don't feel comfortable reviewing >1k LOC changes, especially when I'm not even familiar with the original logic. If you think this is a clear improvement over the previous implementation then I'm personally fine with merging and dealing with the inevitable fallout later in fixup patches. Especially the test infrastructure is probably going to help, there's lots of things that should be verified via tests but building the required test structure around it is hard, so having something to work off of is great. |
I'd like to start with the unit tests. I had a look at them and they're not structured in the usual way, with a |
That's fair. Especially since the original logic was difficult to understand, not well-organized, and inconsistent. I do think this is a clear improvement.
The tests don't all initialize the same way, so I'm not sure Since you said "snipe'd" I will take that to mean you agree that it's fine to merge. |
I will test it in a couple days. Have the branch checked out, just distracted by something else. |
Also remove pointless batch calls.
…at it said it was.
…eeded now and just break things the way you'd expect them to break things. Passes recording undo/redo tests.
…was an internal comment saying it did that, but no explanation for why and it makes no sense UI-wise. Passes DeleteFrames and AllOperationsGiveOneUndo tests
…y can be seen by users of the interface.
…OperationsFlagChanges test.
Fixes: Inserting frames, cloning frames, and Lua edits could result in large numbers of undo actions. Also fixes enabled state of undo and redo menu items.
…hing, instead of doing a manual refresh on undo and everywhere else. Is this actually any better? Another option for undo purposes could be to have Undo/Redo return true/false indicating if the only change was to markers.
…ix a bug that could cause an invalid scroll in undo history form.
…hat only it uses instead of TAStudio worrying about how to batch them.
rebased onto master, will wait for vadosnaprimer's test before merge |
I imagined something like this.
No? It simply means that Morilli coincidentally posted while I was typing. |
That looks absolutely horrid. This is so much more difficult to understand than what I wrote and looks way more error prone and difficult to maintain, since they share code in non-obvious ways. You've also converted some similar tests to a single method with multiple |
Actual bug:
Otherwise things I tried work ok. |
…ld merge unrelated undo actions.
Thanks, good find. I have fixed that bug.
OK to merge? |
If nobody minds. |
@YoshiRulz do you mind? |
I think merging and putting out a release candidate for testing would be a good idea, certainly more useful than a code review from me. |
Fixes various issues with undo and redo, along with a few related things. Most notably, I updated invalidation logic. (Maybe this doesn't belong in this PR? But at least it's related because undo and redo make use of the updates there, that's how I got into it.)
TasMovie's greenzone invalidations are now batched. This takes over one of the jobs that TAStudio's edit batching system was doing (from another recent PR of mine) so that
BeginBatchEdit
and related fucntions are not needed anymore. (but still in use for axis editing, that's a TODO for when I fix axis editing)An invalidation batch represents a set of edits that should be considered one single edit by any code that is only concerned with knowing when the greenzone is invalidated, such as TAStudio wanting to know when it should refresh.
This introduces a small change to Lua behavior with
tastudio.ongreenzoneinvalidated
, in that it is now called less often. (just once per batch) Since it was already not a way for Lua to see every individual edited frame (some edits even in master branch change multiple frames with only one invalidation), this is probably okay. If it isn't okay, we should define in the Lua documentation exactly when it should be called, or provide another way to see when frames are edited.There are new tests. I put together a
FakeEmulator
andFakeMovieSession
to make these tests possible. I just got the tests to run, this may not be the best way to set things up.Questions:
Also I am aware of one issue that persists: If the movie has no inputs and you record a frame (which will be frame 0), then undo that frame record, TAStudio will automatically re-record a blank frame on frame 0 which deletes the redo history. This seems like a minor edge case bug and I don't see an easy fix so it may not be worth fixing.
Check if completed: