intangent outtangent error

have an error while creatin a key on 0frame and while there is no another key.
otherwise it runs well if there is minimum one key while you are on frame 0 or you are creatin the first speed key.

(
	global zztTool
	rollout zzTool "super spray"
	(
 
		group"Set Speed" --across: 2
		(
			spinner spSpeed "Speed" range:[0,1000,30]-- animatable
 
			button btn_deleteKeys "Delete All Existing Keys" width:120 height:20 setColor:red
		)
		/*
		group
		(
		)*/
		on btn_deleteKeys pressed do
		(
			(
				getST=slidertime
			sliderTime = 0f
			obj = getCurrentSelection ()
			deleteKeys obj #allKeys
				sliderTime = getST
			)
		)
				on spSpeed changed val do
		(
			for obj in (selection as array) do
			if classof obj == superspray then
			(
				s=slidertime
				hiz=spSpeed.value
				at time s animate on
				obj.speed = (hiz/2.54)
				a = getKeyIndex obj.speed.controller s
				obj.speed.controller.keys[a].inTangentType = #linear
				obj.speed.controller.keys[a].outTangentType = #fast
 
			)
		)
 
	)
	try
	(
		closeRolloutFloater zztTool
	)	catch ()
	zztTool=newRolloutFloater "fountain floater" 300 100
	addRollout zzTool zztTool
)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
izztti's picture

thanks. that works :)

thanks. that works :)

Anubis's picture

yep, array index in mxs start

yep, array index in mxs start from 1,
so check if there are keys (a > 0):

a = getKeyIndex obj.speed.controller s
if a > 0 do (
    obj.speed.controller.keys[a].inTangentType = #linear
    obj.speed.controller.keys[a].outTangentType = #fast
)

my recent MAXScripts RSS (archive here)

izztti's picture

need help about "inTangentType"

on a frame that is not "0f" it works well
on frame which is not "0f" it works well
but on frame "0f" and if there isn't another animation key,
it gives an error.
can anyone help me about the error.

---------------------------------------------------
---------------------------------------------------
(
	global zztTool
	rollout zzTool "super spray"
	(
 
		group"Set Speed" --across: 2
		(
			spinner spSpeed "Speed" range:[0,1000,30]-- animatable
 
			button btn_deleteKeys "Delete All Existing Keys" width:120 height:20 setColor:red
		)
		/*
		group
		(
		)*/
		on btn_deleteKeys pressed do
		(
			(
				getST=slidertime
			sliderTime = 0f
			obj = getCurrentSelection ()
			deleteKeys obj #allKeys
				sliderTime = getST
			)
		)
				on spSpeed changed val do
		(
			for obj in (selection as array) do
			if classof obj == superspray then
			(
				s=slidertime
				hiz=spSpeed.value
				at time s animate on
				obj.speed = (hiz/2.54)
				a = getKeyIndex obj.speed.controller s
				obj.speed.controller.keys[a].inTangentType = #linear
				obj.speed.controller.keys[a].outTangentType = #fast
 
			)
		)
 
	)
	try
	(
		closeRolloutFloater zztTool
	)	catch ()
	zztTool=newRolloutFloater "fountain floater" 300 100
	addRollout zzTool zztTool
)
AttachmentSize
error_message_0.jpg 48.18 KB
error_on_code.jpg 38.21 KB
interface.jpg 44.41 KB
speed.ms 991 bytes

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.