simple script to control my rig(foot)

Hi there fellas, I have made a simple script to control my rig(foot), but I cant figure how to make set key button work.

def=attributes footControl
(
		parameters heelRoll rollout:footRO
	(
		HeelRotation type:#float ui:heelRotSL
	)
	parameters toeRoll rollout:footRO
	(
		ToeRotation type:#float ui:toeRotSL
	)
	parameters tiptoeRoll rollout:footRO
	(
		TiptoeRotation type:#float ui:tiptoeRotSL
	)
		parameters footBank rollout:footRO
	(
		FootBanking type:#float ui:bankingSL
	)
 
	rollout footRO "Foot Control"
	(
		group "Roll"
		(
			slider heelRotSL "Heel Rotation"
			slider toeRotSL "Toe Rotation"
			slider tiptoeRotSL "Tiptoe Rotation"
		)
		group "Bank"
		(
			slider bankingSL "Foot Banking" range:[-50,50,0]
		)
		group "Key and Reset"
		(
			button keyAll "Key All" width:65 across:2
			button resetAll "Reset All" width:65
 
			on keyAll pressed do with undo on
			(
				addNewKey (HeelRotation) currentTime
				addNewKey (ToeRotation) currentTime
				addNewKey (TiptoeRotation) currentTime
				addNewKey (FootBanking) currentTime
			)
 
			on resetAll pressed do with undo "Reset_All" on
			(
				HeelRotation=0
				ToeRotation=0
				TiptoeRotation=0
				FootBanking=0
			)
		)
	)
)
custAttributes.add $.modifiers[1] def

Comments

Comment viewing options

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

Thank u a million time But 1 tinny problem.

Hey man, I dont know how to thank u, u helped me a lot. just one small problem remains. I did what u said and it was so amazing, I could create keyframes, but the problem is the VALUE of the parameter does not changes. for example when I go to any frame and press key all a keyframe get made in all parameters but the value remain 0 in all created frames, remiding that I changed the parameters value. so could u help me some more and tell me how to make it capture the value too?

MKlejnowski's picture

Not sure I follow. The key

Not sure I follow. The key All button should work the same way as hitting the "Set Keys" button. The value of the slider shouldn't change when you hit the Key all button; it should just set a key frame on the time slider with its current value. To test it out do this.

1. turn auto key on
2. set the time slider to the first frame and zero out yours slider(or move the bar to the left)
3. set the time slider to frame 100 and max out the slider(move the bar to the right)
4. turn auto key off and and go to frame 50
5. hit the "Key all" button you have in your script
6. move the key to frame 10 or frame 90 and see if it slider is half way.

If it does what I just said then it should work. Unless you want it to do something else?

MKlejnowski's picture

You are making a small

You are making a small mistake with your code. First i would block the actual event code with animate on but that is not where you are making the mistake. What you are supposed to be trying to do with the animate on is set a value to your param so that it can set a keyframe with the new value. But the mistake you are making is trying to pass a method into your params when you are supposed to be passing a value.

Your Code
HeelRotation=addNewKey

the code you want
HeelRotation=HeelRotation

Here is the code with the fixes is spoke of. Hope this helps.

def=custAttributes.getDef $.modifiers[1].me
attributes me
redefine:def
(
	----Params-----
	parameters paramsBlock rollout:footRoll
	(
	HeelRotation type:#float ui:heelRotSL animatable:true
	ToeRotation type:#float ui:toeRotSL animatable:true
	TiptoeRotation type:#float ui:tiptoeRotSL animatable:true
	FootBanking type:#float ui:bankingSL animatable:true
	)--end ParmasBlock
 
	-----RO-----
	rollout footRoll "Foot Control"
	(
		group "Roll"
		(
			slider heelRotSL "Heel Rotation"
			slider toeRotSL "Toe Rotation"
			slider tiptoeRotSL "Tiptoe Rotation"
		)--end Roll group
 
		group "Bank"
		(
			slider bankingSL "Foot Banking" range:[-50,50,0]
		)--end Bank Gruop
 
		group "Key and Reset"
		(
			--Ro
			button keyAll "Key All" width:65 across:2
			button resetAll "Reset All" width:65
 
			--Events
			on keyAll pressed do 
			(
				undo "Key All" on
				(
					with animate on
					(
						HeelRotation=HeelRotation
						ToeRotation=ToeRotation
						TiptoeRotation=TiptoeRotation
						FootBanking=FootBanking
					)
				)
			)--end KeyAll event
 
			on resetAll pressed do 
			(
				undo "Reset_All" on
				(
					HeelRotation=0
					ToeRotation=0
					TiptoeRotation=0
					FootBanking=0
				)
			)--End resetAll event
		)--end key and reset group
	)--end Rollout
)--end redefine
--custAttributes.add $.modifiers[1] def
rezanasiri's picture

Its working, thank u.

Actually my goal was slightly different, I wanted to be able to key my attributes without auto key ON. I wanted to create my own set key button. just like max`s set key which doesnt create keyframe on the fly and we need to hit the set key button when we desire. With the auto key on there is no much point in scripting a key button. My goal was that to be able to animate for instance heelRotation slider without turning on auto key.

Graph's picture

with animate true( at time

on keyAll pressed do 
(
  with undo true
  (
    with animate true
    (
      at time currentTime
      (
        HeelRotation = HeelRotation
        ...
      )
    )
  )
)

Raphael 'Insanto' Steves
http://Graph.Net84.Net

Graph's picture

shouldn't you set the

shouldn't you set the properties to animatable?

<name> type:<#name> [tabSize:<integer>] [tabSizeVariable:<boolean>] [default:<operand>] [animatable:<boolean>] [subAnim:<boolean>] [ui:<ui_def>]

Raphael 'Insanto' Steves
http://Graph.Net84.Net

rezanasiri's picture

I cant understand

thanks for your help, but please consider me as a starter and be more precise. Could you do me a favor and tell me what exactly should I do? I mean what code should I put in my script to make work?

Graph's picture

.. HeelRotation type:#float

..
HeelRotation type:#float ui:heelRotSL animatable:true
..
ToeRotation type:#float ui:toeRotSL animatable:true
..
TiptoeRotation type:#float ui:tiptoeRotSL animatable:true
..
FootBanking type:#float ui:bankingSL animatable:true

also.. why are you putting everything into a different parameters block? wouldn't it be easier and tidier to have all CAs in one param block per rollout?

Raphael 'Insanto' Steves
http://Graph.Net84.Net

rezanasiri's picture

Thanks, your tip was awesome. But still doesnt work

Dude, Im gettin desperate, how can I make this work? Please help.

def=custAttributes.getDef $.modifiers[1].me
attributes me
redefine:def
(
parameters paramsBlock rollout:footRoll
(
HeelRotation type:#float ui:heelRotSL animatable:true
ToeRotation type:#float ui:toeRotSL animatable:true
TiptoeRotation type:#float ui:tiptoeRotSL animatable:true
FootBanking type:#float ui:bankingSL animatable:true
)

rollout footRoll "Foot Control"
(
group "Roll"
(
slider heelRotSL "Heel Rotation"
slider toeRotSL "Toe Rotation"
slider tiptoeRotSL "Tiptoe Rotation"
)
group "Bank"
(
slider bankingSL "Foot Banking" range:[-50,50,0]
)
group "Key and Reset"
(
button keyAll "Key All" width:65 across:2
button resetAll "Reset All" width:65

on keyAll pressed do with undo on
(
with animate on
HeelRotation=addNewKey
ToeRotation=addNewKey
TiptoeRotation=addNewKey
FootBanking=addNewKey
)

on resetAll pressed do with undo "Reset_All" on
(
HeelRotation=0
ToeRotation=0
TiptoeRotation=0
FootBanking=0
)
)
)
)
--custAttributes.add $.modifiers[1] def

Comment viewing options

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