Skip to content

Commit 14aa7ae

Browse files
authored
Merge pull request #3410 from shun-iwasawa/g/fix_loading_pegbars
Fix Loading Pegbars' Expression To Refer Parameters Properly
2 parents 4cc756b + 641c8e6 commit 14aa7ae

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

toonz/sources/toonzlib/tstageobject.cpp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ bool setKeyframe(const TDoubleParamP &param, const TDoubleKeyframe &kf,
258258

259259
TDoubleKeyframe kfCopy = kf;
260260

261-
kfCopy.m_frame = frame;
262-
if (easeIn >= 0.0) kfCopy.m_speedIn = TPointD(-easeIn, kfCopy.m_speedIn.y);
261+
kfCopy.m_frame = frame;
262+
if (easeIn >= 0.0) kfCopy.m_speedIn = TPointD(-easeIn, kfCopy.m_speedIn.y);
263263
if (easeOut >= 0.0) kfCopy.m_speedOut = TPointD(easeOut, kfCopy.m_speedOut.y);
264264

265265
param->setKeyframe(kfCopy);
@@ -773,7 +773,7 @@ void TStageObject::setCenterAndOffset(const TPointD &center,
773773
//-----------------------------------------------------------------------------
774774

775775
void TStageObject::setHandle(const std::string &s) {
776-
m_handle = s;
776+
m_handle = s;
777777
if (!s.empty() && s[0] == 'H') m_offset = m_center = TPointD();
778778

779779
invalidate();
@@ -971,7 +971,7 @@ void TStageObject::removeKeyframeWithoutUndo(int frame) {
971971

972972
if (m_skeletonDeformation) m_skeletonDeformation->deleteKeyframe(frame);
973973

974-
time = -1;
974+
time = -1;
975975
if ((int)keyframes.size() < 2) m_cycleEnabled = false;
976976

977977
invalidate();
@@ -1304,17 +1304,17 @@ TAffine TStageObject::computeIkRootOffset(int t) {
13041304
TAffine placement = foot->getPlacement(t).inv();
13051305
int t0 = 0;
13061306
const TPinnedRangeSet::Range *range = foot->getPinnedRangeSet()->getRange(t);
1307-
if (range) t0 = range->first;
1307+
if (range) t0 = range->first;
13081308
while (t0 > 0) {
13091309
TStageObject *oldFoot = getPinnedDescendant(t0 - 1);
13101310
if (oldFoot == 0) break; // oldFoot = this;
13111311
assert(oldFoot != foot);
13121312
TAffine changeFootAff =
13131313
oldFoot->getPlacement(t0).inv() * foot->getPlacement(t0);
1314-
placement = changeFootAff * placement;
1315-
foot = oldFoot;
1316-
range = oldFoot->getPinnedRangeSet()->getRange(t0 - 1);
1317-
t0 = 0;
1314+
placement = changeFootAff * placement;
1315+
foot = oldFoot;
1316+
range = oldFoot->getPinnedRangeSet()->getRange(t0 - 1);
1317+
t0 = 0;
13181318
if (range) t0 = range->first;
13191319
}
13201320
m_ikflag--;
@@ -1412,7 +1412,7 @@ TAffine TStageObject::getPlacement(double t) {
14121412
if (m_parent)
14131413
place = m_parent->getPlacement(t) * computeLocalPlacement(tt);
14141414
else
1415-
place = computeLocalPlacement(tt);
1415+
place = computeLocalPlacement(tt);
14161416
m_absPlacement = place;
14171417
time = t;
14181418
return place;
@@ -1815,7 +1815,11 @@ void TStageObject::loadData(TIStream &is) {
18151815
for (; itKfInd != keyframeIndexSet.end(); itKfInd++)
18161816
setkey(m_scale, *itKfInd);
18171817
}
1818-
updateKeyframes();
1818+
// Calling updateKeyframes() here may cause failure to load expressions
1819+
// especially if it refers to a curve which is to be loaded AFTER this
1820+
// function while loading scene process. So I will skip it assuming that
1821+
// updateKeyframes() will be called when it is actually needed.
1822+
// updateKeyframes();
18191823
if (m_spline != 0 && isUppkEnabled())
18201824
m_spline->addParam(m_posPath.getPointer());
18211825
invalidate();
@@ -1851,8 +1855,8 @@ TStageObjectParams *TStageObject::getParams() const {
18511855
data->m_cycleEnabled = m_cycleEnabled;
18521856
data->m_spline = m_spline;
18531857

1854-
data->m_handle = m_handle;
1855-
data->m_parentHandle = m_parentHandle;
1858+
data->m_handle = m_handle;
1859+
data->m_parentHandle = m_parentHandle;
18561860
if (m_pinnedRangeSet) data->m_pinnedRangeSet = m_pinnedRangeSet->clone();
18571861

18581862
return data;
@@ -1918,7 +1922,7 @@ void TStageObject::assignParams(const TStageObjectParams *src,
19181922
m_handle = src->m_handle;
19191923
m_parentHandle = src->m_parentHandle;
19201924

1921-
m_cycleEnabled = src->m_cycleEnabled;
1925+
m_cycleEnabled = src->m_cycleEnabled;
19221926
if (m_pinnedRangeSet) *m_pinnedRangeSet = *src->m_pinnedRangeSet;
19231927
updateKeyframes();
19241928
if (m_spline && isUppkEnabled()) m_spline->addParam(m_posPath.getPointer());

0 commit comments

Comments
 (0)