From 80b8e91fd11cddc61575ef062f8cc26bb2569a7b Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 20 Jan 2014 23:34:46 +0100 Subject: [PATCH] InlineAutomation: improved hasAutomation() Pprevent saving inline automation if there's just one value which equals value of model which is going to be saved anyways. --- include/InlineAutomation.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/include/InlineAutomation.h b/include/InlineAutomation.h index 70cefbec9..22d2aa367 100644 --- a/include/InlineAutomation.h +++ b/include/InlineAutomation.h @@ -49,10 +49,24 @@ public: virtual float defaultValue() const = 0; - inline bool hasAutomation() const + bool hasAutomation() const { - return m_autoPattern != NULL && - m_autoPattern->getTimeMap().isEmpty() == false; + if( m_autoPattern != NULL && m_autoPattern->getTimeMap().isEmpty() == false ) + { + // prevent saving inline automation if there's just one value which equals value + // of model which is going to be saved anyways + if( isAtInitValue() && + m_autoPattern->getTimeMap().size() == 1 && + m_autoPattern->getTimeMap().keys().first() == 0 && + m_autoPattern->getTimeMap().values().first() == value() ) + { + return false; + } + + return true; + } + + return false; } AutomationPattern * automationPattern()