-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleBoneLink.ms
More file actions
49 lines (41 loc) · 893 Bytes
/
SimpleBoneLink.ms
File metadata and controls
49 lines (41 loc) · 893 Bytes
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
/**
Copyright 2017 James Somervail
*/
MainWindow = newRolloutFloater "SimpleBoneLink" 174 81
fn eulToVec eul =
(
x = cos(eul.y)*cos(eul.z)
y = sin(eul.y)*cos(eul.z)
z = sin(eul.z)
return normalize [-x, z, y]
)
fn linkBones par chi =
(
rot = eulToVec ( quattoeuler par.rotation )
endpos = par.pos + (rot * -par.length)
lbone = BoneSys.createBone endpos chi.pos [0,0,1]
chi.parent = lbone
lbone.parent = par
)
global tarparent
global tarchild
rollout BoneLink "Bone Link" width:162 height:54
(
pickButton 'selparent' "Parent" pos:[1,1] width:80 height:26 align:#left
button 'apply' "Link Bones" pos:[1,28] width:160 height:25 align:#left
on selparent picked obj do
(
if classof obj == BoneGeometry do
(
tarparent = obj
)
)
on apply pressed do
(
for i in $selection as array do
(
linkBones tarparent i
)
)
)
addrollout BoneLink MainWindow