コード例 #1
0
//-----------------------------------------------------------------------------
// 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
0
//-----------------------------------------------------------------------------
// startMotion()
//-----------------------------------------------------------------------------
BOOL LLMotionController::startMotion(const LLUUID &id, F32 start_offset)
{
	// do we have an instance of this motion for this character?
	LLMotion *motion = findMotion(id);

	// motion that is stopping will be allowed to stop but
	// replaced by a new instance of that motion
	if (motion
		&& !mPaused
		&& motion->canDeprecate()
		&& motion->isActive()											// singu: do not deprecate motions that are not active.
		&& motion->getFadeWeight() > 0.01f // not LOD-ed out
		&& (motion->isBlending() || motion->getStopTime() != 0.f))
	{
		deprecateMotionInstance(motion);
		// force creation of new instance
		motion = NULL;
	}

	// create new motion instance
	if (!motion)
	{
		motion = createMotion(id);
	}

	if (!motion)
	{
		return FALSE;
	}
	//if the motion is already active and allows deprecation, then let it keep playing
	else if (motion->canDeprecate() && isMotionActive(motion))
	{	
		return TRUE;
	}

//	llinfos << "Starting motion " << name << llendl;
	//<singu>
	F32 start_time = mAnimTime - start_offset;
	if (!mDisableSyncing)
	{
	  start_time = motion->syncActivationTime(start_time);
	}
	++mDisableSyncing;
	//</singu>
	BOOL res = activateMotionInstance(motion, start_time);
	//<singu>
	--mDisableSyncing;
	//</singu>
	return res;
}
コード例 #3
0
//-----------------------------------------------------------------------------
// 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;
		}
	}
}