Bugfix [#33467] Fluid Simulations Speed factor animated wrong result
Thanks to Brecht for providing a patch and example blend. I changed and extended it a bit since there was another bug in that loop.
This commit is contained in:
@@ -420,7 +420,12 @@ int ntlWorld::advanceSims(int framenum)
|
||||
// Was: double targetTime = mSimulationTime + (*mpSims)[mFirstSim]->getFrameTime(framenum); - DG
|
||||
double totalTime = 0.0, targetTime = 0.0;
|
||||
for(size_t i = 0; i < mSimFrameCnt; i++)
|
||||
totalTime += (*mpSims)[mFirstSim]->getFrameTime(framenum);
|
||||
{
|
||||
/* We need an intermediate array "mSimFrameValue" because
|
||||
otherwise if we don't start with starttime = 0,
|
||||
the sim gets out of sync - DG */
|
||||
totalTime += (*mpSims)[mFirstSim]->getFrameTime(mSimFrameValue[i]);
|
||||
}
|
||||
targetTime = totalTime + (*mpSims)[mFirstSim]->getFrameTime(framenum);
|
||||
|
||||
int gstate = 0;
|
||||
@@ -468,6 +473,7 @@ int ntlWorld::advanceSims(int framenum)
|
||||
sim->prepareVisualization();
|
||||
}
|
||||
|
||||
mSimFrameValue.push_back(framenum);
|
||||
mSimFrameCnt++;
|
||||
|
||||
return 0;
|
||||
|
@@ -118,6 +118,7 @@ class ntlWorld
|
||||
|
||||
/*! count no. of frame for correct sim time */
|
||||
int mSimFrameCnt;
|
||||
vector<int> mSimFrameValue;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user