summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llappearance/llavatarappearance.cpp16
-rw-r--r--indra/llappearance/llavatarappearance.h1
-rw-r--r--indra/llprimitive/llmodel.cpp1
-rw-r--r--indra/llprimitive/llmodel.h1
-rw-r--r--indra/newview/llskinningutil.cpp16
-rw-r--r--indra/newview/llvoavatar.cpp42
-rw-r--r--indra/newview/llvoavatar.h1
-rw-r--r--indra/newview/llvoavatarself.cpp18
-rw-r--r--indra/newview/llvovolume.cpp2
9 files changed, 82 insertions, 16 deletions
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index af14e3418b..ebeab22dcc 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -187,7 +187,11 @@ LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) :
mHeadOffset(),
mRoot(NULL),
mWearableData(wearable_data),
- mNextJointNum(0)
+ mNextJointNum(0),
+ mNumBones(0),
+ mNumCollisionVolumes(0),
+ mCollisionVolumes(NULL),
+ mIsBuilt(FALSE)
{
llassert_always(mWearableData);
mBakedTextureDatas.resize(LLAvatarAppearanceDefines::BAKED_NUM_INDICES);
@@ -200,11 +204,6 @@ LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) :
mBakedTextureDatas[i].mMaskTexName = 0;
mBakedTextureDatas[i].mTextureIndex = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((LLAvatarAppearanceDefines::EBakedTextureIndex)i);
}
-
- mIsBuilt = FALSE;
-
- mNumCollisionVolumes = 0;
- mCollisionVolumes = NULL;
}
// virtual
@@ -667,14 +666,16 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent
if (info->mIsJoint)
{
joint->setSkinOffset( info->mPivot );
+ joint->setJointNum(joint_num);
joint_num++;
}
else // collision volume
{
+ joint->setJointNum(mNumBones+volume_num);
volume_num++;
}
+ mNextJointNum++;
- joint->setJointNum(mNextJointNum++);
// setup children
LLAvatarBoneInfo::child_list_t::const_iterator iter;
@@ -699,6 +700,7 @@ BOOL LLAvatarAppearance::allocateCharacterJoints( U32 num )
{
clearSkeleton();
mSkeleton = avatar_joint_list_t(num,NULL);
+ mNumBones = num;
}
return TRUE;
diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
index 6938ca2dea..77795f3bf6 100644
--- a/indra/llappearance/llavatarappearance.h
+++ b/indra/llappearance/llavatarappearance.h
@@ -352,6 +352,7 @@ protected:
// Collision volumes
//--------------------------------------------------------------------
public:
+ S32 mNumBones;
S32 mNumCollisionVolumes;
LLAvatarJointCollisionVolume* mCollisionVolumes;
protected:
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 6637f41966..7677dc9e27 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -1399,6 +1399,7 @@ void LLMeshSkinInfo::fromLLSD(LLSD& skin)
for (U32 i = 0; i < skin["joint_names"].size(); ++i)
{
mJointNames.push_back(skin["joint_names"][i]);
+ mJointNums.push_back(-1);
}
}
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index c23d65bc8f..2034686529 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -49,6 +49,7 @@ public:
LLUUID mMeshID;
std::vector<std::string> mJointNames;
+ mutable std::vector<S32> mJointNums;
std::vector<LLMatrix4> mInvBindMatrix;
std::vector<LLMatrix4> mAlternateBindMatrix;
std::vector<U32> mJointRemap;
diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp
index d69432ad21..e1333b8352 100644
--- a/indra/newview/llskinningutil.cpp
+++ b/indra/newview/llskinningutil.cpp
@@ -203,6 +203,7 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski
// Apply the remap to mJointNames, mInvBindMatrix, and mAlternateBindMatrix
std::vector<std::string> new_joint_names;
+ std::vector<S32> new_joint_nums;
std::vector<LLMatrix4> new_inv_bind_matrix;
std::vector<LLMatrix4> new_alternate_bind_matrix;
@@ -211,6 +212,7 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski
if (j_proxy[j] == j && new_joint_names.size() < max_joints)
{
new_joint_names.push_back(skin->mJointNames[j]);
+ new_joint_nums.push_back(-1);
new_inv_bind_matrix.push_back(skin->mInvBindMatrix[j]);
if (!skin->mAlternateBindMatrix.empty())
{
@@ -245,7 +247,19 @@ void LLSkinningUtil::initSkinningMatrixPalette(
// Note that we are mostly passing Matrix4a's to this routine anyway, just dubiously casted.
for (U32 j = 0; j < count; ++j)
{
- LLJoint* joint = avatar->getJoint(skin->mJointNames[j]);
+ LLJoint *joint = NULL;
+ if (skin->mJointNums[j] == -1)
+ {
+ joint = avatar->getJoint(skin->mJointNames[j]);
+ if (joint)
+ {
+ skin->mJointNums[j] = joint->getJointNum();
+ }
+ }
+ else
+ {
+ joint = avatar->getJoint(skin->mJointNums[j]);
+ }
mat[j] = skin->mInvBindMatrix[j];
if (joint)
{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 7af15fb351..1ff4c1f681 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5324,18 +5324,52 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name )
LLJoint* jointp = NULL;
if (iter == mJointMap.end() || iter->second == NULL)
- { //search for joint and cache found joint in lookup table
+ { //search for joint and cache found joint in lookup table
jointp = mRoot->findJoint(name);
mJointMap[name] = jointp;
}
else
- { //return cached pointer
+ { //return cached pointer
jointp = iter->second;
}
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+ if (jointp && jointp->getName()!="mScreen" && jointp->getName()!="mRoot")
+ {
+ llassert(getJoint(jointp->getJointNum())==jointp);
+ }
+#endif
return jointp;
}
+LLJoint *LLVOAvatar::getJoint( S32 joint_num )
+{
+ LLJoint *pJoint = NULL;
+ S32 collision_start = mNumBones;
+ S32 attachment_start = mNumBones + mNumCollisionVolumes;
+ if (joint_num>=attachment_start)
+ {
+ // Attachment IDs start at 1
+ S32 attachment_id = joint_num - attachment_start + 1;
+ attachment_map_t::iterator iter = mAttachmentPoints.find(attachment_id);
+ if (iter != mAttachmentPoints.end())
+ {
+ pJoint = iter->second;
+ }
+ }
+ else if (joint_num>=collision_start)
+ {
+ S32 collision_id = joint_num-collision_start;
+ pJoint = &mCollisionVolumes[collision_id];
+ }
+ else if (joint_num>=0)
+ {
+ pJoint = mSkeleton[joint_num];
+ }
+ llassert(!pJoint || pJoint->getJointNum() == joint_num);
+ return pJoint;
+}
+
//-----------------------------------------------------------------------------
// getRiggedMeshID
//
@@ -5966,7 +6000,8 @@ void LLVOAvatar::initAttachmentPoints(bool ignore_hud_joints)
attachment->setVisibleInFirstPerson(info->mVisibleFirstPerson);
attachment->setIsHUDAttachment(info->mIsHUDAttachment);
// attachment can potentially be animated, needs a number.
- attachment->setJointNum(mNextJointNum++);
+ attachment->setJointNum(mNumBones + mNumCollisionVolumes + attachmentID - 1);
+ LL_WARNS() << "Initialized attachment" << attachment->getName() << " joint_num " << attachment->getJointNum() << LL_ENDL;
if (newly_created)
{
@@ -6647,7 +6682,6 @@ LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj )
return NULL;
}
-// warning: order(N) not order(1)
S32 LLVOAvatar::getAttachmentCount()
{
S32 count = mAttachmentPoints.size();
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 64171e7243..fe76f9852f 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -199,6 +199,7 @@ public:
void dumpAnimationState();
virtual LLJoint* getJoint(const std::string &name);
+ LLJoint* getJoint(S32 num);
void addAttachmentOverridesForObject(LLViewerObject *vo);
void resetJointsOnDetach(const LLUUID& mesh_id);
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index b6655dd078..aa5d82a096 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -700,13 +700,23 @@ void LLVOAvatarSelf::idleUpdate(LLAgent &agent, const F64 &time)
// virtual
LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)
{
- if (mScreenp)
+ LLJoint *jointp = NULL;
+ jointp = LLVOAvatar::getJoint(name);
+ if (!jointp && mScreenp)
{
- LLJoint* jointp = mScreenp->findJoint(name);
- if (jointp) return jointp;
+ jointp = mScreenp->findJoint(name);
+ if (jointp)
+ {
+ mJointMap[name] = jointp;
+ }
}
- return LLVOAvatar::getJoint(name);
+ if (jointp && jointp != mScreenp && jointp != mRoot)
+ {
+ llassert(LLVOAvatar::getJoint((S32)jointp->getJointNum())==jointp);
+ }
+ return jointp;
}
+
// virtual
BOOL LLVOAvatarSelf::setVisualParamWeight(const LLVisualParam *which_param, F32 weight)
{
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 6d3e2e4a39..fd77bc2985 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4779,11 +4779,13 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (rigged && pAvatarVO)
{
pAvatarVO->addAttachmentOverridesForObject(vobj);
+#if 0
if (pAvatarVO->isSelf())
{
bool verbose = true;
pAvatarVO->showAttachmentOverrides(verbose);
}
+#endif
}
//for each face