MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / stringFromInterpolatedIndex

Method stringFromInterpolatedIndex

Engine/StringAnimationManager.cpp:232–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230}
231
232void
233StringAnimationManager::stringFromInterpolatedIndex(double interpolated,
234 std::string* returnValue) const
235{
236 int index = std::floor(interpolated + 0.5);
237 QMutexLocker l(&_imp->keyframesMutex);
238
239 if ( _imp->keyframes.empty() ) {
240 return;
241 }
242
243 ///if the index is not in the range, just return the last
244 if ( index >= (int)_imp->keyframes.size() ) {
245 Keyframes::const_iterator it = _imp->keyframes.end();
246 --it;
247 *returnValue = it->value;
248
249 return;
250 }
251
252 int i = 0;
253 for (Keyframes::const_iterator it = _imp->keyframes.begin(); it != _imp->keyframes.end(); ++it) {
254 if (i == index) {
255 *returnValue = it->value;
256
257 return;
258 }
259 ++i;
260 }
261}
262
263void
264StringAnimationManager::clone(const StringAnimationManager & other)

Callers 1

Calls 5

emptyMethod · 0.80
floorFunction · 0.50
sizeMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected