Skip to content
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

Fix lost connections when restoring automation clip #7002

Merged
merged 7 commits into from
May 19, 2024

Conversation

szeli1
Copy link
Contributor

@szeli1 szeli1 commented Nov 25, 2023

this fixes #6829

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

@szeli1 szeli1 changed the title AutomationTrack_redo_fixed AutomationClip_redo_fixed Nov 25, 2023
Copy link
Member

@zonkmachine zonkmachine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, fix confirmed!

@DomClark
Copy link
Member

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.

@zonkmachine
Copy link
Member

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.

@szeli1
Copy link
Contributor Author

szeli1 commented Nov 26, 2023

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
Copy link
Contributor Author

szeli1 commented Nov 26, 2023

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.

@DomClark
Copy link
Member

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?

@szeli1
Copy link
Contributor Author

szeli1 commented Nov 27, 2023

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 szeli1 force-pushed the automation_undo_connection_bug branch from 5e70015 to 2122138 Compare November 27, 2023 20:42
@szeli1
Copy link
Contributor Author

szeli1 commented Nov 27, 2023

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)

@DomClark
Copy link
Member

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.

@szeli1
Copy link
Contributor Author

szeli1 commented Nov 30, 2023

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?

@zonkmachine
Copy link
Member

This PR has conflicts with master.

@szeli1
Copy link
Contributor Author

szeli1 commented Apr 13, 2024

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

@zonkmachine
Copy link
Member

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
Copy link
Member

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.

@szeli1
Copy link
Contributor Author

szeli1 commented Apr 13, 2024

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.

@zonkmachine
Copy link
Member

Git is happy now.

@zonkmachine zonkmachine added this to the 1.3 milestone May 9, 2024
@Rossmaxx
Copy link
Contributor

Rossmaxx commented May 9, 2024

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

@zonkmachine
Copy link
Member

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

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

@DomClark DomClark changed the title AutomationClip_redo_fixed Fix lost connections when restoring automation clip May 19, 2024
@DomClark DomClark merged commit 76d8f65 into LMMS:master May 19, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants