|
|
Mastering
3D Studio MAX R3 |
Open the hand_controller.ms script from the CD, or type
all the commands shown in Listing 15.5.
LISTING 15.5: The Hand Controller script (hand_controller.ms)
rollout hand_rollout Parameters
(
Pickbutton sel Select Hand Object width:120 align:#left offset:[25,0]
checkbox inv Invert Rotation align:#right offset:[-25,-20]
slider A Thumb orient:#vertical align:#left range:[0,180,0] \
ticks:9 width:50
slider B Index orient:#vertical align:#left range:[0,270,0] \
ticks:9 offset:[60,-101] width:50
slider C Middle orient:#vertical align:#left range:[0,270,0] \
ticks:9 offset:[120,-101] width:50
slider D Ring orient:#vertical align:#left range:[0,270,0] \
ticks:9 offset:[180,-101] width:50
slider E Little orient:#vertical align:#left range:[0,270,0] \
ticks:9 offset:[240,-101] width:50
slider AA width:50 offset:[-5,0] range:[-60,60,0]
slider BB width:50 offset:[55,-29] range:[-15,15,0]
slider CC width:50 offset:[115,-29] range:[-15,15,0]
slider DD width:50 offset:[175,-29] range:[-15,15,0]
slider EE width:50 offset:[235,-29] range:[-15,15,0]
button RA Reset align:#left offset:[-2,0]
button RB Reset align:#left offset:[58,-26]
button RC Reset align:#left offset:[118,-26]
button RD Reset align:#left offset:[178,-26]
button RE Reset align:#left offset:[238,-26]
on sel picked obj do
(
objname = obj.name
sel.text = objname
A1 = execute ($ + objname + A_01)
B1 = execute ($ + objname + B_01)
C1 = execute ($ + objname + C_01)
D1 = execute ($ + objname + D_01)
E1 = execute ($ + objname + E_01)
A2 = A1.children[1]
B2 = B1.children[1]
C2 = C1.children[1]
D2 = D1.children[1]
E2 = E1.children[1]
B3 = B2.children[1]
C3 = C2.children[1]
D3 = D2.children[1]
E3 = E2.children[1]
)
on a changed val do
(
if inv.checked then val = -val
A1.rotation.x_rotation = val/2
A2.rotation.x_rotation = val
)
fn rotate_fingers f1 f2 f3 amount =
(
if inv.checked then amount = -amount
f1.rotation.x_rotation = amount/3
f2.rotation.x_rotation = amount/3*2
f3.rotation.x_rotation = amount
)
on b changed val do rotate_fingers B1 B2 B3 val
on c changed val do rotate_fingers C1 C2 C3 val
on d changed val do rotate_fingers D1 D2 D3 val
on e changed val do rotate_fingers E1 E2 E3 val
on aa changed val do A1.rotation.z_rotation = val - 90
on bb changed val do B1.rotation.z_rotation = val
on cc changed val do C1.rotation.z_rotation = val
on dd changed val do D1.rotation.z_rotation = val
on EE changed val do E1.rotation.z_rotation = val
on RA pressed do
(
A1.rotation.z_rotation = -90
A1.rotation.x_rotation = 0
A2.rotation.x_rotation = 0
A.value = 0
AA.value = 0
)
fn reset_rotation f1 f2 f3 s1 s2=
(
f1.rotation.x_rotation = 0
f1.rotation.z_rotation = 0
f2.rotation.x_rotation = 0
f3.rotation.x_rotation = 0
s1.value = 0
s2.value = 0
)
on RB pressed do reset_rotation B1 B2 B3 B BB
on RC pressed do reset_rotation C1 C2 C3 C CC
on RD pressed do reset_rotation D1 D2 D3 D DD
on RE pressed do reset_rotation E1 E2 E3 E EE
)
try (closerolloutfloater hand_floater) catch()
hand_floater = newrolloutfloater Hand Controller 330 251
addrollout hand_rollout hand_floater
We can either make this script a Macro Script or a utility. Simply evaluating
it will open the floater.
Lets look at some of the features used in this script. First, we
used OFFSET to specify the position of the UI items. This makes the script
more compact and easier to use. We used EXECUTE to define
the finger names. This is done so we can pick the exact object, named
according to the rules we defined earlier. Then, we define each finger
link, selecting the fingers children.
© 2000, Frol (selection,
edition, publication)
|
|