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()
|
// 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)
|
void LLCharacter::updateMotions(e_update_t update_type)
|
||||||
{
|
{
|
||||||
if (update_type == HIDDEN_UPDATE)
|
if (update_type == HIDDEN_UPDATE)
|
||||||
{
|
{
|
||||||
LLFastTimer t(FTM_UPDATE_HIDDEN_ANIMATION);
|
|
||||||
mMotionController.updateMotionsMinimal();
|
mMotionController.updateMotionsMinimal();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLFastTimer t(FTM_UPDATE_ANIMATION);
|
|
||||||
// unpause if the number of outstanding pause requests has dropped to the initial one
|
// unpause if the number of outstanding pause requests has dropped to the initial one
|
||||||
if (mMotionController.isPaused() && mPauseRequest->getNumRefs() == 1)
|
if (mMotionController.isPaused() && mPauseRequest->getNumRefs() == 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -837,6 +837,7 @@ void LLMotionController::updateMotions(bool force_update)
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateLoadingMotions();
|
updateLoadingMotions();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1179,6 +1179,7 @@ LLVOAvatar::~LLVOAvatar()
|
|||||||
lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl;
|
lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl;
|
||||||
|
|
||||||
mRoot.removeAllChildren();
|
mRoot.removeAllChildren();
|
||||||
|
mJointMap.clear();
|
||||||
|
|
||||||
deleteAndClearArray(mSkeleton);
|
deleteAndClearArray(mSkeleton);
|
||||||
deleteAndClearArray(mCollisionVolumes);
|
deleteAndClearArray(mCollisionVolumes);
|
||||||
@@ -2340,6 +2341,7 @@ void LLVOAvatar::buildCharacter()
|
|||||||
// remove all of mRoot's children
|
// remove all of mRoot's children
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
mRoot.removeAllChildren();
|
mRoot.removeAllChildren();
|
||||||
|
mJointMap.clear();
|
||||||
mIsBuilt = FALSE;
|
mIsBuilt = FALSE;
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@@ -5887,7 +5889,20 @@ const LLUUID& LLVOAvatar::getID() const
|
|||||||
// RN: avatar joints are multi-rooted to include screen-based attachments
|
// RN: avatar joints are multi-rooted to include screen-based attachments
|
||||||
LLJoint *LLVOAvatar::getJoint( const std::string &name )
|
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;
|
return jointp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -376,6 +376,10 @@ public:
|
|||||||
|
|
||||||
LLVector3 mHeadOffset; // current head position
|
LLVector3 mHeadOffset; // current head position
|
||||||
LLViewerJoint mRoot;
|
LLViewerJoint mRoot;
|
||||||
|
|
||||||
|
typedef std::map<std::string, LLJoint*> joint_map_t;
|
||||||
|
joint_map_t mJointMap;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static BOOL parseSkeletonFile(const std::string& filename);
|
static BOOL parseSkeletonFile(const std::string& filename);
|
||||||
void buildCharacter();
|
void buildCharacter();
|
||||||
|
|||||||
Reference in New Issue
Block a user