MAINT-646: Add a lookup map for joints to remove hotspot in LLJoint::findJoint https://bitbucket.org/davep/viewer-development/changeset/15b05dc53770
This commit is contained in:
@@ -194,19 +194,14 @@ void LLCharacter::requestStopMotion( LLMotion* motion)
|
||||
//-----------------------------------------------------------------------------
|
||||
// updateMotions()
|
||||
//-----------------------------------------------------------------------------
|
||||
static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation");
|
||||
static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim");
|
||||
|
||||
void LLCharacter::updateMotions(e_update_t update_type)
|
||||
{
|
||||
if (update_type == HIDDEN_UPDATE)
|
||||
{
|
||||
LLFastTimer t(FTM_UPDATE_HIDDEN_ANIMATION);
|
||||
mMotionController.updateMotionsMinimal();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLFastTimer t(FTM_UPDATE_ANIMATION);
|
||||
// unpause if the number of outstanding pause requests has dropped to the initial one
|
||||
if (mMotionController.isPaused() && mPauseRequest->getNumRefs() == 1)
|
||||
{
|
||||
|
||||
@@ -837,6 +837,7 @@ void LLMotionController::updateMotions(bool force_update)
|
||||
}
|
||||
|
||||
updateLoadingMotions();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1179,6 +1179,7 @@ LLVOAvatar::~LLVOAvatar()
|
||||
lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl;
|
||||
|
||||
mRoot.removeAllChildren();
|
||||
mJointMap.clear();
|
||||
|
||||
deleteAndClearArray(mSkeleton);
|
||||
deleteAndClearArray(mCollisionVolumes);
|
||||
@@ -2340,6 +2341,7 @@ void LLVOAvatar::buildCharacter()
|
||||
// remove all of mRoot's children
|
||||
//-------------------------------------------------------------------------
|
||||
mRoot.removeAllChildren();
|
||||
mJointMap.clear();
|
||||
mIsBuilt = FALSE;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -5887,7 +5889,20 @@ const LLUUID& LLVOAvatar::getID() const
|
||||
// RN: avatar joints are multi-rooted to include screen-based attachments
|
||||
LLJoint *LLVOAvatar::getJoint( const std::string &name )
|
||||
{
|
||||
LLJoint* jointp = mRoot.findJoint(name);
|
||||
joint_map_t::iterator iter = mJointMap.find(name);
|
||||
|
||||
LLJoint* jointp = NULL;
|
||||
|
||||
if (iter == mJointMap.end() || iter->second == NULL)
|
||||
{ //search for joint and cache found joint in lookup table
|
||||
jointp = mRoot.findJoint(name);
|
||||
mJointMap[name] = jointp;
|
||||
}
|
||||
else
|
||||
{ //return cached pointer
|
||||
jointp = iter->second;
|
||||
}
|
||||
|
||||
return jointp;
|
||||
}
|
||||
|
||||
|
||||
@@ -376,6 +376,10 @@ public:
|
||||
|
||||
LLVector3 mHeadOffset; // current head position
|
||||
LLViewerJoint mRoot;
|
||||
|
||||
typedef std::map<std::string, LLJoint*> joint_map_t;
|
||||
joint_map_t mJointMap;
|
||||
|
||||
protected:
|
||||
static BOOL parseSkeletonFile(const std::string& filename);
|
||||
void buildCharacter();
|
||||
|
||||
Reference in New Issue
Block a user