ScriptSpot

Forum topic · General Scripting

Interactive IK toggle

By ste · 2013-10-28

Description

Hi guys, I'm a new member of scriptspot and I'm also new to maxscript.
I have an arm rig setted up with Interactive IK (yes, the old one... but it's the only way to achieve what I need!).

So the problem is that I would like to switch the Interactive IK button ON/OFF by selecting certain objects.

Searching a lot I found some ways to do that:

Method #1


obj=$box
when select obj change do
(
 max toggle ik
)

Method #2


obj = #($box,$foo)
for obj in selection do
(
 max toggle ik
 )

Method #3 - custom attribute checkbox


the_IkFkSwitch = attributes IkSwitch
(
	parameters main rollout:params
	(
		IkFkState type:#boolean ui:IkFkToggle default:false
	)

	rollout params "Ik / Fk Toggle"
	(
		checkbox IkFkToggle "IK On:" Checked:false
		
		on IkFkToggle changed state do
		(
			max toggle ik
		)
	)
)
custAttributes.add $ the_IkFkSwitch

All these methods works, but are all toggle between the 2 states, and I need a way to check if IK state is ON or OFF.

I also found the actionMan code for this action:
"0" return true and toggle, "1" return false and do nothing


actionMan.executeAction 0 "313"

and


actionMan.executeAction 1 "313"

Any idea how to solve it?

Comments (1)