[Closed] TCB Script giving error pls help
I downloaded a script which makes the tension(TCB) value 50 for all the selected cubes in all the keyframes. But its giving error in this line(Underlined).
–Work for all cubes in selection
for cube in selection do (
–Change 6 to number of keyframes
for i = 1 to 6 do (
cube.rotation.controller.keys[i].tension = 50
)
)
Can anyone pls help.
I am using 3dsmax 9. Early response would helpful.
m3dhunk
Its probably because the item you are changing has less than 6 keys.
hardcoding a value like this into a loop that uses a changeable array like selection is never a great idea, as you dont know how many keys the object might have (in theory)
its much better to retrieve the key array and loop through that, unless you know it’s its the first 6 keys you want to change.
for cube in selection do
(
-- store the array of keys
local KeyArray = cube.rotation.controller.keys
-- check there is a TCB rotation controller
if classof cube.rotation.controller == tcb_rotation then
-- iterate the keyarray and change the values
for i = 1 to KeyArray.count do KeyArray[i].tension = 50
)