Bento hell and back, and back to hell, and back.
This commit is contained in:
@@ -1049,7 +1049,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
|
||||
{
|
||||
case CONSTRAINT_TARGET_TYPE_GROUND:
|
||||
target_pos = mCharacter->getPosAgentFromGlobal(constraint->mGroundPos);
|
||||
target_pos += mCharacter->getHoverOffset();
|
||||
//target_pos += mCharacter->getHoverOffset();
|
||||
// LL_INFOS() << "Target Pos " << constraint->mGroundPos << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL;
|
||||
break;
|
||||
case CONSTRAINT_TARGET_TYPE_BODY:
|
||||
@@ -1468,7 +1468,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
|
||||
LL_WARNS() << "no joints in animation" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
else if (num_motions > LL_CHARACTER_MAX_JOINTS)
|
||||
else if (num_motions > LL_CHARACTER_MAX_ANIMATED_JOINTS)
|
||||
{
|
||||
LL_WARNS() << "too many joints in animation" << LL_ENDL;
|
||||
return FALSE;
|
||||
@@ -1514,7 +1514,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
|
||||
LLJoint *joint = mCharacter->getJoint( joint_name );
|
||||
if (joint)
|
||||
{
|
||||
S32 joint_num = joint->getJointNum();
|
||||
// LL_INFOS() << " joint: " << joint_name << LL_ENDL;
|
||||
if ((joint_num >= (S32)LL_CHARACTER_MAX_ANIMATED_JOINTS) || (joint_num < 0))
|
||||
{
|
||||
LL_WARNS() << "Joint will be omitted from animation: joint_num " << joint_num << " is outside of legal range [0-"
|
||||
<< LL_CHARACTER_MAX_ANIMATED_JOINTS << ") for joint " << joint->getName() << LL_ENDL;
|
||||
joint = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1710,6 +1717,12 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
|
||||
if (old_version)
|
||||
{
|
||||
success = dp.unpackVector3(pos_key.mPosition, "pos");
|
||||
|
||||
//MAINT-6162
|
||||
pos_key.mPosition.mV[VX] = llclamp( pos_key.mPosition.mV[VX], -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
|
||||
pos_key.mPosition.mV[VY] = llclamp( pos_key.mPosition.mV[VY], -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
|
||||
pos_key.mPosition.mV[VZ] = llclamp( pos_key.mPosition.mV[VZ], -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1974,6 +1987,8 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
|
||||
{
|
||||
BOOL success = TRUE;
|
||||
|
||||
LL_DEBUGS("BVH") << "serializing" << LL_ENDL;
|
||||
|
||||
success &= dp.packU16(KEYFRAME_MOTION_VERSION, "version");
|
||||
success &= dp.packU16(KEYFRAME_MOTION_SUBVERSION, "sub_version");
|
||||
success &= dp.packS32(mJointMotionList->mBasePriority, "base_priority");
|
||||
@@ -1987,6 +2002,19 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
|
||||
success &= dp.packU32(mJointMotionList->mHandPose, "hand_pose");
|
||||
success &= dp.packU32(mJointMotionList->getNumJointMotions(), "num_joints");
|
||||
|
||||
LL_DEBUGS("BVH") << "version " << KEYFRAME_MOTION_VERSION << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << "sub_version " << KEYFRAME_MOTION_SUBVERSION << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << "base_priority " << mJointMotionList->mBasePriority << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << "duration " << mJointMotionList->mDuration << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << "emote_name " << mJointMotionList->mEmoteName << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << "loop_in_point " << mJointMotionList->mLoopInPoint << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << "loop_out_point " << mJointMotionList->mLoopOutPoint << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << "loop " << mJointMotionList->mLoop << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << "ease_in_duration " << mJointMotionList->mEaseInDuration << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << "ease_out_duration " << mJointMotionList->mEaseOutDuration << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << "hand_pose " << mJointMotionList->mHandPose << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << "num_joints " << mJointMotionList->getNumJointMotions() << LL_ENDL;
|
||||
|
||||
for (U32 i = 0; i < mJointMotionList->getNumJointMotions(); i++)
|
||||
{
|
||||
JointMotion* joint_motionp = mJointMotionList->getJointMotion(i);
|
||||
@@ -1994,6 +2022,7 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
|
||||
success &= dp.packS32(joint_motionp->mPriority, "joint_priority");
|
||||
success &= dp.packS32(joint_motionp->mRotationCurve.mNumKeys, "num_rot_keys");
|
||||
|
||||
LL_DEBUGS("BVH") << "Joint " << joint_motionp->mJointName << LL_ENDL;
|
||||
for (RotationCurve::key_map_t::iterator iter = joint_motionp->mRotationCurve.mKeys.begin();
|
||||
iter != joint_motionp->mRotationCurve.mKeys.end(); ++iter)
|
||||
{
|
||||
@@ -2011,6 +2040,8 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
|
||||
success &= dp.packU16(x, "rot_angle_x");
|
||||
success &= dp.packU16(y, "rot_angle_y");
|
||||
success &= dp.packU16(z, "rot_angle_z");
|
||||
|
||||
LL_DEBUGS("BVH") << " rot: t " << rot_key.mTime << " angles " << rot_angles.mV[VX] <<","<< rot_angles.mV[VY] <<","<< rot_angles.mV[VZ] << LL_ENDL;
|
||||
}
|
||||
|
||||
success &= dp.packS32(joint_motionp->mPositionCurve.mNumKeys, "num_pos_keys");
|
||||
@@ -2029,37 +2060,54 @@ BOOL LLKeyframeMotion::serialize(LLDataPacker& dp) const
|
||||
success &= dp.packU16(x, "pos_x");
|
||||
success &= dp.packU16(y, "pos_y");
|
||||
success &= dp.packU16(z, "pos_z");
|
||||
|
||||
LL_DEBUGS("BVH") << " pos: t " << pos_key.mTime << " pos " << pos_key.mPosition.mV[VX] <<","<< pos_key.mPosition.mV[VY] <<","<< pos_key.mPosition.mV[VZ] << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
success &= dp.packS32(mJointMotionList->mConstraints.size(), "num_constraints");
|
||||
LL_DEBUGS("BVH") << "num_constraints " << mJointMotionList->mConstraints.size() << LL_ENDL;
|
||||
for (JointMotionList::constraint_list_t::const_iterator iter = mJointMotionList->mConstraints.begin();
|
||||
iter != mJointMotionList->mConstraints.end(); ++iter)
|
||||
{
|
||||
JointConstraintSharedData* shared_constraintp = *iter;
|
||||
success &= dp.packU8(shared_constraintp->mChainLength, "chain_length");
|
||||
success &= dp.packU8(shared_constraintp->mConstraintType, "constraint_type");
|
||||
char volume_name[16]; /* Flawfinder: ignore */
|
||||
snprintf(volume_name, sizeof(volume_name), "%s", /* Flawfinder: ignore */
|
||||
char source_volume[16]; /* Flawfinder: ignore */
|
||||
snprintf(source_volume, sizeof(source_volume), "%s", /* Flawfinder: ignore */
|
||||
mCharacter->findCollisionVolume(shared_constraintp->mSourceConstraintVolume)->getName().c_str());
|
||||
success &= dp.packBinaryDataFixed((U8*)volume_name, 16, "source_volume");
|
||||
|
||||
success &= dp.packBinaryDataFixed((U8*)source_volume, 16, "source_volume");
|
||||
success &= dp.packVector3(shared_constraintp->mSourceConstraintOffset, "source_offset");
|
||||
char target_volume[16]; /* Flawfinder: ignore */
|
||||
if (shared_constraintp->mConstraintTargetType == CONSTRAINT_TARGET_TYPE_GROUND)
|
||||
{
|
||||
snprintf(volume_name,sizeof(volume_name), "%s", "GROUND"); /* Flawfinder: ignore */
|
||||
snprintf(target_volume,sizeof(target_volume), "%s", "GROUND"); /* Flawfinder: ignore */
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(volume_name, sizeof(volume_name),"%s", /* Flawfinder: ignore */
|
||||
snprintf(target_volume, sizeof(target_volume),"%s", /* Flawfinder: ignore */
|
||||
mCharacter->findCollisionVolume(shared_constraintp->mTargetConstraintVolume)->getName().c_str());
|
||||
}
|
||||
success &= dp.packBinaryDataFixed((U8*)volume_name, 16, "target_volume");
|
||||
success &= dp.packBinaryDataFixed((U8*)target_volume, 16, "target_volume");
|
||||
success &= dp.packVector3(shared_constraintp->mTargetConstraintOffset, "target_offset");
|
||||
success &= dp.packVector3(shared_constraintp->mTargetConstraintDir, "target_dir");
|
||||
success &= dp.packF32(shared_constraintp->mEaseInStartTime, "ease_in_start");
|
||||
success &= dp.packF32(shared_constraintp->mEaseInStopTime, "ease_in_stop");
|
||||
success &= dp.packF32(shared_constraintp->mEaseOutStartTime, "ease_out_start");
|
||||
success &= dp.packF32(shared_constraintp->mEaseOutStopTime, "ease_out_stop");
|
||||
|
||||
LL_DEBUGS("BVH") << " chain_length " << shared_constraintp->mChainLength << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << " constraint_type " << (S32)shared_constraintp->mConstraintType << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << " source_volume " << source_volume << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << " source_offset " << shared_constraintp->mSourceConstraintOffset << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << " target_volume " << target_volume << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << " target_offset " << shared_constraintp->mTargetConstraintOffset << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << " target_dir " << shared_constraintp->mTargetConstraintDir << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << " ease_in_start " << shared_constraintp->mEaseInStartTime << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << " ease_in_stop " << shared_constraintp->mEaseInStopTime << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << " ease_out_start " << shared_constraintp->mEaseOutStartTime << LL_ENDL;
|
||||
LL_DEBUGS("BVH") << " ease_out_stop " << shared_constraintp->mEaseOutStopTime << LL_ENDL;
|
||||
}
|
||||
|
||||
return success;
|
||||
@@ -2255,7 +2303,7 @@ void LLKeyframeMotion::onLoadComplete(LLVFS *vfs,
|
||||
LLCharacter* character = *char_iter;
|
||||
|
||||
// look for an existing instance of this motion
|
||||
LLKeyframeMotion* motionp = (LLKeyframeMotion*) character->findMotion(asset_uuid);
|
||||
LLKeyframeMotion* motionp = dynamic_cast<LLKeyframeMotion*> (character->findMotion(asset_uuid));
|
||||
if (motionp)
|
||||
{
|
||||
if (0 == status)
|
||||
@@ -2270,8 +2318,8 @@ void LLKeyframeMotion::onLoadComplete(LLVFS *vfs,
|
||||
|
||||
U8* buffer = new U8[size];
|
||||
file.read((U8*)buffer, size); /*Flawfinder: ignore*/
|
||||
|
||||
LL_DEBUGS() << "Loading keyframe data for: " << motionp->getName() << ":" << motionp->getID() << " (" << size << " bytes)" << LL_ENDL;
|
||||
|
||||
LL_DEBUGS("Animation") << "Loading keyframe data for: " << motionp->getName() << ":" << motionp->getID() << " (" << size << " bytes)" << LL_ENDL;
|
||||
|
||||
LLDataPackerBinaryBuffer dp(buffer, size);
|
||||
if (motionp->deserialize(dp))
|
||||
@@ -2315,9 +2363,9 @@ void LLKeyframeDataCache::dumpDiagInfo(int quiet)
|
||||
|
||||
if (quiet < 2)
|
||||
{
|
||||
LL_INFOS() << "-----------------------------------------------------" << LL_ENDL;
|
||||
LL_INFOS() << " Global Motion Table" << LL_ENDL;
|
||||
LL_INFOS() << "-----------------------------------------------------" << LL_ENDL;
|
||||
LL_INFOS() << "-----------------------------------------------------" << LL_ENDL;
|
||||
LL_INFOS() << " Global Motion Table (DEBUG only)" << LL_ENDL;
|
||||
LL_INFOS() << "-----------------------------------------------------" << LL_ENDL;
|
||||
}
|
||||
|
||||
// print each loaded mesh, and it's memory usage
|
||||
@@ -2335,8 +2383,8 @@ void LLKeyframeDataCache::dumpDiagInfo(int quiet)
|
||||
|
||||
if (motion_list_p)
|
||||
{
|
||||
joint_motion_kb = motion_list_p->dumpDiagInfo(quiet);
|
||||
total_size += joint_motion_kb;
|
||||
joint_motion_kb = motion_list_p->dumpDiagInfo(quiet);
|
||||
total_size += joint_motion_kb;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user