Fix a few animation crashers, change default imported object name
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "llhandmotion.h"
|
||||
#include "llcriticaldamp.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Constants
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -220,7 +221,7 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask)
|
||||
target = target * target_dist;
|
||||
if (!target.isFinite())
|
||||
{
|
||||
llerrs << "Non finite target in editing motion with target distance of " << target_dist <<
|
||||
llwarns << "Non finite target in editing motion with target distance of " << target_dist <<
|
||||
" and focus point " << focus_pt << " and pointAtPt: " << *pointAtPt << llendl;
|
||||
}
|
||||
|
||||
|
||||
@@ -526,4 +526,35 @@ void LLJoint::clampRotation(LLQuaternion old_rot, LLQuaternion new_rot)
|
||||
// }
|
||||
}
|
||||
|
||||
// <edit>
|
||||
std::string LLJoint::exportString(U32 tabs)
|
||||
{
|
||||
std::string out;
|
||||
for(U32 i = 0; i < tabs; i++) out.append("\t");
|
||||
out.append("<joint ");
|
||||
out.append(llformat("name=\"%s\" ", this->mName.c_str()));
|
||||
LLVector3 position = getPosition();
|
||||
out.append(llformat("pos=\"<%f, %f, %f>\" ", position.mV[0], position.mV[1], position.mV[2]));
|
||||
LLQuaternion rotation = getRotation();
|
||||
out.append(llformat("rot=\"<%f, %f, %f, %f>\" ", rotation.mQ[0], rotation.mQ[1], rotation.mQ[2], rotation.mQ[3]));
|
||||
if(mChildren.empty())
|
||||
{
|
||||
out.append("/>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.append(">\n");
|
||||
int next_tab = tabs + 1;
|
||||
child_list_t::iterator end = mChildren.end();
|
||||
for(child_list_t::iterator iter = mChildren.begin(); iter != end; ++iter)
|
||||
{
|
||||
out.append((*iter)->exportString(next_tab));
|
||||
}
|
||||
for(U32 i = 0; i < tabs; i++) out.append("\t");
|
||||
out.append("</joint>\n");
|
||||
}
|
||||
return out;
|
||||
}
|
||||
// </edit>
|
||||
|
||||
// End
|
||||
|
||||
@@ -178,6 +178,10 @@ public:
|
||||
|
||||
S32 getJointNum() const { return mJointNum; }
|
||||
void setJointNum(S32 joint_num) { mJointNum = joint_num; }
|
||||
|
||||
// <edit>
|
||||
std::string exportString(U32 tabs = 0);
|
||||
// </edit>
|
||||
};
|
||||
#endif // LL_LLJOINT_H
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -158,6 +158,9 @@ void LLPose::setWeight(F32 weight)
|
||||
iter != mJointMap.end();
|
||||
++iter)
|
||||
{
|
||||
// <edit>
|
||||
// there was a crash here
|
||||
// </edit>
|
||||
iter->second->setWeight(weight);
|
||||
}
|
||||
mWeight = weight;
|
||||
|
||||
@@ -421,7 +421,7 @@ LLImportObject::LLImportObject(std::string id, LLSD prim)
|
||||
importIsAttachment = false;
|
||||
mId = id;
|
||||
mParentId = "";
|
||||
mPrimName = "Primitive";
|
||||
mPrimName = "Object";
|
||||
if(prim.has("parent"))
|
||||
{
|
||||
mParentId = prim["parent"].asString();
|
||||
|
||||
Reference in New Issue
Block a user