Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
129301c8
Commit
129301c8
authored
2 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Fix multiple leaks in the case of failure to deserialize animations
parent
fabfbb93
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llcharacter/llkeyframemotion.cpp
+97
-88
97 additions, 88 deletions
indra/llcharacter/llkeyframemotion.cpp
with
97 additions
and
88 deletions
indra/llcharacter/llkeyframemotion.cpp
+
97
−
88
View file @
129301c8
...
@@ -1229,7 +1229,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
...
@@ -1229,7 +1229,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
BOOL
LLKeyframeMotion
::
deserialize
(
LLDataPacker
&
dp
,
const
LLUUID
&
asset_id
,
bool
allow_invalid_joints
)
BOOL
LLKeyframeMotion
::
deserialize
(
LLDataPacker
&
dp
,
const
LLUUID
&
asset_id
,
bool
allow_invalid_joints
)
{
{
BOOL
old_version
=
FALSE
;
BOOL
old_version
=
FALSE
;
mJointMotionList
=
new
LLKeyframeMotion
::
JointMotionList
;
std
::
unique_ptr
<
LLKeyframeMotion
::
JointMotionList
>
joint_motion_list
(
new
LLKeyframeMotion
::
JointMotionList
)
;
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// get base priority
// get base priority
...
@@ -1272,16 +1272,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1272,16 +1272,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
return
FALSE
;
return
FALSE
;
}
}
mJ
oint
M
otion
L
ist
->
mBasePriority
=
(
LLJoint
::
JointPriority
)
temp_priority
;
j
oint
_m
otion
_l
ist
->
mBasePriority
=
(
LLJoint
::
JointPriority
)
temp_priority
;
if
(
mJ
oint
M
otion
L
ist
->
mBasePriority
>=
LLJoint
::
ADDITIVE_PRIORITY
)
if
(
j
oint
_m
otion
_l
ist
->
mBasePriority
>=
LLJoint
::
ADDITIVE_PRIORITY
)
{
{
mJ
oint
M
otion
L
ist
->
mBasePriority
=
(
LLJoint
::
JointPriority
)((
S32
)
LLJoint
::
ADDITIVE_PRIORITY
-
1
);
j
oint
_m
otion
_l
ist
->
mBasePriority
=
(
LLJoint
::
JointPriority
)((
S32
)
LLJoint
::
ADDITIVE_PRIORITY
-
1
);
mJ
oint
M
otion
L
ist
->
mMaxPriority
=
mJ
oint
M
otion
L
ist
->
mBasePriority
;
j
oint
_m
otion
_l
ist
->
mMaxPriority
=
j
oint
_m
otion
_l
ist
->
mBasePriority
;
}
}
else
if
(
mJ
oint
M
otion
L
ist
->
mBasePriority
<
LLJoint
::
USE_MOTION_PRIORITY
)
else
if
(
j
oint
_m
otion
_l
ist
->
mBasePriority
<
LLJoint
::
USE_MOTION_PRIORITY
)
{
{
LL_WARNS
()
<<
"bad animation base_priority "
<<
mJ
oint
M
otion
L
ist
->
mBasePriority
LL_WARNS
()
<<
"bad animation base_priority "
<<
j
oint
_m
otion
_l
ist
->
mBasePriority
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1289,15 +1289,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1289,15 +1289,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// get duration
// get duration
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
if
(
!
dp
.
unpackF32
(
mJ
oint
M
otion
L
ist
->
mDuration
,
"duration"
))
if
(
!
dp
.
unpackF32
(
j
oint
_m
otion
_l
ist
->
mDuration
,
"duration"
))
{
{
LL_WARNS
()
<<
"can't read duration"
LL_WARNS
()
<<
"can't read duration"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
return
FALSE
;
return
FALSE
;
}
}
if
(
mJ
oint
M
otion
L
ist
->
mDuration
>
MAX_ANIM_DURATION
||
if
(
j
oint
_m
otion
_l
ist
->
mDuration
>
MAX_ANIM_DURATION
||
!
llfinite
(
mJ
oint
M
otion
L
ist
->
mDuration
))
!
llfinite
(
j
oint
_m
otion
_l
ist
->
mDuration
))
{
{
LL_WARNS
()
<<
"invalid animation duration"
LL_WARNS
()
<<
"invalid animation duration"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
...
@@ -1307,14 +1307,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1307,14 +1307,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// get emote (optional)
// get emote (optional)
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
if
(
!
dp
.
unpackString
(
mJ
oint
M
otion
L
ist
->
mEmoteName
,
"emote_name"
))
if
(
!
dp
.
unpackString
(
j
oint
_m
otion
_l
ist
->
mEmoteName
,
"emote_name"
))
{
{
LL_WARNS
()
<<
"can't read optional_emote_animation"
LL_WARNS
()
<<
"can't read optional_emote_animation"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
return
FALSE
;
return
FALSE
;
}
}
if
(
mJ
oint
M
otion
L
ist
->
mEmoteName
==
mID
.
asString
())
if
(
j
oint
_m
otion
_l
ist
->
mEmoteName
==
mID
.
asString
())
{
{
LL_WARNS
()
<<
"Malformed animation mEmoteName==mID"
LL_WARNS
()
<<
"Malformed animation mEmoteName==mID"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
...
@@ -1324,23 +1324,23 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1324,23 +1324,23 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// get loop
// get loop
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
if
(
!
dp
.
unpackF32
(
mJ
oint
M
otion
L
ist
->
mLoopInPoint
,
"loop_in_point"
)
||
if
(
!
dp
.
unpackF32
(
j
oint
_m
otion
_l
ist
->
mLoopInPoint
,
"loop_in_point"
)
||
!
llfinite
(
mJ
oint
M
otion
L
ist
->
mLoopInPoint
))
!
llfinite
(
j
oint
_m
otion
_l
ist
->
mLoopInPoint
))
{
{
LL_WARNS
()
<<
"can't read loop point"
LL_WARNS
()
<<
"can't read loop point"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
return
FALSE
;
return
FALSE
;
}
}
if
(
!
dp
.
unpackF32
(
mJ
oint
M
otion
L
ist
->
mLoopOutPoint
,
"loop_out_point"
)
||
if
(
!
dp
.
unpackF32
(
j
oint
_m
otion
_l
ist
->
mLoopOutPoint
,
"loop_out_point"
)
||
!
llfinite
(
mJ
oint
M
otion
L
ist
->
mLoopOutPoint
))
!
llfinite
(
j
oint
_m
otion
_l
ist
->
mLoopOutPoint
))
{
{
LL_WARNS
()
<<
"can't read loop point"
LL_WARNS
()
<<
"can't read loop point"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
return
FALSE
;
return
FALSE
;
}
}
if
(
!
dp
.
unpackS32
(
mJ
oint
M
otion
L
ist
->
mLoop
,
"loop"
))
if
(
!
dp
.
unpackS32
(
j
oint
_m
otion
_l
ist
->
mLoop
,
"loop"
))
{
{
LL_WARNS
()
<<
"can't read loop"
LL_WARNS
()
<<
"can't read loop"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
...
@@ -1353,22 +1353,22 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1353,22 +1353,22 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
if
(
female_land_anim
==
asset_id
||
formal_female_land_anim
==
asset_id
)
if
(
female_land_anim
==
asset_id
||
formal_female_land_anim
==
asset_id
)
{
{
LL_WARNS
()
<<
"Animation("
<<
asset_id
<<
") won't be looped."
<<
LL_ENDL
;
LL_WARNS
()
<<
"Animation("
<<
asset_id
<<
") won't be looped."
<<
LL_ENDL
;
mJ
oint
M
otion
L
ist
->
mLoop
=
FALSE
;
j
oint
_m
otion
_l
ist
->
mLoop
=
FALSE
;
}
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// get easeIn and easeOut
// get easeIn and easeOut
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
if
(
!
dp
.
unpackF32
(
mJ
oint
M
otion
L
ist
->
mEaseInDuration
,
"ease_in_duration"
)
||
if
(
!
dp
.
unpackF32
(
j
oint
_m
otion
_l
ist
->
mEaseInDuration
,
"ease_in_duration"
)
||
!
llfinite
(
mJ
oint
M
otion
L
ist
->
mEaseInDuration
))
!
llfinite
(
j
oint
_m
otion
_l
ist
->
mEaseInDuration
))
{
{
LL_WARNS
()
<<
"can't read easeIn"
LL_WARNS
()
<<
"can't read easeIn"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
return
FALSE
;
return
FALSE
;
}
}
if
(
!
dp
.
unpackF32
(
mJ
oint
M
otion
L
ist
->
mEaseOutDuration
,
"ease_out_duration"
)
||
if
(
!
dp
.
unpackF32
(
j
oint
_m
otion
_l
ist
->
mEaseOutDuration
,
"ease_out_duration"
)
||
!
llfinite
(
mJ
oint
M
otion
L
ist
->
mEaseOutDuration
))
!
llfinite
(
j
oint
_m
otion
_l
ist
->
mEaseOutDuration
))
{
{
LL_WARNS
()
<<
"can't read easeOut"
LL_WARNS
()
<<
"can't read easeOut"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
...
@@ -1393,7 +1393,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1393,7 +1393,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
return
FALSE
;
return
FALSE
;
}
}
mJ
oint
M
otion
L
ist
->
mHandPose
=
(
LLHandMotion
::
eHandPose
)
word
;
j
oint
_m
otion
_l
ist
->
mHandPose
=
(
LLHandMotion
::
eHandPose
)
word
;
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// get number of joint motions
// get number of joint motions
...
@@ -1419,8 +1419,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1419,8 +1419,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
return
FALSE
;
return
FALSE
;
}
}
mJ
oint
M
otion
L
ist
->
mJointMotionArray
.
clear
();
j
oint
_m
otion
_l
ist
->
mJointMotionArray
.
clear
();
mJ
oint
M
otion
L
ist
->
mJointMotionArray
.
reserve
(
num_motions
);
j
oint
_m
otion
_l
ist
->
mJointMotionArray
.
reserve
(
num_motions
);
mJointStates
.
clear
();
mJointStates
.
clear
();
mJointStates
.
reserve
(
num_motions
);
mJointStates
.
reserve
(
num_motions
);
...
@@ -1431,7 +1431,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1431,7 +1431,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
for
(
U32
i
=
0
;
i
<
num_motions
;
++
i
)
for
(
U32
i
=
0
;
i
<
num_motions
;
++
i
)
{
{
JointMotion
*
joint_motion
=
new
JointMotion
;
JointMotion
*
joint_motion
=
new
JointMotion
;
mJ
oint
M
otion
L
ist
->
mJointMotionArray
.
push_back
(
joint_motion
);
j
oint
_m
otion
_l
ist
->
mJointMotionArray
.
push_back
(
joint_motion
);
std
::
string
joint_name
;
std
::
string
joint_name
;
if
(
!
dp
.
unpackString
(
joint_name
,
"joint_name"
))
if
(
!
dp
.
unpackString
(
joint_name
,
"joint_name"
))
...
@@ -1503,9 +1503,9 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1503,9 +1503,9 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
joint_motion
->
mPriority
=
(
LLJoint
::
JointPriority
)
joint_priority
;
joint_motion
->
mPriority
=
(
LLJoint
::
JointPriority
)
joint_priority
;
if
(
joint_priority
!=
LLJoint
::
USE_MOTION_PRIORITY
&&
if
(
joint_priority
!=
LLJoint
::
USE_MOTION_PRIORITY
&&
joint_priority
>
mJ
oint
M
otion
L
ist
->
mMaxPriority
)
joint_priority
>
j
oint
_m
otion
_l
ist
->
mMaxPriority
)
{
{
mJ
oint
M
otion
L
ist
->
mMaxPriority
=
(
LLJoint
::
JointPriority
)
joint_priority
;
j
oint
_m
otion
_l
ist
->
mMaxPriority
=
(
LLJoint
::
JointPriority
)
joint_priority
;
}
}
joint_state
->
setPriority
((
LLJoint
::
JointPriority
)
joint_priority
);
joint_state
->
setPriority
((
LLJoint
::
JointPriority
)
joint_priority
);
...
@@ -1556,9 +1556,9 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1556,9 +1556,9 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
return
FALSE
;
return
FALSE
;
}
}
time
=
U16_to_F32
(
time_short
,
0.
f
,
mJ
oint
M
otion
L
ist
->
mDuration
);
time
=
U16_to_F32
(
time_short
,
0.
f
,
j
oint
_m
otion
_l
ist
->
mDuration
);
if
(
time
<
0
||
time
>
mJ
oint
M
otion
L
ist
->
mDuration
)
if
(
time
<
0
||
time
>
j
oint
_m
otion
_l
ist
->
mDuration
)
{
{
LL_WARNS
()
<<
"invalid frame time"
LL_WARNS
()
<<
"invalid frame time"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
...
@@ -1571,38 +1571,57 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1571,38 +1571,57 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
LLVector3
rot_angles
;
LLVector3
rot_angles
;
U16
x
,
y
,
z
;
U16
x
,
y
,
z
;
BOOL
success
=
TRUE
;
if
(
old_version
)
if
(
old_version
)
{
{
success
=
dp
.
unpackVector3
(
rot_angles
,
"rot_angles"
)
&&
rot_angles
.
isFinite
();
if
(
!
dp
.
unpackVector3
(
rot_angles
,
"rot_angles"
))
{
LL_WARNS
()
<<
"can't read rot_angles in rotation key ("
<<
k
<<
")"
<<
LL_ENDL
;
return
FALSE
;
}
if
(
!
rot_angles
.
isFinite
())
{
LL_WARNS
()
<<
"non-finite angle in rotation key ("
<<
k
<<
")"
<<
LL_ENDL
;
return
FALSE
;
}
LLQuaternion
::
Order
ro
=
StringToOrder
(
"ZYX"
);
LLQuaternion
::
Order
ro
=
StringToOrder
(
"ZYX"
);
rot_key
.
mRotation
=
mayaQ
(
rot_angles
.
mV
[
VX
],
rot_angles
.
mV
[
VY
],
rot_angles
.
mV
[
VZ
],
ro
);
rot_key
.
mRotation
=
mayaQ
(
rot_angles
.
mV
[
VX
],
rot_angles
.
mV
[
VY
],
rot_angles
.
mV
[
VZ
],
ro
);
}
}
else
else
{
{
success
&=
dp
.
unpackU16
(
x
,
"rot_angle_x"
);
if
(
!
dp
.
unpackU16
(
x
,
"rot_angle_x"
))
success
&=
dp
.
unpackU16
(
y
,
"rot_angle_y"
);
{
success
&=
dp
.
unpackU16
(
z
,
"rot_angle_z"
);
LL_WARNS
()
<<
"can't read rot_angle_x in rotation key ("
<<
k
<<
")"
<<
LL_ENDL
;
return
FALSE
;
}
if
(
!
dp
.
unpackU16
(
y
,
"rot_angle_y"
))
{
LL_WARNS
()
<<
"can't read rot_angle_y in rotation key ("
<<
k
<<
")"
<<
LL_ENDL
;
return
FALSE
;
}
if
(
!
dp
.
unpackU16
(
z
,
"rot_angle_z"
))
{
LL_WARNS
()
<<
"can't read rot_angle_z in rotation key ("
<<
k
<<
")"
<<
LL_ENDL
;
return
FALSE
;
}
LLVector3
rot_vec
;
LLVector3
rot_vec
;
rot_vec
.
mV
[
VX
]
=
U16_to_F32
(
x
,
-
1.
f
,
1.
f
);
rot_vec
.
mV
[
VX
]
=
U16_to_F32
(
x
,
-
1.
f
,
1.
f
);
rot_vec
.
mV
[
VY
]
=
U16_to_F32
(
y
,
-
1.
f
,
1.
f
);
rot_vec
.
mV
[
VY
]
=
U16_to_F32
(
y
,
-
1.
f
,
1.
f
);
rot_vec
.
mV
[
VZ
]
=
U16_to_F32
(
z
,
-
1.
f
,
1.
f
);
rot_vec
.
mV
[
VZ
]
=
U16_to_F32
(
z
,
-
1.
f
,
1.
f
);
if
(
!
rot_vec
.
isFinite
())
{
LL_WARNS
()
<<
"non-finite angle in rotation key ("
<<
k
<<
")"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
return
FALSE
;
}
rot_key
.
mRotation
.
unpackFromVector3
(
rot_vec
);
rot_key
.
mRotation
.
unpackFromVector3
(
rot_vec
);
}
}
if
(
!
(
rot_key
.
mRotation
.
isFinite
())
)
if
(
!
rot_key
.
mRotation
.
isFinite
())
{
LL_WARNS
()
<<
"non-finite angle in rotation key"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
success
=
FALSE
;
}
if
(
!
success
)
{
{
LL_WARNS
()
<<
"
can't read
rotation key ("
<<
k
<<
")"
LL_WARNS
()
<<
"
non-finite angle in
rotation key ("
<<
k
<<
")"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1655,14 +1674,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1655,14 +1674,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
return
FALSE
;
return
FALSE
;
}
}
pos_key
.
mTime
=
U16_to_F32
(
time_short
,
0.
f
,
mJ
oint
M
otion
L
ist
->
mDuration
);
pos_key
.
mTime
=
U16_to_F32
(
time_short
,
0.
f
,
j
oint
_m
otion
_l
ist
->
mDuration
);
}
}
BOOL
success
=
TRUE
;
if
(
old_version
)
if
(
old_version
)
{
{
success
=
dp
.
unpackVector3
(
pos_key
.
mPosition
,
"pos"
);
if
(
!
dp
.
unpackVector3
(
pos_key
.
mPosition
,
"pos"
))
{
LL_WARNS
()
<<
"can't read pos in position key ("
<<
k
<<
")"
<<
LL_ENDL
;
return
FALSE
;
}
//MAINT-6162
//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
[
VX
]
=
llclamp
(
pos_key
.
mPosition
.
mV
[
VX
],
-
LL_MAX_PELVIS_OFFSET
,
LL_MAX_PELVIS_OFFSET
);
...
@@ -1674,25 +1695,30 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1674,25 +1695,30 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
U16
x
,
y
,
z
;
U16
x
,
y
,
z
;
success
&=
dp
.
unpackU16
(
x
,
"pos_x"
);
if
(
!
dp
.
unpackU16
(
x
,
"pos_x"
))
success
&=
dp
.
unpackU16
(
y
,
"pos_y"
);
{
success
&=
dp
.
unpackU16
(
z
,
"pos_z"
);
LL_WARNS
()
<<
"can't read pos_x in position key ("
<<
k
<<
")"
<<
LL_ENDL
;
return
FALSE
;
}
if
(
!
dp
.
unpackU16
(
y
,
"pos_y"
))
{
LL_WARNS
()
<<
"can't read pos_y in position key ("
<<
k
<<
")"
<<
LL_ENDL
;
return
FALSE
;
}
if
(
!
dp
.
unpackU16
(
z
,
"pos_z"
))
{
LL_WARNS
()
<<
"can't read pos_z in position key ("
<<
k
<<
")"
<<
LL_ENDL
;
return
FALSE
;
}
pos_key
.
mPosition
.
mV
[
VX
]
=
U16_to_F32
(
x
,
-
LL_MAX_PELVIS_OFFSET
,
LL_MAX_PELVIS_OFFSET
);
pos_key
.
mPosition
.
mV
[
VX
]
=
U16_to_F32
(
x
,
-
LL_MAX_PELVIS_OFFSET
,
LL_MAX_PELVIS_OFFSET
);
pos_key
.
mPosition
.
mV
[
VY
]
=
U16_to_F32
(
y
,
-
LL_MAX_PELVIS_OFFSET
,
LL_MAX_PELVIS_OFFSET
);
pos_key
.
mPosition
.
mV
[
VY
]
=
U16_to_F32
(
y
,
-
LL_MAX_PELVIS_OFFSET
,
LL_MAX_PELVIS_OFFSET
);
pos_key
.
mPosition
.
mV
[
VZ
]
=
U16_to_F32
(
z
,
-
LL_MAX_PELVIS_OFFSET
,
LL_MAX_PELVIS_OFFSET
);
pos_key
.
mPosition
.
mV
[
VZ
]
=
U16_to_F32
(
z
,
-
LL_MAX_PELVIS_OFFSET
,
LL_MAX_PELVIS_OFFSET
);
}
}
if
(
!
(
pos_key
.
mPosition
.
isFinite
())
)
if
(
!
pos_key
.
mPosition
.
isFinite
())
{
{
LL_WARNS
()
<<
"non-finite position in key"
LL_WARNS
()
<<
"non-finite position in key"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
success
=
FALSE
;
}
if
(
!
success
)
{
LL_WARNS
()
<<
"can't read position key ("
<<
k
<<
")"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1701,7 +1727,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1701,7 +1727,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
if
(
is_pelvis
)
if
(
is_pelvis
)
{
{
mJ
oint
M
otion
L
ist
->
mPelvisBBox
.
addPoint
(
pos_key
.
mPosition
);
j
oint
_m
otion
_l
ist
->
mPelvisBBox
.
addPoint
(
pos_key
.
mPosition
);
}
}
}
}
...
@@ -1733,23 +1759,21 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1733,23 +1759,21 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
for
(
S32
i
=
0
;
i
<
num_constraints
;
++
i
)
for
(
S32
i
=
0
;
i
<
num_constraints
;
++
i
)
{
{
// read in constraint data
// read in constraint data
JointConstraintSharedData
*
constraintp
=
new
JointConstraintSharedData
;
std
::
unique_ptr
<
JointConstraintSharedData
>
constraintp
(
new
JointConstraintSharedData
)
;
U8
byte
=
0
;
U8
byte
=
0
;
if
(
!
dp
.
unpackU8
(
byte
,
"chain_length"
))
if
(
!
dp
.
unpackU8
(
byte
,
"chain_length"
))
{
{
LL_WARNS
()
<<
"can't read constraint chain length"
LL_WARNS
()
<<
"can't read constraint chain length"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
constraintp
->
mChainLength
=
(
S32
)
byte
;
constraintp
->
mChainLength
=
(
S32
)
byte
;
if
((
U32
)
constraintp
->
mChainLength
>
mJ
oint
M
otion
L
ist
->
getNumJointMotions
())
if
((
U32
)
constraintp
->
mChainLength
>
j
oint
_m
otion
_l
ist
->
getNumJointMotions
())
{
{
LL_WARNS
()
<<
"invalid constraint chain length"
LL_WARNS
()
<<
"invalid constraint chain length"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1757,7 +1781,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1757,7 +1781,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"can't read constraint type"
LL_WARNS
()
<<
"can't read constraint type"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1765,7 +1788,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1765,7 +1788,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"invalid constraint type"
LL_WARNS
()
<<
"invalid constraint type"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
constraintp
->
mConstraintType
=
(
EConstraintType
)
byte
;
constraintp
->
mConstraintType
=
(
EConstraintType
)
byte
;
...
@@ -1776,7 +1798,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1776,7 +1798,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"can't read source volume name"
LL_WARNS
()
<<
"can't read source volume name"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1787,7 +1808,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1787,7 +1808,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"not a valid source constraint volume "
<<
str
LL_WARNS
()
<<
"not a valid source constraint volume "
<<
str
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1795,7 +1815,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1795,7 +1815,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"can't read constraint source offset"
LL_WARNS
()
<<
"can't read constraint source offset"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1803,7 +1822,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1803,7 +1822,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"non-finite constraint source offset"
LL_WARNS
()
<<
"non-finite constraint source offset"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1811,7 +1829,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1811,7 +1829,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"can't read target volume name"
LL_WARNS
()
<<
"can't read target volume name"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1830,7 +1847,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1830,7 +1847,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"not a valid target constraint volume "
<<
str
LL_WARNS
()
<<
"not a valid target constraint volume "
<<
str
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
}
}
...
@@ -1839,7 +1855,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1839,7 +1855,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"can't read constraint target offset"
LL_WARNS
()
<<
"can't read constraint target offset"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1847,7 +1862,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1847,7 +1862,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"non-finite constraint target offset"
LL_WARNS
()
<<
"non-finite constraint target offset"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1855,7 +1869,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1855,7 +1869,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"can't read constraint target direction"
LL_WARNS
()
<<
"can't read constraint target direction"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1863,7 +1876,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1863,7 +1876,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"non-finite constraint target direction"
LL_WARNS
()
<<
"non-finite constraint target direction"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1877,7 +1889,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1877,7 +1889,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"can't read constraint ease in start time"
LL_WARNS
()
<<
"can't read constraint ease in start time"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1885,7 +1896,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1885,7 +1896,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"can't read constraint ease in stop time"
LL_WARNS
()
<<
"can't read constraint ease in stop time"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1893,7 +1903,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1893,7 +1903,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"can't read constraint ease out start time"
LL_WARNS
()
<<
"can't read constraint ease out start time"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1901,33 +1910,31 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1901,33 +1910,31 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"can't read constraint ease out stop time"
LL_WARNS
()
<<
"can't read constraint ease out stop time"
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
mJointMotionList
->
mConstraints
.
push_front
(
constraintp
);
constraintp
->
mJointStateIndices
=
new
S32
[
constraintp
->
mChainLength
+
1
];
// note: mChainLength is size-limited - comes from a byte
LLJoint
*
joint
=
mCharacter
->
findCollisionVolume
(
constraintp
->
mSourceConstraintVolume
);
LLJoint
*
joint
=
mCharacter
->
findCollisionVolume
(
constraintp
->
mSourceConstraintVolume
);
// get joint to which this collision volume is attached
// get joint to which this collision volume is attached
if
(
!
joint
)
if
(
!
joint
)
{
{
return
FALSE
;
return
FALSE
;
}
}
constraintp
->
mJointStateIndices
=
new
S32
[
constraintp
->
mChainLength
+
1
];
// note: mChainLength is size-limited - comes from a byte
for
(
S32
i
=
0
;
i
<
constraintp
->
mChainLength
+
1
;
i
++
)
for
(
S32
i
=
0
;
i
<
constraintp
->
mChainLength
+
1
;
i
++
)
{
{
LLJoint
*
parent
=
joint
->
getParent
();
LLJoint
*
parent
=
joint
->
getParent
();
if
(
!
parent
)
if
(
!
parent
)
{
{
LL_WARNS
()
<<
"Joint with no parent: "
<<
joint
->
getName
()
LL_WARNS
()
<<
"Joint with no parent: "
<<
joint
->
getName
()
<<
" Emote: "
<<
mJ
oint
M
otion
L
ist
->
mEmoteName
<<
" Emote: "
<<
j
oint
_m
otion
_l
ist
->
mEmoteName
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
return
FALSE
;
return
FALSE
;
}
}
joint
=
parent
;
joint
=
parent
;
constraintp
->
mJointStateIndices
[
i
]
=
-
1
;
constraintp
->
mJointStateIndices
[
i
]
=
-
1
;
for
(
U32
j
=
0
;
j
<
mJ
oint
M
otion
L
ist
->
getNumJointMotions
();
j
++
)
for
(
U32
j
=
0
;
j
<
j
oint
_m
otion
_l
ist
->
getNumJointMotions
();
j
++
)
{
{
LLJoint
*
constraint_joint
=
getJoint
(
j
);
LLJoint
*
constraint_joint
=
getJoint
(
j
);
...
@@ -1948,14 +1955,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
...
@@ -1948,14 +1955,16 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo
{
{
LL_WARNS
()
<<
"No joint index for constraint "
<<
i
LL_WARNS
()
<<
"No joint index for constraint "
<<
i
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
<<
" for animation "
<<
asset_id
<<
LL_ENDL
;
delete
constraintp
;
return
FALSE
;
return
FALSE
;
}
}
}
}
joint_motion_list
->
mConstraints
.
push_front
(
constraintp
.
release
());
}
}
}
}
// *FIX: support cleanup of old keyframe data
// *FIX: support cleanup of old keyframe data
mJointMotionList
=
joint_motion_list
.
release
();
// release from unique_ptr to member;
LLKeyframeDataCache
::
addKeyframeData
(
getID
(),
mJointMotionList
);
LLKeyframeDataCache
::
addKeyframeData
(
getID
(),
mJointMotionList
);
mAssetStatus
=
ASSET_LOADED
;
mAssetStatus
=
ASSET_LOADED
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment