//--------------------------------------------------- MObject DagHelper::createAnimationCurve ( const MObject& node, const char* attributeName, const char* curveType ) { MFnDependencyNode fn ( node ); return createAnimationCurve ( fn.findPlug ( attributeName ), curveType ); }
void ScrollAnimator::updateCompositorAnimations() { ScrollAnimatorCompositorCoordinator::updateCompositorAnimations(); if (m_runState == RunState::PostAnimationCleanup) { postAnimationCleanupAndReset(); return; } if (m_runState == RunState::WaitingToCancelOnCompositor) { DCHECK(m_compositorAnimationId); abortAnimation(); postAnimationCleanupAndReset(); return; } if (m_runState == RunState::RunningOnCompositorButNeedsTakeover) { // The call to ::takeOverCompositorAnimation aborted the animation and // put us in this state. The assumption is that takeOver is called // because a main thread scrolling reason is added, and simply trying // to ::sendAnimationToCompositor will fail and we will run on the main // thread. resetAnimationIds(); m_runState = RunState::WaitingToSendToCompositor; } if (m_runState == RunState::RunningOnCompositorButNeedsUpdate || m_runState == RunState::WaitingToCancelOnCompositorButNewScroll || m_runState == RunState::RunningOnCompositorButNeedsAdjustment) { // Abort the running animation before a new one with an updated // target is added. abortAnimation(); resetAnimationIds(); if (m_runState != RunState::RunningOnCompositorButNeedsAdjustment) { // When in RunningOnCompositorButNeedsAdjustment, the call to // ::adjustScrollOffsetAnimation should have made the necessary // adjustment to the curve. m_animationCurve->updateTarget( m_timeFunction() - m_startTime, compositorOffsetFromBlinkOffset(m_targetOffset)); } if (m_runState == RunState::WaitingToCancelOnCompositorButNewScroll) { m_animationCurve->setInitialValue( compositorOffsetFromBlinkOffset(currentOffset())); } m_runState = RunState::WaitingToSendToCompositor; } if (m_runState == RunState::WaitingToSendToCompositor) { if (!m_compositorAnimationAttachedToElementId) reattachCompositorPlayerIfNeeded( getScrollableArea()->compositorAnimationTimeline()); if (!m_animationCurve) createAnimationCurve(); bool runningOnMainThread = false; bool sentToCompositor = sendAnimationToCompositor(); if (!sentToCompositor) { runningOnMainThread = registerAndScheduleAnimation(); if (runningOnMainThread) m_runState = RunState::RunningOnMainThread; } // Main thread should deal with the scroll animations it started. if (sentToCompositor || runningOnMainThread) addMainThreadScrollingReason(); else removeMainThreadScrollingReason(); } }