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.
This commit is contained in:
Tobias Doerffel
2014-01-20 23:34:46 +01:00
parent 1aea884821
commit 80b8e91fd1

View File

@@ -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()