aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcharacter/llkeyframemotion.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:56 -0500
committerJacek Antonelli2008-08-15 23:44:56 -0500
commitc07901e29ed545bbb02e3bddf148fe1104b94e9f (patch)
treef1ada64ce834acd7d92a425efb96c4b86bcf16b1 /linden/indra/llcharacter/llkeyframemotion.cpp
parentSecond Life viewer sources 1.15.0.2 (diff)
downloadmeta-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 '')
-rw-r--r--linden/indra/llcharacter/llkeyframemotion.cpp89
1 files changed, 43 insertions, 46 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