summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-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
5 files changed, 70 insertions, 9 deletions
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