vault backup: 2024-10-09 19:11:03
This commit is contained in:
parent
40f712add4
commit
2c3ed32222
@ -629,7 +629,14 @@ else
|
||||
```
|
||||
|
||||
### ExportAnimation
|
||||
***核心逻辑***
|
||||
***核心逻辑***:
|
||||
BtnExport遍历AdditiveAnim,并调用CalculateAddRotation。
|
||||
追要参数为:
|
||||
- XMap
|
||||
- YMap
|
||||
- ZMap
|
||||
- AixMap
|
||||
- boneNum(是否包含pelvis骨骼)
|
||||
```c++
|
||||
on BtnExport pressed do
|
||||
(
|
||||
@ -652,3 +659,105 @@ on BtnExport pressed do
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
CalculateAddRotation:
|
||||
```c++
|
||||
fn CalculateAddRotation index =
|
||||
(
|
||||
//导入AdditiveAnim
|
||||
importFile Anims[index].Address #noPrompt using:Wavefront_Object
|
||||
local bones = FindAllBones()
|
||||
BoneRotationArray = #()
|
||||
|
||||
//遍历骨骼,从第二根骨骼,也就是Pelvis开始。(仅仅针对UE骨骼,Bip得重新考虑)
|
||||
for j=1 to bones.count do
|
||||
(
|
||||
if j>boneNum then
|
||||
(
|
||||
//计算当前骨骼相对父骨骼的相对旋转。
|
||||
local Value_X = ((at time 0 bones[j].rotInParent).x - (at time 0 bones[j].parent.rotInParent).x)
|
||||
local Value_Y = ((at time 0 bones[j].rotInParent).y - (at time 0 bones[j].parent.rotInParent).y)
|
||||
local Value_Z = ((at time 0 bones[j].rotInParent).z - (at time 0 bones[j].parent.rotInParent).z)
|
||||
//针对XYZ抖动情况的不同传入不同的形参并调用BoneRotationArray。
|
||||
if (abs Value_X) > 0.05 then
|
||||
(
|
||||
if (abs Value_Y) > 0.05 then
|
||||
(
|
||||
if (abs Value_Z) > 0.05 then
|
||||
(
|
||||
append BoneRotationArray (SaveValue j bones[j].name Value_X Value_Y Value_Z)
|
||||
)
|
||||
else
|
||||
(
|
||||
append BoneRotationArray (SaveValue j bones[j].name Value_X Value_Y 0)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
if (abs Value_Z) > 0.05 then
|
||||
(
|
||||
append BoneRotationArray (SaveValue j bones[j].name Value_X 0 Value_Z)
|
||||
)
|
||||
else
|
||||
(
|
||||
append BoneRotationArray (SaveValue j bones[j].name Value_X 0 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
if (abs Value_Y) > 0.05 then
|
||||
(
|
||||
if (abs Value_Z) > 0.05 then
|
||||
(
|
||||
append BoneRotationArray (SaveValue j bones[j].name 0 Value_Y Value_Z)
|
||||
)
|
||||
else
|
||||
(
|
||||
append BoneRotationArray (SaveValue j bones[j].name 0 Value_Y 0)
|
||||
)
|
||||
)
|
||||
else
|
||||
(
|
||||
if (abs Value_Z) > 0.05 then
|
||||
(
|
||||
append BoneRotationArray (SaveValue j bones[j].name 0 0 Value_Z)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
--Set Base Animation Rotation
|
||||
//导入BaseAnim
|
||||
if DoesFileExist BaseAnimFileName then
|
||||
(
|
||||
importFile BaseAnimFileName #noPrompt using:Wavefront_Object
|
||||
local BaseAnimBones = FindAllBones()
|
||||
scale BaseAnimBones[1] [(50.0/127.0),(50.0/127.0),(50.0/127.0)]
|
||||
//调用RotationBone()来设置新的旋转数值
|
||||
case AixMap of
|
||||
(
|
||||
1:( RotationBone 1 0 0 BoneRotationArray XMap BaseAnimBones
|
||||
RotationBone 0 1 0 BoneRotationArray YMap BaseAnimBones
|
||||
RotationBone 0 0 1 BoneRotationArray ZMap BaseAnimBones)
|
||||
2:( RotationBone 1 0 0 BoneRotationArray XMap BaseAnimBones
|
||||
RotationBone 0 0 1 BoneRotationArray ZMap BaseAnimBones
|
||||
RotationBone 0 1 0 BoneRotationArray YMap BaseAnimBones)
|
||||
3:( RotationBone 0 1 0 BoneRotationArray YMap BaseAnimBones
|
||||
RotationBone 1 0 0 BoneRotationArray XMap BaseAnimBones
|
||||
RotationBone 0 0 1 BoneRotationArray ZMap BaseAnimBones)
|
||||
4:( RotationBone 0 1 0 BoneRotationArray YMap BaseAnimBones
|
||||
RotationBone 0 0 1 BoneRotationArray ZMap BaseAnimBones
|
||||
RotationBone 1 0 0 BoneRotationArray XMap BaseAnimBones)
|
||||
5:( RotationBone 0 0 1 BoneRotationArray ZMap BaseAnimBones
|
||||
RotationBone 1 0 0 BoneRotationArray XMap BaseAnimBones
|
||||
RotationBone 0 1 0 BoneRotationArray YMap BaseAnimBones)
|
||||
6:( RotationBone 0 0 1 BoneRotationArray ZMap BaseAnimBones
|
||||
RotationBone 0 1 0 BoneRotationArray YMap BaseAnimBones
|
||||
RotationBone 1 0 0 BoneRotationArray XMap BaseAnimBones)
|
||||
)
|
||||
|
||||
ExportAnim Anims[index].Address
|
||||
)
|
||||
)
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user