CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 02-06-2013, 09:44 AM   #1
Mambo4
not a jedi yet
 
Mambo4's Avatar
portfolio
Logan Bender
Game Technical Artist
Greater Seattle, USA
 
Join Date: Nov 2010
Posts: 432
FK-IK snap script running backwards ???

I'm at my wits end on this one.

If I run this code in isolation (select and execute), it does what I expect:
Code:
$ctrl_FK_r_leg_a.transform = $IK_r_leg_a.transform $ctrl_FK_r_leg_b.transform = $IK_r_leg_b.transform $ctrl_FK_r_foot.transform = $IK_r_foot.transform


the FK ctrls snap to the IK bones.

and yet when I embed this as a fucntion on a button, the opposite happens!
the IK bones snap to the FK controls objects.

further strangeness : the same script with different object names works flawlessly on the arms...

I can't even guess what the heck is happening here...
 
Old 02-06-2013, 04:38 PM   #2
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,623
Send a message via ICQ to denisT
there is a bug in your code or the bones are named wrong. it's very hard to say anything more without seeing any details. if you want to get the real help post the code, make scene setup, etc.
 
Old 02-06-2013, 04:42 PM   #3
Mambo4
not a jedi yet
 
Mambo4's Avatar
portfolio
Logan Bender
Game Technical Artist
Greater Seattle, USA
 
Join Date: Nov 2010
Posts: 432
Further investigation indicates this is a result of wrapping the function inside of a checkButton.

Code:
parameters ikfk_params rollout: ikfk_roll ( 'bool_ik' type:#boolean animatable:true ) rollout ikfk_roll "IK-FK Options" ( fn snapToIK =( print "SnaptoIK..." $ctrl_FK_r_leg_a.transform = $IK_r_leg_a.transform $ctrl_FK_r_leg_b.transform = $IK_r_leg_b.transform $ctrl_FK_r_foot.transform = $IK_r_foot.transform ) fn snapToFK=( print "snaptoFK..." $ctrl_IK_r_foot.transform =$ctrl_FK_r_foot.transform $IK_r_leg_swivel.transform= $FK_r_leg_swivel.transform ) checkbutton btn_fk_on "FK" highlightColor:red checked:(not (bool_ik)) across:2 checkbutton btn_ik_on "IK" highlightColor:green checked: bool_ik on btn_ik_on changed state do( bool_ik = true btn_fk_on.checked=false snapToFK() select $ctrl_IK_r_foot ) on btn_fk_on changed state do( bool_ik =false btn_ik_on.checked=false snapToIK() ) )


I've got it working by abandoning function calls and checkbuttons all together for FK snap, instead wrapping the code in a simple button.
Code:
button btn_snapToIK "FK" on btn_snapToIK pressed do( $ctrl_FK_r_leg_a.transform = $IK_r_leg_a.transform $ctrl_FK_r_leg_b.transform = $IK_r_leg_b.transform $ctrl_FK_r_foot.transform = $IK_r_foot.transform btn_ik_on.checked=false bool_ik=false )

But I still have no clue why the function in the first case fails, yet the second function snapToFK works fine. the fact that the hack works tells me it's the code and not the rig -but even so I have double a triple checked the names.

Chances are I am just not using the check button correctly...
 
Old 02-06-2013, 05:59 PM   #4
denisT
MAX Doctor
 
denisT's Avatar
portfolio
Denis Trofimov
CA, USA
 
Join Date: Jul 2009
Posts: 9,623
Send a message via ICQ to denisT
Quote:
Originally Posted by Mambo4
But I still have no clue why the function in the first case fails, yet the second function snapToFK works fine. the fact that the hack works tells me it's the code and not the rig -but even so I have double a triple checked the names.

i think the IK solver settings "IK for FK Pose" and "Auto Snap" work against.
 
Old 02-11-2013, 07:46 PM   #5
Mambo4
not a jedi yet
 
Mambo4's Avatar
portfolio
Logan Bender
Game Technical Artist
Greater Seattle, USA
 
Join Date: Nov 2010
Posts: 432
The culprit was inconsistent bone orientation between arms and legs.

the arms were set up fully for mirrored axes

the legs were not

the result was incorrect trasnform data.

bone orientation problem detailed in this thread
 
Old 02-11-2013, 07:46 PM   #6
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 06:12 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.