summaryrefslogtreecommitdiff
path: root/indra/llcharacter
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2007-05-02 21:24:47 +0000
committerDon Kjer <don@lindenlab.com>2007-05-02 21:24:47 +0000
commit1c909afe3998778e4cc045c9ab733e8afbf7c25b (patch)
tree75c00a32a8e305280cbec253195d1113d628fc3e /indra/llcharacter
parentbc59c04653bf1404e8148a8169208b146a123b28 (diff)
svn merge -r 60342:61148 svn+ssh://svn/svn/linden/branches/maintenance into release
Diffstat (limited to 'indra/llcharacter')
-rw-r--r--indra/llcharacter/llkeyframemotion.cpp65
-rw-r--r--indra/llcharacter/llkeyframemotionparam.cpp6
-rw-r--r--indra/llcharacter/llstatemachine.cpp30
-rw-r--r--indra/llcharacter/llvisualparam.cpp12
4 files changed, 69 insertions, 44 deletions
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp
index 7c8a7160e7..444007bf07 100644
--- a/indra/llcharacter/llkeyframemotion.cpp
+++ b/indra/llcharacter/llkeyframemotion.cpp
@@ -1389,6 +1389,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (!success)
{
llwarns << "can't read rotation key (" << k << ")" << llendl;
+ delete rot_key;
return FALSE;
}
@@ -1507,6 +1508,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (!dp.unpackU8(byte, "chain_length"))
{
llwarns << "can't read constraint chain length" << llendl;
+ delete constraintp;
return FALSE;
}
constraintp->mChainLength = (S32) byte;
@@ -1514,6 +1516,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (!dp.unpackU8(byte, "constraint_type"))
{
llwarns << "can't read constraint type" << llendl;
+ delete constraintp;
return FALSE;
}
constraintp->mConstraintType = (EConstraintType)byte;
@@ -1523,6 +1526,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "source_volume"))
{
llwarns << "can't read source volume name" << llendl;
+ delete constraintp;
return FALSE;
}
@@ -1533,12 +1537,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset"))
{
llwarns << "can't read constraint source offset" << llendl;
+ delete constraintp;
return FALSE;
}
if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "target_volume"))
{
llwarns << "can't read target volume name" << llendl;
+ delete constraintp;
return FALSE;
}
@@ -1558,12 +1564,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (!dp.unpackVector3(constraintp->mTargetConstraintOffset, "target_offset"))
{
llwarns << "can't read constraint target offset" << llendl;
+ delete constraintp;
return FALSE;
}
if (!dp.unpackVector3(constraintp->mTargetConstraintDir, "target_dir"))
{
llwarns << "can't read constraint target direction" << llendl;
+ delete constraintp;
return FALSE;
}
@@ -1576,24 +1584,28 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start"))
{
llwarns << "can't read constraint ease in start time" << llendl;
+ delete constraintp;
return FALSE;
}
if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop"))
{
llwarns << "can't read constraint ease in stop time" << llendl;
+ delete constraintp;
return FALSE;
}
if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start"))
{
llwarns << "can't read constraint ease out start time" << llendl;
+ delete constraintp;
return FALSE;
}
if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop"))
{
llwarns << "can't read constraint ease out stop time" << llendl;
+ delete constraintp;
return FALSE;
}
@@ -1947,39 +1959,46 @@ void LLKeyframeMotion::onLoadComplete(LLVFS *vfs,
// create an instance of this motion (it may or may not already exist)
LLKeyframeMotion* motionp = (LLKeyframeMotion*) character->createMotion(asset_uuid);
- if (0 == status && motionp)
+ if (motionp)
{
- if (motionp->mAssetStatus == ASSET_LOADED)
+ if (0 == status)
{
- // asset already loaded
- return;
- }
- LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
- S32 size = file.getSize();
-
- U8* buffer = new U8[size];
- file.read((U8*)buffer, size); /*Flawfinder: ignore*/
-
- lldebugs << "Loading keyframe data for: " << motionp->getName() << ":" << motionp->getID() << " (" << size << " bytes)" << llendl;
-
- LLDataPackerBinaryBuffer dp(buffer, size);
- if (motionp->deserialize(dp))
- {
- motionp->mAssetStatus = ASSET_LOADED;
+ if (motionp->mAssetStatus == ASSET_LOADED)
+ {
+ // asset already loaded
+ return;
+ }
+ LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
+ S32 size = file.getSize();
+
+ U8* buffer = new U8[size];
+ file.read((U8*)buffer, size); /*Flawfinder: ignore*/
+
+ lldebugs << "Loading keyframe data for: " << motionp->getName() << ":" << motionp->getID() << " (" << size << " bytes)" << llendl;
+
+ LLDataPackerBinaryBuffer dp(buffer, size);
+ if (motionp->deserialize(dp))
+ {
+ motionp->mAssetStatus = ASSET_LOADED;
+ }
+ else
+ {
+ llwarns << "Failed to decode asset for animation " << motionp->getName() << ":" << motionp->getID() << llendl;
+ motionp->mAssetStatus = ASSET_FETCH_FAILED;
+ }
+
+ delete []buffer;
}
else
{
- llwarns << "Failed to decode asset for animation " << motionp->getName() << ":" << motionp->getID() << llendl;
+ llwarns << "Failed to load asset for animation " << motionp->getName() << ":" << motionp->getID() << llendl;
motionp->mAssetStatus = ASSET_FETCH_FAILED;
}
-
- delete []buffer;
-
}
else
{
- llwarns << "Failed to load asset for animation " << motionp->getName() << ":" << motionp->getID() << llendl;
- motionp->mAssetStatus = ASSET_FETCH_FAILED;
+ // motionp is NULL
+ llwarns << "Failed to createMotion() for asset UUID " << asset_uuid << llendl;
}
}
diff --git a/indra/llcharacter/llkeyframemotionparam.cpp b/indra/llcharacter/llkeyframemotionparam.cpp
index a4d61c35c5..6643b959a2 100644
--- a/indra/llcharacter/llkeyframemotionparam.cpp
+++ b/indra/llcharacter/llkeyframemotionparam.cpp
@@ -167,6 +167,12 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask)
ParameterizedMotion* firstMotion = NULL;
ParameterizedMotion* secondMotion = NULL;
+ if (NULL == paramValue) // unexpected, but...
+ {
+ llwarns << "paramValue == NULL" << llendl;
+ continue;
+ }
+
for (ParameterizedMotion* paramMotion = motionList->getFirstData(); paramMotion; paramMotion = motionList->getNextData())
{
paramMotion->first->onUpdate(time, joint_mask);
diff --git a/indra/llcharacter/llstatemachine.cpp b/indra/llcharacter/llstatemachine.cpp
index d51b2f75aa..9fd043bdbf 100644
--- a/indra/llcharacter/llstatemachine.cpp
+++ b/indra/llcharacter/llstatemachine.cpp
@@ -342,28 +342,28 @@ void LLStateMachine::processTransition(LLFSMTransition& transition, void* user_d
{
llassert(mStateDiagram);
+ if (NULL == mCurrentState)
+ {
+ llwarns << "mCurrentState == NULL; aborting processTransition()" << llendl;
+ return;
+ }
+
LLFSMState* new_state = mStateDiagram->processTransition(*mCurrentState, transition);
+ if (NULL == new_state)
+ {
+ llwarns << "new_state == NULL; aborting processTransition()" << llendl;
+ return;
+ }
+
mLastTransition = &transition;
mLastState = mCurrentState;
if (*mCurrentState != *new_state)
{
- if (mCurrentState && new_state && *mCurrentState != *new_state)
- {
- mCurrentState->onExit(user_data);
- }
- if (new_state)
- {
- if (!mCurrentState || *mCurrentState != *new_state)
- {
- mCurrentState = new_state;
- if (mCurrentState)
- {
- mCurrentState->onEntry(user_data);
- }
- }
- }
+ mCurrentState->onExit(user_data);
+ mCurrentState = new_state;
+ mCurrentState->onEntry(user_data);
#if FSM_PRINT_STATE_TRANSITIONS
llinfos << "Entering state " << mCurrentState->getName() <<
" on transition " << transition.getName() << " from state " <<
diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp
index a6fd9b974f..e29800ee4a 100644
--- a/indra/llcharacter/llvisualparam.cpp
+++ b/indra/llcharacter/llvisualparam.cpp
@@ -212,16 +212,16 @@ void LLVisualParam::setWeight(F32 weight, BOOL set_by_user)
//-----------------------------------------------------------------------------
void LLVisualParam::setAnimationTarget(F32 target_value, BOOL set_by_user)
{
- if (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE)
+ if (mInfo)
{
- if (mInfo)
+ if (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE)
{
mTargetWeight = llclamp(target_value, mInfo->mMinWeight, mInfo->mMaxWeight);
}
- else
- {
- mTargetWeight = target_value;
- }
+ }
+ else
+ {
+ mTargetWeight = target_value;
}
mIsAnimating = TRUE;