Fix a few animation crashers, change default imported object name

This commit is contained in:
Hazim Gazov
2010-07-02 03:22:01 +00:00
parent acab2bd974
commit a587fbafeb
6 changed files with 75 additions and 4 deletions

View File

@@ -468,7 +468,14 @@ LLMotion *LLKeyframeMotion::create(const LLUUID &id)
//-----------------------------------------------------------------------------
LLPointer<LLJointState>& LLKeyframeMotion::getJointState(U32 index)
{
llassert_always (index < (S32)mJointStates.size());
// <edit>
//llassert_always (index < (S32)mJointStates.size());
if(index >= (S32)mJointStates.size())
{
llwarns << "LLKeyframeMotion::getJointState: index >= size" << llendl;
index = (S32)mJointStates.size() - 1;
}
// </edit>
return mJointStates[index];
}
@@ -477,7 +484,11 @@ LLPointer<LLJointState>& LLKeyframeMotion::getJointState(U32 index)
//-----------------------------------------------------------------------------
LLJoint* LLKeyframeMotion::getJoint(U32 index)
{
llassert_always (index < (S32)mJointStates.size());
// <edit>
//llassert_always (index < (S32)mJointStates.size());
if(index >= (S32)mJointStates.size())
index = (S32)mJointStates.size() - 1;
// </edit>
LLJoint* joint = mJointStates[index]->getJoint();
llassert_always (joint);
return joint;
@@ -1372,6 +1383,18 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
}
else
{
// <edit>
int sz = joint_name.size();
int i = 0;
while (i < sz)
{
if ('\a' == joint_name[i])
{
joint_name.replace(i, 1, " ");
}
i++;
}
// </edit>
llwarns << "joint not found: " << joint_name << llendl;
//return FALSE;
}
@@ -1650,6 +1673,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
str = (char*)bin_data;
constraintp->mSourceConstraintVolume = mCharacter->getCollisionVolumeID(str);
// <edit>
if(constraintp->mSourceConstraintVolume == -1)
{
llwarns << "can't get source constraint volume" << llendl;
delete constraintp;
return FALSE;
}
// </edit>
if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset"))
{
llwarns << "can't read constraint source offset" << llendl;