bool CalAnimationAction::update(float deltaTime) { // update animation action time if(getState() != STATE_STOPPED) { setTime(getTime() + deltaTime * getTimeFactor()); } // handle IN phase if(getState() == STATE_IN) { // check if we are still in the IN phase if(getTime() < m_delayIn) { setWeight(getTime() / m_delayIn * m_weightTarget); //m_weight = m_time / m_delayIn; } else { setState(STATE_STEADY); setWeight(m_weightTarget); } } // handle STEADY if(getState() == STATE_STEADY) { // check if we reached OUT phase if(!m_autoLock && getTime() >= getCoreAnimation()->getDuration() - m_delayOut) { setState(STATE_OUT); } // if the anim is supposed to stay locked on last keyframe, reset the time here. else if (m_autoLock && getTime() > getCoreAnimation()->getDuration()) { setState(STATE_STOPPED); setTime(getCoreAnimation()->getDuration()); } } // handle OUT phase if(getState() == STATE_OUT) { // check if we are still in the OUT phase if(getTime() < getCoreAnimation()->getDuration()) { setWeight((getCoreAnimation()->getDuration() - getTime()) / m_delayOut * m_weightTarget); } else { // we reached the end of the action animation setWeight(0.0f); return false; } } return true; }
int CalCoreModel::getCoreAnimationId(const std::string& strAnimationName) { if (m_animationName.count( strAnimationName ) < 1) { return -1; } if (getCoreAnimation(m_animationName[strAnimationName]) == NULL) { return -1; } return m_animationName[strAnimationName]; }
bool CalAnimationAction::update(float deltaTime) { // Mixer should not call update on manual actions. // Return true, not false, if manual, because we ignore manual, and our // return parameter indicates whether the action has ended. A manual action // doesn't end. if( m_sequencingMode != SequencingModeAutomatic ) return true; // update animation action time if(getState() != STATE_STOPPED) { setTime(getTime() + deltaTime * getTimeFactor()); } // handle IN phase if(getState() == STATE_IN) { // check if we are still in the IN phase if(getTime() < m_delayIn) { setWeight(getTime() / m_delayIn * m_weightTarget); //m_weight = m_time / m_delayIn; } else { setState(STATE_STEADY); setWeight(m_weightTarget); } } // handle STEADY if(getState() == STATE_STEADY) { // check if we reached OUT phase if(!m_autoLock && getTime() >= getCoreAnimation()->getDuration() - m_delayOut) { setState(STATE_OUT); } // if the anim is supposed to stay locked on last keyframe, reset the time here. else if (m_autoLock && getTime() > getCoreAnimation()->getDuration()) { setState(STATE_STOPPED); setTime(getCoreAnimation()->getDuration()); } } // handle OUT phase if(getState() == STATE_OUT) { // check if we are still in the OUT phase if(getTime() < getCoreAnimation()->getDuration()) { setWeight((getCoreAnimation()->getDuration() - getTime()) / m_delayOut * m_weightTarget); } else { // we reached the end of the action animation setWeight(0.0f); return false; } } return true; }