From 7f1d8782bb45d50ca4356d6345bb24ec1d94ca98 Mon Sep 17 00:00:00 2001 From: szeli1 Date: Sat, 25 Nov 2023 22:32:01 +0100 Subject: [PATCH 1/6] AutomationTrack_redo_fixed --- src/core/Track.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/Track.cpp b/src/core/Track.cpp index b034b95fb14..c65481cd849 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -312,6 +312,11 @@ void Track::loadSettings( const QDomElement & element ) Clip * clip = createClip( TimePos( 0 ) ); clip->restoreState( node.toElement() ); + // loading AutomationClip connections correctly + if (node.nodeName() == "automationclip") + { + AutomationClip::resolveAllIDs(); + } } } node = node.nextSibling(); @@ -653,4 +658,4 @@ BoolModel *Track::getMutedModel() return &m_mutedModel; } -} // namespace lmms \ No newline at end of file +} // namespace lmms From 48e145dd7ebbef5d4d1ebf7b7ff5f18bfe5aaaf4 Mon Sep 17 00:00:00 2001 From: szeli1 Date: Sun, 26 Nov 2023 13:24:41 +0100 Subject: [PATCH 2/6] AutomationClip_loadig_fixed --- src/core/Track.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core/Track.cpp b/src/core/Track.cpp index c65481cd849..fee571488d8 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -312,16 +312,14 @@ void Track::loadSettings( const QDomElement & element ) Clip * clip = createClip( TimePos( 0 ) ); clip->restoreState( node.toElement() ); - // loading AutomationClip connections correctly - if (node.nodeName() == "automationclip") - { - AutomationClip::resolveAllIDs(); - } } } node = node.nextSibling(); } + // loading AutomationClip connections correctly + AutomationClip::resolveAllIDs(); + int storedHeight = element.attribute( "trackheight" ).toInt(); if( storedHeight >= MINIMAL_TRACK_HEIGHT ) { From 71fa244041acc57396ad0f51386ef9ec26516b13 Mon Sep 17 00:00:00 2001 From: szeli1 Date: Sun, 26 Nov 2023 14:04:14 +0100 Subject: [PATCH 3/6] AutomationClip_loadig_fixed_v2 --- src/core/Track.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core/Track.cpp b/src/core/Track.cpp index fee571488d8..988edd2534a 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -296,6 +296,8 @@ void Track::loadSettings( const QDomElement & element ) // m_clips.erase( m_clips.begin() ); } + bool resolveIDs = false; + QDomNode node = element.firstChild(); while( !node.isNull() ) { @@ -312,13 +314,20 @@ void Track::loadSettings( const QDomElement & element ) Clip * clip = createClip( TimePos( 0 ) ); clip->restoreState( node.toElement() ); + if (node.nodeName() == "automationclip") + { + resolveIDs = true; + } } } node = node.nextSibling(); } // loading AutomationClip connections correctly - AutomationClip::resolveAllIDs(); + if (resolveIDs) + { + AutomationClip::resolveAllIDs(); + } int storedHeight = element.attribute( "trackheight" ).toInt(); if( storedHeight >= MINIMAL_TRACK_HEIGHT ) From 2122138a95634707d505ce4f0122c739d1444c38 Mon Sep 17 00:00:00 2001 From: szeli1 Date: Mon, 27 Nov 2023 20:24:08 +0100 Subject: [PATCH 4/6] AutomationClip_redo_moved_to_ProjectJournal --- src/core/ProjectJournal.cpp | 16 ++++++++++++++++ src/core/Track.cpp | 12 ------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/core/ProjectJournal.cpp b/src/core/ProjectJournal.cpp index fc77c98e65d..54bedb6a593 100644 --- a/src/core/ProjectJournal.cpp +++ b/src/core/ProjectJournal.cpp @@ -23,11 +23,13 @@ */ #include +#include #include "ProjectJournal.h" #include "Engine.h" #include "JournallingObject.h" #include "Song.h" +#include "AutomationClip.h" namespace lmms { @@ -67,6 +69,19 @@ void ProjectJournal::undo() jo->restoreState( c.data.content().firstChildElement() ); setJournalling( prev ); Engine::getSong()->setModified(); + + // loading AutomationClip connections correctly + QDomNode node = c.data.content().firstChildElement().firstChild(); + while (!node.isNull()) + { + if (node.isElement() && + node.nodeName() == "automationclip") + { + AutomationClip::resolveAllIDs(); + break; + } + node = node.nextSibling(); + } break; } } @@ -92,6 +107,7 @@ void ProjectJournal::redo() jo->restoreState( c.data.content().firstChildElement() ); setJournalling( prev ); Engine::getSong()->setModified(); + break; } } diff --git a/src/core/Track.cpp b/src/core/Track.cpp index 988edd2534a..6628a2ad535 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -296,8 +296,6 @@ void Track::loadSettings( const QDomElement & element ) // m_clips.erase( m_clips.begin() ); } - bool resolveIDs = false; - QDomNode node = element.firstChild(); while( !node.isNull() ) { @@ -314,21 +312,11 @@ void Track::loadSettings( const QDomElement & element ) Clip * clip = createClip( TimePos( 0 ) ); clip->restoreState( node.toElement() ); - if (node.nodeName() == "automationclip") - { - resolveIDs = true; - } } } node = node.nextSibling(); } - // loading AutomationClip connections correctly - if (resolveIDs) - { - AutomationClip::resolveAllIDs(); - } - int storedHeight = element.attribute( "trackheight" ).toInt(); if( storedHeight >= MINIMAL_TRACK_HEIGHT ) { From b51ddc30c0ab4d351483f8f42bfb48614954216e Mon Sep 17 00:00:00 2001 From: szeli1 Date: Thu, 30 Nov 2023 18:09:59 +0100 Subject: [PATCH 5/6] AutomationClip_redo_fix_simplified --- src/core/ProjectJournal.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/core/ProjectJournal.cpp b/src/core/ProjectJournal.cpp index 54bedb6a593..9a2bf91b8e8 100644 --- a/src/core/ProjectJournal.cpp +++ b/src/core/ProjectJournal.cpp @@ -71,17 +71,10 @@ void ProjectJournal::undo() Engine::getSong()->setModified(); // loading AutomationClip connections correctly - QDomNode node = c.data.content().firstChildElement().firstChild(); - while (!node.isNull()) + if (!c.data.content().elementsByTagName("automationtrack").isEmpty()) { - if (node.isElement() && - node.nodeName() == "automationclip") - { - AutomationClip::resolveAllIDs(); - break; - } - node = node.nextSibling(); - } + AutomationClip::resolveAllIDs(); + } break; } } @@ -107,7 +100,6 @@ void ProjectJournal::redo() jo->restoreState( c.data.content().firstChildElement() ); setJournalling( prev ); Engine::getSong()->setModified(); - break; } } From f1e4147f9e5bfb8b900a3a9986cfcbce8471455d Mon Sep 17 00:00:00 2001 From: szeli1 Date: Thu, 30 Nov 2023 18:17:43 +0100 Subject: [PATCH 6/6] AutomationClip_redo_fix_simplifiedv2 --- src/core/ProjectJournal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ProjectJournal.cpp b/src/core/ProjectJournal.cpp index 9a2bf91b8e8..ae17b2aa8ab 100644 --- a/src/core/ProjectJournal.cpp +++ b/src/core/ProjectJournal.cpp @@ -71,7 +71,7 @@ void ProjectJournal::undo() Engine::getSong()->setModified(); // loading AutomationClip connections correctly - if (!c.data.content().elementsByTagName("automationtrack").isEmpty()) + if (!c.data.content().elementsByTagName("automationclip").isEmpty()) { AutomationClip::resolveAllIDs(); }