本文整理汇总了C++中LLMotion::getID方法的典型用法代码示例。如果您正苦于以下问题:C++ LLMotion::getID方法的具体用法?C++ LLMotion::getID怎么用?C++ LLMotion::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLMotion
的用法示例。
在下文中一共展示了LLMotion::getID方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateLoadingMotions
//-----------------------------------------------------------------------------
// updateLoadingMotions()
//-----------------------------------------------------------------------------
void LLMotionController::updateLoadingMotions()
{
// query pending motions for completion
for (motion_set_t::iterator iter = mLoadingMotions.begin();
iter != mLoadingMotions.end(); )
{
motion_set_t::iterator curiter = iter++;
LLMotion* motionp = *curiter;
if( !motionp)
{
continue; // maybe shouldn't happen but i've seen it -MG
}
LLMotion::LLMotionInitStatus status = motionp->onInitialize(mCharacter);
if (status == LLMotion::STATUS_SUCCESS)
{
mLoadingMotions.erase(curiter);
// add motion to our loaded motion list
mLoadedMotions.insert(motionp);
// this motion should be playing
if (!motionp->isStopped())
{
//<singu>
F32 start_time = mAnimTime;
if (!mDisableSyncing)
{
motionp->aisync_loaded();
start_time = motionp->syncActivationTime(start_time);
}
++mDisableSyncing;
//</singu>
activateMotionInstance(motionp, start_time);
//<singu>
--mDisableSyncing;
//</singu>
}
}
else if (status == LLMotion::STATUS_FAILURE)
{
llinfos << "Motion " << motionp->getID() << " init failed." << llendl;
sRegistry.markBad(motionp->getID());
mLoadingMotions.erase(curiter);
// Singu note: a motion in mLoadingMotions will not be in mActiveMotions
// and therefore not be in mDeprecatedMotions. So, we don't have to
// check for it's existence there.
llassert(mDeprecatedMotions.find(motionp) == mDeprecatedMotions.end());
mAllMotions.erase(motionp->getID());
//<singu>
// Make sure we're not registered anymore.
motionp->unregister_client();
//</singu>
delete motionp;
}
}
}
示例2: flushAllMotions
//-----------------------------------------------------------------------------
// flushAllMotions()
//-----------------------------------------------------------------------------
void LLMotionController::flushAllMotions()
{
std::vector<std::pair<LLUUID,F32> > active_motions;
active_motions.reserve(mActiveMotions.size());
for (motion_list_t::iterator iter = mActiveMotions.begin();
iter != mActiveMotions.end(); )
{
motion_list_t::iterator curiter = iter++;
LLMotion* motionp = *curiter;
F32 dtime = mAnimTime - motionp->mActivationTimestamp;
active_motions.push_back(std::make_pair(motionp->getID(),dtime));
motionp->deactivate(); // don't call deactivateMotionInstance() because we are going to reactivate it
}
mActiveMotions.clear();
// delete all motion instances
deleteAllMotions();
// kill current hand pose that was previously called out by
// keyframe motion
mCharacter->removeAnimationData("Hand Pose");
// restart motions
for (std::vector<std::pair<LLUUID,F32> >::iterator iter = active_motions.begin();
iter != active_motions.end(); ++iter)
{
startMotion(iter->first, iter->second);
}
}
示例3: updateLoadingMotions
//-----------------------------------------------------------------------------
// updateLoadingMotions()
//-----------------------------------------------------------------------------
void LLMotionController::updateLoadingMotions()
{
// query pending motions for completion
for (motion_set_t::iterator iter = mLoadingMotions.begin();
iter != mLoadingMotions.end(); )
{
motion_set_t::iterator curiter = iter++;
LLMotion* motionp = *curiter;
if( !motionp)
{
continue; // maybe shouldn't happen but i've seen it -MG
}
LLMotion::LLMotionInitStatus status = motionp->onInitialize(mCharacter);
if (status == LLMotion::STATUS_SUCCESS)
{
mLoadingMotions.erase(curiter);
// add motion to our loaded motion list
mLoadedMotions.insert(motionp);
// this motion should be playing
if (!motionp->isStopped())
{
activateMotionInstance(motionp, mAnimTime);
}
}
else if (status == LLMotion::STATUS_FAILURE)
{
llinfos << "Motion " << motionp->getID() << " init failed." << llendl;
sRegistry.markBad(motionp->getID());
mLoadingMotions.erase(curiter);
motion_set_t::iterator found_it = mDeprecatedMotions.find(motionp);
if (found_it != mDeprecatedMotions.end())
{
mDeprecatedMotions.erase(found_it);
}
mAllMotions.erase(motionp->getID());
delete motionp;
}
}
}
示例4: dumpMotions
//-----------------------------------------------------------------------------
// dumpMotions()
//-----------------------------------------------------------------------------
void LLMotionController::dumpMotions()
{
llinfos << "=====================================" << llendl;
for (motion_map_t::iterator iter = mAllMotions.begin();
iter != mAllMotions.end(); iter++)
{
LLUUID id = iter->first;
std::string state_string;
LLMotion *motion = iter->second;
if (mLoadingMotions.find(motion) != mLoadingMotions.end())
state_string += std::string("l");
if (mLoadedMotions.find(motion) != mLoadedMotions.end())
state_string += std::string("L");
if (std::find(mActiveMotions.begin(), mActiveMotions.end(), motion)!=mActiveMotions.end())
state_string += std::string("A");
llassert(mDeprecatedMotions.find(motion) == mDeprecatedMotions.end()); // singu: it's impossible that a motion is in mAllMotions and mDeprecatedMotions at the same time.
llinfos << gAnimLibrary.animationName(id) << " " << state_string << llendl;
}
//<singu>
// Also dump the deprecated motions.
for (motion_set_t::iterator iter = mDeprecatedMotions.begin();
iter != mDeprecatedMotions.end(); ++iter)
{
std::string state_string;
LLMotion* motion = *iter;
LLUUID id = motion->getID();
llassert(mLoadingMotions.find(motion) == mLoadingMotions.end());
if (mLoadedMotions.find(motion) != mLoadedMotions.end())
state_string += std::string("L");
if (std::find(mActiveMotions.begin(), mActiveMotions.end(), motion)!=mActiveMotions.end())
state_string += std::string("A");
state_string += "D";
llinfos << gAnimLibrary.animationName(id) << " " << state_string << llendl;
}
//</singu>
}
示例5: updateMotion
//-----------------------------------------------------------------------------
// updateMotion()
//-----------------------------------------------------------------------------
void LLMotionController::updateMotion()
{
BOOL use_quantum = (mTimeStep != 0.f);
// Update timing info for this time step.
if (!mPaused)
{
F32 update_time = mTimeOffset + (mTimer.getElapsedTimeF32() * mTimeFactor);
if (use_quantum)
{
F32 time_interval = fmodf(update_time, mTimeStep);
// always animate *ahead* of actual time
S32 quantum_count = llmax(0, llfloor((update_time - time_interval) / mTimeStep)) + 1;
if (quantum_count == mTimeStepCount)
{
// we're still in same time quantum as before, so just interpolate and exit
if (!mPaused)
{
F32 interp = time_interval / mTimeStep;
mPoseBlender.interpolate(interp - mLastInterp);
mLastInterp = interp;
}
return;
}
// is calculating a new keyframe pose, make sure the last one gets applied
mPoseBlender.interpolate(1.f);
mPoseBlender.clearBlenders();
mTimeStepCount = quantum_count;
mLastTime = mTime;
mTime = (F32)quantum_count * mTimeStep;
mLastInterp = 0.f;
}
else
{
mLastTime = mTime;
mTime = update_time;
}
}
// query pending motions for completion
for (motion_set_t::iterator iter = mLoadingMotions.begin();
iter != mLoadingMotions.end(); )
{
motion_set_t::iterator curiter = iter++;
LLMotion* motionp = *curiter;
if( !motionp)
{
continue; // maybe shouldn't happen but i've seen it -MG
}
LLMotion::LLMotionInitStatus status = motionp->onInitialize(mCharacter);
if (status == LLMotion::STATUS_SUCCESS)
{
mLoadingMotions.erase(curiter);
// add motion to our loaded motion list
addLoadedMotion(motionp);
// this motion should be playing
if (!motionp->isStopped())
{
activateMotion(motionp, mTime);
}
}
else if (status == LLMotion::STATUS_FAILURE)
{
llinfos << "Motion " << motionp->getID() << " init failed." << llendl;
sRegistry.markBad(motionp->getID());
mLoadingMotions.erase(curiter);
mAllMotions.erase(motionp->getID());
delete motionp;
}
}
resetJointSignatures();
if (!mPaused)
{
// update additive motions
updateAdditiveMotions();
resetJointSignatures();
// update all regular motions
updateRegularMotions();
if (use_quantum)
{
mPoseBlender.blendAndCache(TRUE);
}
else
{
mPoseBlender.blendAndApply();
}
}
mHasRunOnce = TRUE;
//.........这里部分代码省略.........
示例6: updateMotionsByType
//-----------------------------------------------------------------------------
// updateMotionsByType()
//-----------------------------------------------------------------------------
void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type)
{
BOOL update_result = TRUE;
U8 last_joint_signature[LL_CHARACTER_MAX_JOINTS];
memset(&last_joint_signature, 0, sizeof(U8) * LL_CHARACTER_MAX_JOINTS);
// iterate through active motions in chronological order
for (motion_list_t::iterator iter = mActiveMotions.begin();
iter != mActiveMotions.end(); )
{
motion_list_t::iterator curiter = iter++;
LLMotion* motionp = *curiter;
if (motionp->getBlendType() != anim_type)
{
continue;
}
BOOL update_motion = FALSE;
if (motionp->getPose()->getWeight() < 1.f)
{
update_motion = TRUE;
}
else
{
// NUM_JOINT_SIGNATURE_STRIDES should be multiple of 4
for (S32 i = 0; i < NUM_JOINT_SIGNATURE_STRIDES; i++)
{
U32 *current_signature = (U32*)&(mJointSignature[0][i * 4]);
U32 test_signature = *(U32*)&(motionp->mJointSignature[0][i * 4]);
if ((*current_signature | test_signature) > (*current_signature))
{
*current_signature |= test_signature;
update_motion = TRUE;
}
*((U32*)&last_joint_signature[i * 4]) = *(U32*)&(mJointSignature[1][i * 4]);
current_signature = (U32*)&(mJointSignature[1][i * 4]);
test_signature = *(U32*)&(motionp->mJointSignature[1][i * 4]);
if ((*current_signature | test_signature) > (*current_signature))
{
*current_signature |= test_signature;
update_motion = TRUE;
}
}
}
if (!update_motion)
{
if (motionp->isStopped() && mTime > motionp->getStopTime() + motionp->getEaseOutDuration())
{
deactivateMotion(motionp, false);
}
else if (motionp->isStopped() && mTime > motionp->getStopTime())
{
// is this the first iteration in the ease out phase?
if (mLastTime <= motionp->getStopTime())
{
// store residual weight for this motion
motionp->mResidualWeight = motionp->getPose()->getWeight();
}
}
else if (mTime > motionp->mSendStopTimestamp)
{
// notify character of timed stop event on first iteration past sendstoptimestamp
// this will only be called when an animation stops itself (runs out of time)
if (mLastTime <= motionp->mSendStopTimestamp)
{
mCharacter->requestStopMotion( motionp );
stopMotionLocally(motionp->getID(), FALSE);
}
}
else if (mTime >= motionp->mActivationTimestamp)
{
if (mLastTime < motionp->mActivationTimestamp)
{
motionp->mResidualWeight = motionp->getPose()->getWeight();
}
}
continue;
}
LLPose *posep = motionp->getPose();
// only filter by LOD after running every animation at least once (to prime the avatar state)
if (mHasRunOnce && motionp->getMinPixelArea() > mCharacter->getPixelArea())
{
motionp->fadeOut();
//should we notify the simulator that this motion should be stopped (check even if skipped by LOD logic)
if (mTime > motionp->mSendStopTimestamp)
{
// notify character of timed stop event on first iteration past sendstoptimestamp
// this will only be called when an animation stops itself (runs out of time)
//.........这里部分代码省略.........