diff options
author | Jacek Antonelli | 2008-08-15 23:44:56 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:56 -0500 |
commit | c07901e29ed545bbb02e3bddf148fe1104b94e9f (patch) | |
tree | f1ada64ce834acd7d92a425efb96c4b86bcf16b1 /linden/indra/llcharacter | |
parent | Second Life viewer sources 1.15.0.2 (diff) | |
download | meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.zip meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.gz meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.bz2 meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.xz |
Second Life viewer sources 1.15.1.3
Diffstat (limited to 'linden/indra/llcharacter')
-rw-r--r-- | linden/indra/llcharacter/llkeyframemotion.cpp | 89 | ||||
-rw-r--r-- | linden/indra/llcharacter/llkeyframemotionparam.cpp | 6 | ||||
-rw-r--r-- | linden/indra/llcharacter/llstatemachine.cpp | 30 | ||||
-rw-r--r-- | linden/indra/llcharacter/llvisualparam.cpp | 12 |
4 files changed, 70 insertions, 67 deletions
diff --git a/linden/indra/llcharacter/llkeyframemotion.cpp b/linden/indra/llcharacter/llkeyframemotion.cpp index 94e45b6..e5d610a 100644 --- a/linden/indra/llcharacter/llkeyframemotion.cpp +++ b/linden/indra/llcharacter/llkeyframemotion.cpp | |||
@@ -1409,6 +1409,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) | |||
1409 | if (!success) | 1409 | if (!success) |
1410 | { | 1410 | { |
1411 | llwarns << "can't read rotation key (" << k << ")" << llendl; | 1411 | llwarns << "can't read rotation key (" << k << ")" << llendl; |
1412 | delete rot_key; | ||
1412 | return FALSE; | 1413 | return FALSE; |
1413 | } | 1414 | } |
1414 | 1415 | ||
@@ -1527,6 +1528,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) | |||
1527 | if (!dp.unpackU8(byte, "chain_length")) | 1528 | if (!dp.unpackU8(byte, "chain_length")) |
1528 | { | 1529 | { |
1529 | llwarns << "can't read constraint chain length" << llendl; | 1530 | llwarns << "can't read constraint chain length" << llendl; |
1531 | delete constraintp; | ||
1530 | return FALSE; | 1532 | return FALSE; |
1531 | } | 1533 | } |
1532 | constraintp->mChainLength = (S32) byte; | 1534 | constraintp->mChainLength = (S32) byte; |
@@ -1534,6 +1536,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) | |||
1534 | if (!dp.unpackU8(byte, "constraint_type")) | 1536 | if (!dp.unpackU8(byte, "constraint_type")) |
1535 | { | 1537 | { |
1536 | llwarns << "can't read constraint type" << llendl; | 1538 | llwarns << "can't read constraint type" << llendl; |
1539 | delete constraintp; | ||
1537 | return FALSE; | 1540 | return FALSE; |
1538 | } | 1541 | } |
1539 | constraintp->mConstraintType = (EConstraintType)byte; | 1542 | constraintp->mConstraintType = (EConstraintType)byte; |
@@ -1543,6 +1546,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) | |||
1543 | if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "source_volume")) | 1546 | if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "source_volume")) |
1544 | { | 1547 | { |
1545 | llwarns << "can't read source volume name" << llendl; | 1548 | llwarns << "can't read source volume name" << llendl; |
1549 | delete constraintp; | ||
1546 | return FALSE; | 1550 | return FALSE; |
1547 | } | 1551 | } |
1548 | 1552 | ||
@@ -1553,12 +1557,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) | |||
1553 | if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset")) | 1557 | if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset")) |
1554 | { | 1558 | { |
1555 | llwarns << "can't read constraint source offset" << llendl; | 1559 | llwarns << "can't read constraint source offset" << llendl; |
1560 | delete constraintp; | ||
1556 | return FALSE; | 1561 | return FALSE; |
1557 | } | 1562 | } |
1558 | 1563 | ||
1559 | if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "target_volume")) | 1564 | if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "target_volume")) |
1560 | { | 1565 | { |
1561 | llwarns << "can't read target volume name" << llendl; | 1566 | llwarns << "can't read target volume name" << llendl; |
1567 | delete constraintp; | ||
1562 | return FALSE; | 1568 | return FALSE; |
1563 | } | 1569 | } |
1564 | 1570 | ||
@@ -1578,12 +1584,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) | |||
1578 | if (!dp.unpackVector3(constraintp->mTargetConstraintOffset, "target_offset")) | 1584 | if (!dp.unpackVector3(constraintp->mTargetConstraintOffset, "target_offset")) |
1579 | { | 1585 | { |
1580 | llwarns << "can't read constraint target offset" << llendl; | 1586 | llwarns << "can't read constraint target offset" << llendl; |
1587 | delete constraintp; | ||
1581 | return FALSE; | 1588 | return FALSE; |
1582 | } | 1589 | } |
1583 | 1590 | ||
1584 | if (!dp.unpackVector3(constraintp->mTargetConstraintDir, "target_dir")) | 1591 | if (!dp.unpackVector3(constraintp->mTargetConstraintDir, "target_dir")) |
1585 | { | 1592 | { |
1586 | llwarns << "can't read constraint target direction" << llendl; | 1593 | llwarns << "can't read constraint target direction" << llendl; |
1594 | delete constraintp; | ||
1587 | return FALSE; | 1595 | return FALSE; |
1588 | } | 1596 | } |
1589 | 1597 | ||
@@ -1596,24 +1604,28 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) | |||
1596 | if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start")) | 1604 | if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start")) |
1597 | { | 1605 | { |
1598 | llwarns << "can't read constraint ease in start time" << llendl; | 1606 | llwarns << "can't read constraint ease in start time" << llendl; |
1607 | delete constraintp; | ||
1599 | return FALSE; | 1608 | return FALSE; |
1600 | } | 1609 | } |
1601 | 1610 | ||
1602 | if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop")) | 1611 | if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop")) |
1603 | { | 1612 | { |
1604 | llwarns << "can't read constraint ease in stop time" << llendl; | 1613 | llwarns << "can't read constraint ease in stop time" << llendl; |
1614 | delete constraintp; | ||
1605 | return FALSE; | 1615 | return FALSE; |
1606 | } | 1616 | } |
1607 | 1617 | ||
1608 | if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start")) | 1618 | if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start")) |
1609 | { | 1619 | { |
1610 | llwarns << "can't read constraint ease out start time" << llendl; | 1620 | llwarns << "can't read constraint ease out start time" << llendl; |
1621 | delete constraintp; | ||
1611 | return FALSE; | 1622 | return FALSE; |
1612 | } | 1623 | } |
1613 | 1624 | ||
1614 | if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop")) | 1625 | if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop")) |
1615 | { | 1626 | { |
1616 | llwarns << "can't read constraint ease out stop time" << llendl; | 1627 | llwarns << "can't read constraint ease out stop time" << llendl; |
1628 | delete constraintp; | ||
1617 | return FALSE; | 1629 | return FALSE; |
1618 | } | 1630 | } |
1619 | 1631 | ||
@@ -1739,29 +1751,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const | |||
1739 | success &= dp.packVector3(shared_constraintp->mSourceConstraintOffset, "source_offset"); | 1751 | success &= dp.packVector3(shared_constraintp->mSourceConstraintOffset, "source_offset"); |
1740 | if (shared_constraintp->mConstraintTargetType == TYPE_GROUND) | 1752 | if (shared_constraintp->mConstraintTargetType == TYPE_GROUND) |
1741 | { | 1753 | { |
1742 | success &= dp.packU8(shared_constraintp->mChainLength, "chain_length"); | 1754 | snprintf(volume_name,sizeof(volume_name), "%s", "GROUND"); /* Flawfinder: ignore */ |
1743 | success &= dp.packU8(shared_constraintp->mConstraintType, "constraint_type"); | ||
1744 | char volume_name[16]; /* Flawfinder: ignore */ | ||
1745 | snprintf(volume_name, sizeof(volume_name), "%s", /* Flawfinder: ignore */ | ||
1746 | mCharacter->findCollisionVolume(shared_constraintp->mSourceConstraintVolume)->getName().c_str()); | ||
1747 | success &= dp.packBinaryDataFixed((U8*)volume_name, 16, "source_volume"); | ||
1748 | success &= dp.packVector3(shared_constraintp->mSourceConstraintOffset, "source_offset"); | ||
1749 | if (shared_constraintp->mConstraintTargetType == TYPE_GROUND) | ||
1750 | { | ||
1751 | snprintf(volume_name,sizeof(volume_name), "%s", "GROUND"); /* Flawfinder: ignore */ | ||
1752 | } | ||
1753 | else | ||
1754 | { | ||
1755 | snprintf(volume_name, sizeof(volume_name),"%s", /* Flawfinder: ignore */ | ||
1756 | mCharacter->findCollisionVolume(shared_constraintp->mTargetConstraintVolume)->getName().c_str()); | ||
1757 | } | ||
1758 | success &= dp.packBinaryDataFixed((U8*)volume_name, 16, "target_volume"); | ||
1759 | success &= dp.packVector3(shared_constraintp->mTargetConstraintOffset, "target_offset"); | ||
1760 | success &= dp.packVector3(shared_constraintp->mTargetConstraintDir, "target_dir"); | ||
1761 | success &= dp.packF32(shared_constraintp->mEaseInStartTime, "ease_in_start"); | ||
1762 | success &= dp.packF32(shared_constraintp->mEaseInStopTime, "ease_in_stop"); | ||
1763 | success &= dp.packF32(shared_constraintp->mEaseOutStartTime, "ease_out_start"); | ||
1764 | success &= dp.packF32(shared_constraintp->mEaseOutStopTime, "ease_out_stop"); | ||
1765 | } | 1755 | } |
1766 | else | 1756 | else |
1767 | { | 1757 | { |
@@ -1967,39 +1957,46 @@ void LLKeyframeMotion::onLoadComplete(LLVFS *vfs, | |||
1967 | // create an instance of this motion (it may or may not already exist) | 1957 | // create an instance of this motion (it may or may not already exist) |
1968 | LLKeyframeMotion* motionp = (LLKeyframeMotion*) character->createMotion(asset_uuid); | 1958 | LLKeyframeMotion* motionp = (LLKeyframeMotion*) character->createMotion(asset_uuid); |
1969 | 1959 | ||
1970 | if (0 == status && motionp) | 1960 | if (motionp) |
1971 | { | 1961 | { |
1972 | if (motionp->mAssetStatus == ASSET_LOADED) | 1962 | if (0 == status) |
1973 | { | ||
1974 | // asset already loaded | ||
1975 | return; | ||
1976 | } | ||
1977 | LLVFile file(vfs, asset_uuid, type, LLVFile::READ); | ||
1978 | S32 size = file.getSize(); | ||
1979 | |||
1980 | U8* buffer = new U8[size]; | ||
1981 | file.read((U8*)buffer, size); /*Flawfinder: ignore*/ | ||
1982 | |||
1983 | lldebugs << "Loading keyframe data for: " << motionp->getName() << ":" << motionp->getID() << " (" << size << " bytes)" << llendl; | ||
1984 | |||
1985 | LLDataPackerBinaryBuffer dp(buffer, size); | ||
1986 | if (motionp->deserialize(dp)) | ||
1987 | { | 1963 | { |
1988 | motionp->mAssetStatus = ASSET_LOADED; | 1964 | if (motionp->mAssetStatus == ASSET_LOADED) |
1965 | { | ||
1966 | // asset already loaded | ||
1967 | return; | ||
1968 | } | ||
1969 | LLVFile file(vfs, asset_uuid, type, LLVFile::READ); | ||
1970 | S32 size = file.getSize(); | ||
1971 | |||
1972 | U8* buffer = new U8[size]; | ||
1973 | file.read((U8*)buffer, size); /*Flawfinder: ignore*/ | ||
1974 | |||
1975 | lldebugs << "Loading keyframe data for: " << motionp->getName() << ":" << motionp->getID() << " (" << size << " bytes)" << llendl; | ||
1976 | |||
1977 | LLDataPackerBinaryBuffer dp(buffer, size); | ||
1978 | if (motionp->deserialize(dp)) | ||
1979 | { | ||
1980 | motionp->mAssetStatus = ASSET_LOADED; | ||
1981 | } | ||
1982 | else | ||
1983 | { | ||
1984 | llwarns << "Failed to decode asset for animation " << motionp->getName() << ":" << motionp->getID() << llendl; | ||
1985 | motionp->mAssetStatus = ASSET_FETCH_FAILED; | ||
1986 | } | ||
1987 | |||
1988 | delete []buffer; | ||
1989 | } | 1989 | } |
1990 | else | 1990 | else |
1991 | { | 1991 | { |
1992 | llwarns << "Failed to decode asset for animation " << motionp->getName() << ":" << motionp->getID() << llendl; | 1992 | llwarns << "Failed to load asset for animation " << motionp->getName() << ":" << motionp->getID() << llendl; |
1993 | motionp->mAssetStatus = ASSET_FETCH_FAILED; | 1993 | motionp->mAssetStatus = ASSET_FETCH_FAILED; |
1994 | } | 1994 | } |
1995 | |||
1996 | delete []buffer; | ||
1997 | |||
1998 | } | 1995 | } |
1999 | else | 1996 | else |
2000 | { | 1997 | { |
2001 | llwarns << "Failed to load asset for animation " << motionp->getName() << ":" << motionp->getID() << llendl; | 1998 | // motionp is NULL |
2002 | motionp->mAssetStatus = ASSET_FETCH_FAILED; | 1999 | llwarns << "Failed to createMotion() for asset UUID " << asset_uuid << llendl; |
2003 | } | 2000 | } |
2004 | } | 2001 | } |
2005 | 2002 | ||
diff --git a/linden/indra/llcharacter/llkeyframemotionparam.cpp b/linden/indra/llcharacter/llkeyframemotionparam.cpp index 5970909..d24b8a6 100644 --- a/linden/indra/llcharacter/llkeyframemotionparam.cpp +++ b/linden/indra/llcharacter/llkeyframemotionparam.cpp | |||
@@ -187,6 +187,12 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) | |||
187 | ParameterizedMotion* firstMotion = NULL; | 187 | ParameterizedMotion* firstMotion = NULL; |
188 | ParameterizedMotion* secondMotion = NULL; | 188 | ParameterizedMotion* secondMotion = NULL; |
189 | 189 | ||
190 | if (NULL == paramValue) // unexpected, but... | ||
191 | { | ||
192 | llwarns << "paramValue == NULL" << llendl; | ||
193 | continue; | ||
194 | } | ||
195 | |||
190 | for (ParameterizedMotion* paramMotion = motionList->getFirstData(); paramMotion; paramMotion = motionList->getNextData()) | 196 | for (ParameterizedMotion* paramMotion = motionList->getFirstData(); paramMotion; paramMotion = motionList->getNextData()) |
191 | { | 197 | { |
192 | paramMotion->first->onUpdate(time, joint_mask); | 198 | paramMotion->first->onUpdate(time, joint_mask); |
diff --git a/linden/indra/llcharacter/llstatemachine.cpp b/linden/indra/llcharacter/llstatemachine.cpp index 1ad81be..d7ecae4 100644 --- a/linden/indra/llcharacter/llstatemachine.cpp +++ b/linden/indra/llcharacter/llstatemachine.cpp | |||
@@ -362,28 +362,28 @@ void LLStateMachine::processTransition(LLFSMTransition& transition, void* user_d | |||
362 | { | 362 | { |
363 | llassert(mStateDiagram); | 363 | llassert(mStateDiagram); |
364 | 364 | ||
365 | if (NULL == mCurrentState) | ||
366 | { | ||
367 | llwarns << "mCurrentState == NULL; aborting processTransition()" << llendl; | ||
368 | return; | ||
369 | } | ||
370 | |||
365 | LLFSMState* new_state = mStateDiagram->processTransition(*mCurrentState, transition); | 371 | LLFSMState* new_state = mStateDiagram->processTransition(*mCurrentState, transition); |
366 | 372 | ||
373 | if (NULL == new_state) | ||
374 | { | ||
375 | llwarns << "new_state == NULL; aborting processTransition()" << llendl; | ||
376 | return; | ||
377 | } | ||
378 | |||
367 | mLastTransition = &transition; | 379 | mLastTransition = &transition; |
368 | mLastState = mCurrentState; | 380 | mLastState = mCurrentState; |
369 | 381 | ||
370 | if (*mCurrentState != *new_state) | 382 | if (*mCurrentState != *new_state) |
371 | { | 383 | { |
372 | if (mCurrentState && new_state && *mCurrentState != *new_state) | 384 | mCurrentState->onExit(user_data); |
373 | { | 385 | mCurrentState = new_state; |
374 | mCurrentState->onExit(user_data); | 386 | mCurrentState->onEntry(user_data); |
375 | } | ||
376 | if (new_state) | ||
377 | { | ||
378 | if (!mCurrentState || *mCurrentState != *new_state) | ||
379 | { | ||
380 | mCurrentState = new_state; | ||
381 | if (mCurrentState) | ||
382 | { | ||
383 | mCurrentState->onEntry(user_data); | ||
384 | } | ||
385 | } | ||
386 | } | ||
387 | #if FSM_PRINT_STATE_TRANSITIONS | 387 | #if FSM_PRINT_STATE_TRANSITIONS |
388 | llinfos << "Entering state " << mCurrentState->getName() << | 388 | llinfos << "Entering state " << mCurrentState->getName() << |
389 | " on transition " << transition.getName() << " from state " << | 389 | " on transition " << transition.getName() << " from state " << |
diff --git a/linden/indra/llcharacter/llvisualparam.cpp b/linden/indra/llcharacter/llvisualparam.cpp index de163eb..d1c08f9 100644 --- a/linden/indra/llcharacter/llvisualparam.cpp +++ b/linden/indra/llcharacter/llvisualparam.cpp | |||
@@ -232,16 +232,16 @@ void LLVisualParam::setWeight(F32 weight, BOOL set_by_user) | |||
232 | //----------------------------------------------------------------------------- | 232 | //----------------------------------------------------------------------------- |
233 | void LLVisualParam::setAnimationTarget(F32 target_value, BOOL set_by_user) | 233 | void LLVisualParam::setAnimationTarget(F32 target_value, BOOL set_by_user) |
234 | { | 234 | { |
235 | if (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) | 235 | if (mInfo) |
236 | { | 236 | { |
237 | if (mInfo) | 237 | if (getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) |
238 | { | 238 | { |
239 | mTargetWeight = llclamp(target_value, mInfo->mMinWeight, mInfo->mMaxWeight); | 239 | mTargetWeight = llclamp(target_value, mInfo->mMinWeight, mInfo->mMaxWeight); |
240 | } | 240 | } |
241 | else | 241 | } |
242 | { | 242 | else |
243 | mTargetWeight = target_value; | 243 | { |
244 | } | 244 | mTargetWeight = target_value; |
245 | } | 245 | } |
246 | mIsAnimating = TRUE; | 246 | mIsAnimating = TRUE; |
247 | 247 | ||