Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Fix incorrectly using None interpolation type

DoctorRyanac3cab1a04e0
diff --git a/toonz/sources/common/tparam/tdoubleparam.cpp b/toonz/sources/common/tparam/tdoubleparam.cpp
index 3c2a78d69..c336b84c6 100644
--- a/toonz/sources/common/tparam/tdoubleparam.cpp
+++ b/toonz/sources/common/tparam/tdoubleparam.cpp
@@ -757,6 +757,9 @@ void TDoubleParam::setKeyframe(int index, const TDoubleKeyframe &k) {
dst.m_prevType = TDoubleKeyframe::None;
else
dst.m_prevType = keyframes[index - 1].m_type;
+
+ if (getKeyframeCount() - 1 != index)
+ keyframes[index + 1].m_prevType = dst.m_type;
}
//---------------------------------------------------------
@@ -828,6 +831,8 @@ void TDoubleParam::setKeyframe(const TDoubleKeyframe &k) {
else
it->m_prevType = it[-1].m_type;
+ if (it + 1 != keyframes.end()) it[1].m_prevType = it->m_type;
+
m_imp->notify(TParamChange(this, 0, 0, true, false, false));
assert(it == keyframes.begin() || (it - 1)->m_frame < it->m_frame);
@@ -1148,6 +1153,8 @@ is >> m_imp->m_defaultValue;
while (!is.eos()) {
TDoubleKeyframe kk;
kk.loadData(is);
+ // Throw out invalid interpolation types
+ if (kk.m_type == TDoubleKeyframe::None) continue;
TActualDoubleKeyframe k(kk);
k.m_expression.setGrammar(m_imp->m_grammar);
k.m_expression.setOwnerParameter(this);