最近在unity3d中使用魔兽世界的导出资源时,发现有些动画会有一些莫名其妙的残留帧,导致一个动作导进unity3d后的长度变成几分钟,并且很大一部分是毫无动作的,所以写了这个脚本来清除多余的帧。

View Code
Fn CleanOutRangeKeys inputObject =
(
startTime
= AnimationRange.Start
endTime
= AnimationRange.End
for i = 1 to inputObject.numSubs do
(
tempSubAnim
= GetSubAnim inputObject i
tempController
= tempSubAnim.Controller

if tempController != undefined do
(
tempKeyList
= tempController.Keys

outEndKeysIndex
= for i = 1 to tempKeyList.Count where tempKeyList[i].Time > endTime collect i
if outEndKeysIndex.Count > 0 do for i = 1 to outEndKeysIndex.Count do DeleteKey tempKeyList tempKeyList.count

outStartKeysIndex
= for i = 1 to tempKeyList.Count where tempKeyList[i].Time < startTime collect i
for i = 1 to outStartKeysIndex.Count do DeleteKey tempKeyList 1
)
if tempSubAnim.numSubs > 0 do CleanOutRangeKeys tempSubAnim
)
)
for tempObject in Objects as Array do CleanOutRangeKeys tempObject

相关文章:

  • 2021-09-08
  • 2021-09-27
  • 2021-11-28
  • 2021-11-12
  • 2021-12-29
  • 2022-12-23
  • 2022-01-20
  • 2022-12-23
猜你喜欢
  • 2022-01-08
  • 2022-12-23
  • 2021-07-17
  • 2021-12-27
  • 2022-01-07
  • 2022-12-23
  • 2021-09-29
相关资源
相似解决方案