ScriptSpot

Forum topic · General Scripting

Key Curves

By Shade926 · 2013-04-16

Description

Im trying to add a curve such as ease in and ease out:

try(destroydialog ::test_button)catch()
rollout test_button "TEST"
(
-- Locals
local myKey = myObject.pos.controller.X_Position.controller.keys[80]
-- Rollout controls
button curveobject "Curve Object" width:130 height:20 align:#left
button animateobject "Animate Object" width:130 height:20 align:#left
-- Events
on animateobject pressed do
(
for j=0 to 50 by 10 do
(
with animate on at time j (move selection [10,0,10])
with animate on at time 80 (move selection [20,0,0])
)
)
on curveobject pressed do
(
myKey.outTangentType = #fast
myKey.inTangentType = #fast
)
createDialog test_button 160 100

This is the code i have but it does not seem to be working?

Thanks

Comments (1)

barigazy · 2013-04-16

Look in INPUT FORMAT and put your script code inside "code" tag.
This is your tool. To understand how to control animations keys read this
http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/files/GUID-B1700B1…


try(destroydialog ::test_button)catch()
rollout test_button "TEST"
(
-- Locals
local myObject
-- Rollout controls
button curveobject "Curve Object" width:130 height:20 pos:[5,5]
button animateobject "Animate Object" width:130 height:20 pos:[5,30]
-- Events
on animateobject pressed do
(
if selection.count != 0 do
(
myObject = selection as array
for j = 0 to 50 by 10 do
(
with animate on at time j (move selection [10,0,10])
with animate on at time 80 (move selection [20,0,0])
)
)
)
on curveobject pressed do
(
if myObject != undefined do
(
for o in myObject do
(
local myKey = getKey o[3][1][1].track (getKeyIndex o[3][1][1].track 80)
myKey.outTangentType = #fast
myKey.inTangentType = #fast
)
myObject = undefined
)
)
)
createDialog test_button 140 55