diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
index 3617ce2bb6..25a51da03d 100644
--- a/indra/llappearance/llavatarappearance.h
+++ b/indra/llappearance/llavatarappearance.h
@@ -140,10 +140,9 @@ public:
LLVector3 mHeadOffset{}; // current head position
LLAvatarJoint* mRoot{ nullptr };
- // This map gets queried a huge amount of time.
+ // Joint-lookup improvements
// typedef std::map joint_map_t;
- typedef std::unordered_map joint_map_t;
- //
+ typedef std::map> joint_map_t;
joint_map_t mJointMap;
diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp
index b1648397e0..65c70c2ce1 100644
--- a/indra/llcharacter/llcharacter.cpp
+++ b/indra/llcharacter/llcharacter.cpp
@@ -77,7 +77,9 @@ LLCharacter::~LLCharacter()
//-----------------------------------------------------------------------------
// getJoint()
//-----------------------------------------------------------------------------
-LLJoint *LLCharacter::getJoint( const std::string &name )
+// Joint-lookup improvements
+//LLJoint *LLCharacter::getJoint( const std::string &name )
+LLJoint* LLCharacter::getJoint(std::string_view name)
{
LLJoint* joint = NULL;
@@ -94,14 +96,6 @@ LLJoint *LLCharacter::getJoint( const std::string &name )
return joint;
}
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// Default fallback is string.
-LLJoint *LLCharacter::getJoint( const JointKey &name )
-{
- return getJoint( name.mName );
-}
-//
-
//-----------------------------------------------------------------------------
// registerMotion()
//-----------------------------------------------------------------------------
diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h
index 2f0cf1487e..53803bbb24 100644
--- a/indra/llcharacter/llcharacter.h
+++ b/indra/llcharacter/llcharacter.h
@@ -76,13 +76,9 @@ public:
// get the specified joint
// default implementation does recursive search,
// subclasses may optimize/cache results.
+ // Joint-lookup improvements
// virtual LLJoint *getJoint( const std::string &name );
-
- // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
- virtual LLJoint *getJoint( const JointKey &name );
- //
-
- LLJoint *getJoint( const std::string &name );
+ virtual LLJoint* getJoint(std::string_view name);
// get the position of the character
virtual LLVector3 getCharacterPosition() = 0;
diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index f619fe132b..7749e2748e 100644
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -34,32 +34,6 @@
#include "llmath.h"
#include
-#include "llmutex.h" // [FIRE-35382] Add share_mutex to fix JointKey::construct lockup
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-#include
-
-std::unordered_map mpStringToKeys;
-std::shared_mutex mpStringToKeysMutex; // [FIRE-35382] Add share_mutex to fix JointKey::construct lockup
-
-JointKey JointKey::construct(const std::string& aName)
-{
- {// [FIRE-35382] Add share_mutex to fix JointKey::construct lockup
- std::shared_lock lock(mpStringToKeysMutex); // [FIRE-35382] Added a shared lock for reading the mpStringToKeys unordered_map.
- if (const auto itr = mpStringToKeys.find(aName); itr != mpStringToKeys.end())
- {
- return { aName, itr->second };
- }
- }// [FIRE-35382] Add share_mutex to fix JointKey::construct lockup
-
- { // Add a unique lock for writing to the mpStringToKeys unordered_map.
- std::unique_lock lock(mpStringToKeysMutex);// [FIRE-35382]
- U32 size = static_cast(mpStringToKeys.size()) + 1;
- mpStringToKeys.try_emplace(aName, size);
- return { aName, size };
- } // [FIRE-35382] Add share_mutex to fix JointKey::construct lockup
-}
-//
-
S32 LLJoint::sNumUpdates = 0;
S32 LLJoint::sNumTouches = 0;
@@ -268,7 +242,9 @@ LLJoint *LLJoint::getRoot()
//-----------------------------------------------------------------------------
// findJoint()
//-----------------------------------------------------------------------------
-LLJoint *LLJoint::findJoint( const std::string &name )
+// Joint-lookup improvements
+//LLJoint *LLJoint::findJoint( const std::string &name )
+LLJoint *LLJoint::findJoint(std::string_view name)
{
if (name == getName())
return this;
diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h
index 8118752bfc..f2ceed5f55 100644
--- a/indra/llcharacter/lljoint.h
+++ b/indra/llcharacter/lljoint.h
@@ -40,31 +40,6 @@
#include "xform.h"
#include "llmatrix4a.h"
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-struct JointKey
-{
- std::string mName;
- U32 mKey;
-
- static JointKey construct(const std::string& aName);
-};
-
-inline bool operator==(JointKey const &aLHS, JointKey const &aRHS)
-{
- return aLHS.mName == aRHS.mName;
-}
-
-inline bool operator!=(JointKey const &aLHS, JointKey const &aRHS)
-{
- return ! (aLHS == aRHS);
-}
-
-inline std::ostream& operator<<(std::ostream &aLHS, JointKey const &aRHS)
-{
- return aLHS << aRHS.mName << " (" << aRHS.mKey << ")";
-}
-//
-
constexpr S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15;
// Need to set this to count of animate-able joints,
// currently = #bones + #collision_volumes + #attachments + 2,
@@ -247,7 +222,9 @@ public:
LLJoint *getRoot();
// search for child joints by name
- LLJoint *findJoint( const std::string &name );
+ // Joint-lookup improvements
+ //LLJoint *findJoint( const std::string &name );
+ LLJoint* findJoint(std::string_view name);
// add/remove children
void addChild( LLJoint *joint );
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index c3c3f81ea2..8d5d02aff0 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -1467,10 +1467,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
{
name = mJointMap[name];
}
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// model->mSkinInfo.mJointNames.push_back( name );
- model->mSkinInfo.mJointNames.push_back( JointKey::construct( name ) );
-//
+ model->mSkinInfo.mJointNames.push_back(name);
model->mSkinInfo.mJointNums.push_back(-1);
}
}
@@ -1488,10 +1485,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
{
name = mJointMap[name];
}
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// model->mSkinInfo.mJointNames.push_back( name );
- model->mSkinInfo.mJointNames.push_back( JointKey::construct( name ) );
-//
+ model->mSkinInfo.mJointNames.push_back(name);
model->mSkinInfo.mJointNums.push_back(-1);
}
}
@@ -1533,10 +1527,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
//but does not use the skeleton).
buildJointToNodeMappingFromScene( root );
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// critiqueRigForUploadApplicability( model->mSkinInfo.mJointNames );
- critiqueRigForUploadApplicability( toStringVector( model->mSkinInfo.mJointNames ) );
-//
+ critiqueRigForUploadApplicability( model->mSkinInfo.mJointNames );
if ( !missingSkeletonOrScene )
{
@@ -1589,11 +1580,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
//with the skeleton are not stored in the same order as they are in the exported joint buffer.
//This remaps the skeletal joints to be in the same order as the joints stored in the model.
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
- // std::vector ::const_iterator jointIt = model->mSkinInfo.mJointNames.begin();
- std::vector< std::string > jointNames = toStringVector( model->mSkinInfo.mJointNames );
- std::vector ::const_iterator jointIt = jointNames.begin();
-//
+ std::vector ::const_iterator jointIt = model->mSkinInfo.mJointNames.begin();
const int jointCnt = static_cast(model->mSkinInfo.mJointNames.size());
for ( int i=0; i Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// mJointNames.push_back( skin[ "joint_names" ][ i ] );
- mJointNames.push_back( JointKey::construct( skin[ "joint_names" ][ i ] ) );
-// ND>
+ mJointNames.push_back( skin[ "joint_names" ][ i ] );
mJointNums.push_back(-1);
}
}
@@ -1589,10 +1586,7 @@ LLSD LLMeshSkinInfo::asLLSD(bool include_joints, bool lock_scale_if_joint_positi
for (U32 i = 0; i < mJointNames.size(); ++i)
{
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// ret[ "joint_names" ][ i ] = mJointNames[ i ];
- ret[ "joint_names" ][ i ] = mJointNames[ i ].mName;
-//
+ ret[ "joint_names" ][ i ] = mJointNames[ i ];
for (U32 j = 0; j < 4; j++)
{
@@ -1643,9 +1637,7 @@ void LLMeshSkinInfo::updateHash()
//mJointNames
for (auto& name : mJointNames)
{
- // Joint lookup speedup
- //hash.update(name);
- hash.update(name.mName);
+ hash.update(name);
}
//mJointNums
@@ -1671,10 +1663,7 @@ U32 LLMeshSkinInfo::sizeBytes() const
res += sizeof(std::vector) + sizeof(std::string) * static_cast(mJointNames.size());
for (U32 i = 0; i < mJointNames.size(); ++i)
{
- // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
- //res += static_cast(mJointNames[i].size()); // actual size, not capacity
- res += static_cast(mJointNames[i].mName.size()); // actual size, not capacity
- //
+ res += static_cast(mJointNames[i].size()); // actual size, not capacity
}
res += sizeof(std::vector) + sizeof(S32) * static_cast(mJointNums.size());
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index 816ca3d000..010b6d5d85 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -56,10 +56,7 @@ public:
U32 sizeBytes() const;
LLUUID mMeshID;
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// std::vector mJointNames;
- std::vector< JointKey > mJointNames;
-//
+ std::vector mJointNames;
mutable std::vector mJointNums;
typedef std::vector matrix_list_t;
matrix_list_t mInvBindMatrix;
diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp
index d3fa1767a5..39b6c81be9 100644
--- a/indra/llprimitive/llmodelloader.cpp
+++ b/indra/llprimitive/llmodelloader.cpp
@@ -257,10 +257,7 @@ bool LLModelLoader::loadFromSLM(const std::string& filename)
if (!loaded_model->mSkinInfo.mJointNames.empty())
{
//check to see if rig is valid
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// critiqueRigForUploadApplicability( loaded_model->mSkinInfo.mJointNames );
- critiqueRigForUploadApplicability( toStringVector( loaded_model->mSkinInfo.mJointNames ) );
-//
+ critiqueRigForUploadApplicability( loaded_model->mSkinInfo.mJointNames );
}
else if (mCacheOnlyHitIfRigged)
{
diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h
index d04585bd2c..f5783515fa 100644
--- a/indra/llprimitive/llmodelloader.h
+++ b/indra/llprimitive/llmodelloader.h
@@ -196,18 +196,6 @@ public:
void clearLog() { mWarningsArray.clear(); }
protected:
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
- std::vector< std::string > toStringVector( std::vector< JointKey > const &aIn ) const
- {
- std::vector< std::string > out;
-
- for( std::vector< JointKey >::const_iterator itr = aIn.begin(); itr != aIn.end(); ++itr )
- out.push_back( itr->mName );
-
- return out;
- }
-//
-
LLModelLoader::load_callback_t mLoadCallback;
LLModelLoader::joint_lookup_func_t mJointLookupFunc;
LLModelLoader::texture_load_func_t mTextureLoadFunc;
diff --git a/indra/newview/fsfloaterposer.cpp b/indra/newview/fsfloaterposer.cpp
index 536ec189ba..f3d01fd6a9 100644
--- a/indra/newview/fsfloaterposer.cpp
+++ b/indra/newview/fsfloaterposer.cpp
@@ -1652,7 +1652,7 @@ void FSFloaterPoser::updateManipWithFirstSelectedJoint(std::vector= 1)
- FSToolCompPose::getInstance()->setJoint(avatarp->getJoint(JointKey::construct(joints[0]->jointName())));
+ FSToolCompPose::getInstance()->setJoint(avatarp->getJoint(joints[0]->jointName()));
else
FSToolCompPose::getInstance()->setJoint(nullptr);
}
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 8e301cb76c..0fcd96dd8b 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -1625,14 +1625,9 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)
for (U32 j = 0; j < joint_count; ++j)
{
const LLVector3& joint_pos = LLVector3(skin->mAlternateBindMatrix[j].getTranslation());
- // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
- //LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]];
+ LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]];
- //LLJoint* pJoint = LLModelPreview::lookupJointByName(skin->mJointNames[j], mModelPreview);
- LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j].mName];
-
- LLJoint* pJoint = LLModelPreview::lookupJointByName(skin->mJointNames[j].mName, mModelPreview);
- //
+ LLJoint* pJoint = LLModelPreview::lookupJointByName(skin->mJointNames[j], mModelPreview);
if (pJoint)
{
// see how voavatar uses aboveJointPosThreshold
@@ -1661,9 +1656,7 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides)
{
for (U32 j = 0; j < joint_count; ++j)
{
- // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
- //LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]];
- LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j].mName];
+ LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]];
data.mModelsNoOverrides.insert(model->getName());
}
}
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index 5ea96030e3..de1f34eadb 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -4185,10 +4185,7 @@ LLJoint* LLModelPreview::lookupJointByName(const std::string& str, void* opaque)
LLModelPreview* pPreview = static_cast< LLModelPreview* >(opaque);
if (pPreview)
{
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// return pPreview->getPreviewAvatar()->getJoint(str);
- return pPreview->getPreviewAvatar()->getJoint( JointKey::construct( str ) );
-//
+ return pPreview->getPreviewAvatar()->getJoint(str);
}
return NULL;
}
diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp
index 693915e813..cfbfa0ac27 100644
--- a/indra/newview/llmorphview.cpp
+++ b/indra/newview/llmorphview.cpp
@@ -131,10 +131,7 @@ void LLMorphView::updateCamera()
{
if (!mCameraTargetJoint)
{
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// setCameraTargetJoint( gAgentAvatarp->getJoint( "mHead" ) );
- setCameraTargetJoint( gAgentAvatarp->getJoint( JointKey::construct( "mHead" ) ) );
-//
+ setCameraTargetJoint( gAgentAvatarp->getJoint( "mHead" ) );
}
if (!isAgentAvatarValid()) return;
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index a7725d8899..07a168612a 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -1316,15 +1316,11 @@ void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, bool show, bo
value_map_t sorted_params;
getSortedParams(sorted_params, edit_group);
- // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
- //LLJoint* jointp = gAgentAvatarp->getJoint( subpart_entry->mTargetJoint );
- LLJoint* jointp = gAgentAvatarp->getJoint( JointKey::construct( subpart_entry->mTargetJoint ) );
+ LLJoint* jointp = gAgentAvatarp->getJoint( subpart_entry->mTargetJoint );
if (!jointp)
{
- //jointp = gAgentAvatarp->getJoint( "mHead" );
- jointp = gAgentAvatarp->getJoint( JointKey::construct( "mHead" ) );
+ jointp = gAgentAvatarp->getJoint( "mHead" );
}
- //
buildParamList(panel_list, sorted_params, tab, jointp);
@@ -1440,11 +1436,7 @@ void LLPanelEditWearable::changeCamera(U8 subpart)
}
// Update the camera
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
- //gMorphView->setCameraTargetJoint( gAgentAvatarp->getJoint( subpart_entry->mTargetJoint ) );
- gMorphView->setCameraTargetJoint( gAgentAvatarp->getJoint( JointKey::construct( subpart_entry->mTargetJoint ) ) );
-// ND>
-
+ gMorphView->setCameraTargetJoint( gAgentAvatarp->getJoint( subpart_entry->mTargetJoint ) );
gMorphView->setCameraTargetOffset( subpart_entry->mTargetOffset );
gMorphView->setCameraOffset( subpart_entry->mCameraOffset );
if (gSavedSettings.getBOOL("AppearanceCameraMovement"))
diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp
index d9f16fe34f..59f8e866ad 100644
--- a/indra/newview/llskinningutil.cpp
+++ b/indra/newview/llskinningutil.cpp
@@ -54,10 +54,7 @@ void dump_avatar_and_skin_state(const std::string& reason, LLVOAvatar *avatar, c
{
LL_WARNS("Avatar") << "skin joint idx " << j << " name [" << skin->mJointNames[j]
<< "] num " << skin->mJointNums[j] << LL_ENDL;
- // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
- //const std::string& name = skin->mJointNames[j];
- const std::string& name = skin->mJointNames[j].mName;
- //
+ const std::string& name = skin->mJointNames[j];
S32 joint_num = skin->mJointNums[j];
LLJoint *name_joint = avatar->getJoint(name);
@@ -119,14 +116,9 @@ void LLSkinningUtil::scrubInvalidJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin
// needed for handling of any legacy bad data.
if (!avatar->getJoint(skin->mJointNames[j]))
{
- // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
- //LL_DEBUGS("Avatar") << avatar->getFullname() << " mesh rigged to invalid joint " << skin->mJointNames[j] << LL_ENDL;
- //LL_WARNS_ONCE("Avatar") << avatar->getFullname() << " mesh rigged to invalid joint" << skin->mJointNames[j] << LL_ENDL;
- //skin->mJointNames[j] = "mPelvis";
- LL_DEBUGS("Avatar") << avatar->getFullname() << " mesh rigged to invalid joint " << skin->mJointNames[j].mName << LL_ENDL;
- LL_WARNS_ONCE("Avatar") << avatar->getFullname() << " mesh rigged to invalid joint" << skin->mJointNames[j].mName << LL_ENDL;
- skin->mJointNames[j] = JointKey::construct("mPelvis");
- //
+ LL_DEBUGS("Avatar") << avatar->getFullname() << " mesh rigged to invalid joint " << skin->mJointNames[j] << LL_ENDL;
+ LL_WARNS_ONCE("Avatar") << avatar->getFullname() << " mesh rigged to invalid joint" << skin->mJointNames[j] << LL_ENDL;
+ skin->mJointNames[j] = "mPelvis";
skin->mJointNumsInitialized = false; // force update after names change.
}
}
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 9b339a5609..135bbe14ed 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7267,69 +7267,44 @@ const LLUUID& LLVOAvatar::getID() const
// getJoint()
//-----------------------------------------------------------------------------
// RN: avatar joints are multi-rooted to include screen-based attachments
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
+// Joint-lookup improvements
//LLJoint *LLVOAvatar::getJoint(const std::string &name)
-LLJoint *LLVOAvatar::getJoint(const JointKey &name)
-//
+LLJoint *LLVOAvatar::getJoint(std::string_view name)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
+ // Joint-lookup improvements
//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
- // if (mJointAliasMap.empty())
- // {
- // getJointAliases();
- // }
- // joint_alias_map_t::const_iterator alias_iter = mJointAliasMap.find(name);
- // std::string canonical_name;
- // if (alias_iter != mJointAliasMap.end())
- // {
- // canonical_name = alias_iter->second;
- // }
- // else
- // {
- // canonical_name = name;
- // }
- // jointp = mRoot->findJoint(canonical_name);
- // mJointMap[name] = jointp;
- //}
- //else
- //{ //return cached pointer
- // jointp = iter->second;
- //}
-
- joint_map_t::iterator iter = mJointMap.find( name.mKey );
+ joint_map_t::iterator iter = mJointMap.find(name.data());
LLJoint* jointp = NULL;
- if (iter == mJointMap.end() || iter->second == NULL)
- { //search for joint and cache found joint in lookup table
- if (mJointAliasMap.empty())
- {
- getJointAliases();
- }
- joint_alias_map_t::const_iterator alias_iter = mJointAliasMap.find(name.mName);
- std::string canonical_name;
- if (alias_iter != mJointAliasMap.end())
- {
- canonical_name = alias_iter->second;
- }
- else
- {
- canonical_name = name.mName;
- }
- jointp = mRoot->findJoint(canonical_name);
- mJointMap[name.mKey] = jointp;
+ if( iter == mJointMap.end() || iter->second == NULL )
+ { //search for joint and cache found joint in lookup table
+ if (mJointAliasMap.empty())
+ {
+ getJointAliases();
+ }
+ // Joint-lookup improvements
+ //joint_alias_map_t::const_iterator alias_iter = mJointAliasMap.find(name);
+ joint_alias_map_t::const_iterator alias_iter = mJointAliasMap.find(std::string(name));
+ std::string canonical_name;
+ if (alias_iter != mJointAliasMap.end())
+ {
+ canonical_name = alias_iter->second;
+ }
+ else
+ {
+ canonical_name = name;
+ }
+ jointp = mRoot->findJoint(canonical_name);
+ // Joint-lookup improvements
+ //mJointMap[name] = jointp;
+ mJointMap[std::string(name)] = jointp;
}
else
- { //return cached pointer
- jointp = iter->second;
+ { //return cached pointer
+ jointp = iter->second;
}
-//
#ifndef LL_RELEASE_FOR_DOWNLOAD
if (jointp && jointp->getName()!="mScreen" && jointp->getName()!="mRoot")
@@ -7373,17 +7348,10 @@ LLJoint *LLVOAvatar::getJoint( S32 joint_num )
void LLVOAvatar::initAllJoints()
{
getJointAliases();
- // Lookup performance changes
- //for (auto& alias : mJointAliasMap)
- //{
- // mJointMap[alias.first] = mRoot->findJoint(alias.second);
- // mJointMap[JointKey::construct(alias.first).mKey] = mRoot->findJoint(alias.second);
- //}
- for (const auto& alias : mJointAliasMap)
+ for (auto& alias : mJointAliasMap)
{
- mJointMap[JointKey::construct(alias.first).mKey] = mRoot->findJoint(alias.second);
+ mJointMap[alias.first] = mRoot->findJoint(alias.second);
}
- //
// ignore mScreen and mRoot
}
@@ -7712,11 +7680,7 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// std::string lookingForJoint = pSkinData->mJointNames[ i ].c_str();
- JointKey lookingForJoint = pSkinData->mJointNames[ i ];
-//
-
+ std::string lookingForJoint = pSkinData->mJointNames[i].c_str();
LLJoint* pJoint = getJoint( lookingForJoint );
if (pJoint)
{
@@ -7729,10 +7693,7 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// if( lookingForJoint == "mPelvis" )
- if( lookingForJoint.mName == "mPelvis" )
-//
+ if( lookingForJoint == "mPelvis" )
{
pelvisGotSet = true;
}
@@ -7923,10 +7884,7 @@ void LLVOAvatar::removeAttachmentOverridesForObject(LLViewerObject *vo)
//-----------------------------------------------------------------------------
void LLVOAvatar::removeAttachmentOverridesForObject(const LLUUID& mesh_id)
{
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// LLJoint* pJointPelvis = getJoint( "mPelvis" );
- LLJoint* pJointPelvis = getJoint( JointKey::construct( "mPelvis" ) );
-//
+ LLJoint* pJointPelvis = getJoint( "mPelvis" );
const std::string av_string = avString();
for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++)
@@ -8114,10 +8072,7 @@ void LLVOAvatar::initAttachmentPoints(bool ignore_hud_joints)
attachment->setName(info->mName);
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
-// LLJoint *parent_joint = getJoint(info->mJointName);
- LLJoint *parent_joint = getJoint( JointKey::construct( info->mJointName ) );
-//
+ LLJoint *parent_joint = getJoint(info->mJointName);
if (!parent_joint)
{
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 5beff6d393..4cb80380fb 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -204,11 +204,9 @@ public:
void startDefaultMotions();
void dumpAnimationState();
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
+ // Joint-lookup improvements
//virtual LLJoint* getJoint(const std::string &name);
- virtual LLJoint* getJoint(const JointKey& name);
- LLJoint* getJoint(const std::string& name) { return getJoint(JointKey::construct(name)); }
-//
+ virtual LLJoint* getJoint(std::string_view name);
LLJoint* getJoint(S32 num);
void initAllJoints();
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 1b609e9ffd..9dae1846ca 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1029,27 +1029,22 @@ void LLVOAvatarSelf::idleUpdate(LLAgent &agent, const F64 &time)
}
// virtual
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
+// Joint-lookup improvements
//LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)
-LLJoint *LLVOAvatarSelf::getJoint(const JointKey& name)
-//
+LLJoint* LLVOAvatarSelf::getJoint(std::string_view name)
{
std::lock_guard lock(mJointMapMutex);
LLJoint *jointp = NULL;
jointp = LLVOAvatar::getJoint(name);
if (!jointp && mScreenp)
{
- // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
- //jointp = mScreenp->findJoint(name);
- jointp = mScreenp->findJoint(name.mName);
- //
+ jointp = mScreenp->findJoint(name);
if (jointp)
{
- // Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
+ // Joint-lookup improvements
//mJointMap[name] = jointp;
- mJointMap[name.mKey] = jointp;
- //
- }
+ mJointMap[std::string(name)] = jointp;
+ }
}
if (jointp && jointp != mScreenp && jointp != mRoot)
{
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index b57b601940..688891eb68 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -91,10 +91,9 @@ public:
/*virtual*/ void stopMotionFromSource(const LLUUID& source_id);
/*virtual*/ void requestStopMotion(LLMotion* motion);
-// Query by JointKey rather than just a string, the key can be a U32 index for faster lookup
+ // Joint-lookup improvements
// /*virtual*/ LLJoint* getJoint(const std::string &name);
- /*virtual*/ LLJoint* getJoint(const JointKey& name);
-//
+ /*virtual*/ LLJoint* getJoint(std::string_view name);
/*virtual*/ void renderJoints();
diff --git a/indra/newview/vjlocalmeshimportdae.cpp b/indra/newview/vjlocalmeshimportdae.cpp
index d6f8fd40cc..9d73b0c80c 100644
--- a/indra/newview/vjlocalmeshimportdae.cpp
+++ b/indra/newview/vjlocalmeshimportdae.cpp
@@ -673,7 +673,7 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll
{
LL_DEBUGS("LocalMesh") << "Found internal joint name: " << joint_name << LL_ENDL;
joint_name = joint_map[joint_name];
- skininfo.mJointNames.push_back(JointKey::construct(joint_name));
+ skininfo.mJointNames.push_back(joint_name);
skininfo.mJointNums.push_back(-1);
}
};
@@ -761,7 +761,7 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll
jointname_iterator != skininfop->mJointNames.end();
++jointname_iterator, ++jointname_idx)
{
- std::string name_lookup = jointname_iterator->mName;
+ const std::string& name_lookup = *jointname_iterator;
if (joint_map.find(name_lookup) == joint_map.end())
{
pushLog("DAE Importer", "WARNING: Unknown joint named " + name_lookup + " found, skipping over it.");