lmms icon indicating copy to clipboard operation
lmms copied to clipboard

AutomationClip_redo_fixed

Open szeli1 opened this issue 2 years ago • 17 comments

this fixes #6829

Now when undeleting an automation clip, it's connections shouldn't be lost.

szeli1 avatar Nov 25 '23 21:11 szeli1

Do projects with a lot of automation still load correctly after this change? It looks like this may resolve IDs too early, so automation clips connected to objects which have not yet been loaded may never be reconnected.

DomClark avatar Nov 25 '23 22:11 DomClark

Do projects with a lot of automation still load correctly after this change? It looks like this may resolve IDs too early, so automation clips connected to objects which have not yet been loaded may never be reconnected.

I've tested the bigger projects like Greippi - Krem Kaakkuja, and EsoXLB - CPU They seem to open correctly.

zonkmachine avatar Nov 26 '23 03:11 zonkmachine

Do projects with a lot of automation still load correctly after this change? It looks like this may resolve IDs too early, so automation clips connected to objects which have not yet been loaded may never be reconnected.

resolveAllIDs gets run for every single restored clip so this shouldn't be a problem, but there is a chance it gets called unnecessarily

szeli1 avatar Nov 26 '23 10:11 szeli1

This should make resolveAllIDs run only once for 1 automation track loading (not a perfect solution). Song.cpp line 1192 is now unnecessarily, but I left it in.

szeli1 avatar Nov 26 '23 13:11 szeli1

Here is an example project that doesn't load properly with this change. It contains an automation clip that is connected to a knob in a later track. When IDs are resolved after loading the automation track, the target knob doesn't yet exist, so the automation isn't reconnected.

AutomationClip::resolveAllIDs should run only once everything has been loaded. Perhaps consider putting it at the end of ProjectJournal::undo and ProjectJournal::redo?

DomClark avatar Nov 27 '23 18:11 DomClark

AutomationClip::resolveAllIDs should run only once everything has been loaded. Perhaps consider putting it at the end of ProjectJournal::undo and ProjectJournal::redo?

I thought about that and to me It looked out of place. In ProjectJournal how would I check if it is necessary to run AutomationClip::resolveAllIDs?

szeli1 avatar Nov 27 '23 18:11 szeli1

AutomationClip::resolveAllIDs should run only once everything has been loaded. Perhaps consider putting it at the end of ProjectJournal::undo and ProjectJournal::redo?

I think I managed to move the AutomationClip::resolveAllIDs into ProjectJournal::undo. (I had issues with git, hopefully it did not cause issues here)

szeli1 avatar Nov 27 '23 20:11 szeli1

I thought about that and to me It looked out of place.

Automation and undo history are some of the uglier bits of LMMS, so where the two intersect, you'll unfortunately have nasty things like this. We want to improve them, but it's a lot of work, there are lots of other things to do, and there's only so much contributor time to go around.

In ProjectJournal how would I check if it is necessary to run AutomationClip::resolveAllIDs?

I'm not sure whether it's worth checking at all, but if you do want to check, have a look at QDomDocument::elementsByTagName, which should provide a concise way to check for the existence of any automationclip tags.

DomClark avatar Nov 28 '23 22:11 DomClark

have a look at QDomDocument::elementsByTagName, which should provide a concise way to check for the existence of any automationclip tags.

implemented, tested it with your example project (and others), should I re request a review?

szeli1 avatar Nov 30 '23 17:11 szeli1

This PR has conflicts with master.

zonkmachine avatar Apr 13 '24 09:04 zonkmachine

I can not see conflicts. I will mark this as resolved (if you agree).

szeli1 avatar Apr 13 '24 15:04 szeli1

I mean this here:

image

If you check the 'Resolve conflicts' button it will show no conflicts but merging into master on the command line there really is unresolved stuff in src/core/Track.cpp. Odd. If you're happy with it as it is, though, then I'm happy.

zonkmachine avatar Apr 13 '24 15:04 zonkmachine

If you're happy with it as it is, though, then I'm happy.

The PR can't actually be merged as it is though. The merge button is greyed out on my side.

zonkmachine avatar Apr 13 '24 15:04 zonkmachine

I will resolve the 0 conflicts. I don't know why git is confused, I eventually deleted all the changes in Track.h in this pr.

szeli1 avatar Apr 13 '24 15:04 szeli1

Git is happy now.

zonkmachine avatar Apr 13 '24 15:04 zonkmachine

From the comments, looks like it was supposed to be merged last month.

Rossmaxx avatar May 09 '24 11:05 Rossmaxx

From the comments, looks like it was supposed to be merged last month.

No. It's awaiting a re-review from Dom.

zonkmachine avatar May 09 '24 11:05 zonkmachine