动画工具
# 动画工具
# AppData ID号占用情况
fn __TransformZero__ o oring_true =
(
local pin_id = genguid()
if o.parent != undefined then
(
oParent = o.parent.name
local old_id = getAppData o.parent 102
--检查父级是否有分配ID
if old_id == undefined then (
--如果没有,生成新的
setAppData o.parent 102 pin_id
)
else(
--如果有,将继续使用该ID
pin_id = old_id
)
--if o.transform as string == o.parent
if o.transform.pos == o.parent.transform.pos and o.transform.rotation == o.parent.transform.rotation then
(
setAppData o 103 "1" --如果是和挂点对齐的,设为 1
)else(
setAppData o 103 "0" --如果和挂点有偏移,设为 0
local temp_offset = align_anim_offset o.parent o
setAppData o 105 (oParent+"|"+(temp_offset as string))
--保存和父级的偏移量
)
)else (oParent = "undefined")
setAppData o 104 pin_id --在子骨骼上保存配对ID
setAppData o 101 (oParent+"|"+(o.transform as string))
--setAppData o 105 (oParent+"|"+(temp_offset as as string))
--setAppData i 2 ((in coordSys parent i.pos) as string)
--setAppData i 3 ((in coordSys parent i.rotation) as string)
--setAppData o 2
if oring_true do (
if classof o == Biped_Object then
(
animate false
(
o.transform = (matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0])
rotate o (angleaxis -90 [0,0,1])
)
)
else(
animate false o.transform = (matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0])
)
o.parent = undefined
)
--bip旋转值偏移90
--if classof o == Biped_Object do rotate o (angleaxis -90 [0,0,1])
--if TransformZero_Link.checked do (o.parent = undefined)
)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56