View Full Version : Planted Key -> Free Key

04-11-2012, 06:20 AM
Hey Maxscript-Gurus, :)

some days ago I recognized a problem which I can not handle myself anymore:

I want to convert planted keys into free keys. Okay this is really no big deal you might say.
Just go to the keyframe with the planted key and execute "biped.setFreeKey <bone>" but it is tougher.
Because when you convert planted keys to free keys, 3D Studio Max starts creating freaky interpolation curves between those two free keys, even if both the starting and the ending position are completely the same.
What I could do is setting a key every frame between the to planted keys, which I don't want to.
Does anybody knows something about my problem?

Thanks in advance.


04-11-2012, 11:44 AM
What do you mean by freaky?

You could also try looping through the keys and changing the Joint to Previous Key and IK Blend options. That will make them free keys and possibly avoid your problem.

04-11-2012, 12:38 PM
Yeah you're right I've got to be precise. When I say freaky I mean the fact that when you have two planted keys the leg rests still between these two keys. When you change the keys to free keys. The leg starts moving between the two new free keys (like the leg would be swimming). I could not find any solution besides creating keys in every frame between the two former planted keys. This is my current problem.

04-11-2012, 01:41 PM
Unfortunately, there isn't really a solution. You found it, baking...

I even tried applying keys in inverse order, and to my recollection that failed as well (note this is a couple of years ago, wouldn't hurt for you to try). Off the top of my head, you can also attempt to bake throughout (maintain your planted keys), and then do a pass to delete obsolete keys.

Either way, my solution was not quick.

My impression is that those functions are really macros that "call" the UI, except unlike a user interfacing with the UI, calling the macro from a function does not work the same way.

04-11-2012, 03:58 PM
Its a very long time since I used biped, but can you not change the tangency between your two 'same' keys so there's no overshooting interpolation?

04-11-2012, 05:51 PM
Hey Matt,

unfortunately it's not that easy, I've already tried to modify the tension curve and also check the tangents in the Curve Editor. The problem with sliding keys is that the hip or the torso might move while the limbs have become pinned to the position. So when I convert sliding keys into free keys the hip is moving and the limb "assumes" that it has to follow the hip (or the torso) what I really need is either totally remove the sliding or "swimming" from the free keys. Or counter-animate the hip or torso by a function which seems to be even more impossible than finding a solution to remove the swimming. :(

04-12-2012, 02:14 AM
Okay this is really no big deal you might say.
Just go to the keyframe with the planted key and execute "biped.setFreeKey <bone>"

have you tried another way.. chaing key props..

keyIndex = 1
k = biped.getkey $'Bip001 L Foot'.controller keyIndex
k.ikBlend = 0
k.ikSpace = 0

04-12-2012, 06:21 AM
Hey Huijun,

thanks for your idea, well yes, I've tried that and it did not work out.
I've experienced another weird thing:
When I create a planted key on every frame (for the whole animation where the objects has to stand still) and change all of those keys to FreeKeys manually it works, the limb rests on its place.

But when I create a loop to avoid setting FreeKeys manually that does exactly the same as I did by pressing the "Free-Key" Button (biped.setFreeKey obj). The limb starts moving again.
I don't understand that.

04-12-2012, 09:33 AM
Have you tried working the keyframes TCB ?

There's several ways to avoid the interpolations set by biped, for example setting the Continuity to 0 on two consecutive keys, or setting the Tension to 50, or also modifying the bias to 0 on the first one, and 50 to the second one.

It's a bit tricky, but I think it could work.

04-12-2012, 09:52 AM
Yes, this was one of my first assumptions but it did not work out. As I said what confuses me the most is that the manual way of the conversion works but the script driven way does not.

04-13-2012, 09:29 AM
I know this is a gigantic hack, but maybe you could effectively do a callback to auto click the buttons rather than using the functions if they are giving different results to pressing the buttons?

04-13-2012, 11:31 AM
Yes Matt this would possibly be a solution but the problem is that the callback handler does not seem to work with that part of the UI and even if it would than I still would have to be able to control this button but I did not found any Macro command which I could call to use this button.
Claudio, what you suggested is ttally right. But to be honest I did this already and it didn't work for me either. The only working possibility seems to be baking but let me ask you: Is there another way but calling convert to footsteps to get the keys baked in every frame on only ONE specific biped bone. When I use convert to footsteps it bakes everything even if I use the appropriate function with a specific biped controller... Makes me crazy.

07-10-2012, 09:53 AM
I solved it!

The rest is just calling the function at the specific time.
Basically I'm not thaaat pleased because to me using a UIAccessor is a bit hacky but this method was the only one that produced the correct outcome.

For those who got stuck on the same problem, here is the code for pressing the sliding key button at the current time of the timeslider using UIAccessor:

fn testfunc =
whnd = windows.getMAXHWND()
WindowChildren = (UIAccessor.GetChildWindows whnd)
for lvi = 1 to WindowChildren.count do
if (UIAccessor.getWindowClassName WindowChildren[lvi]) == "RollupPanel" then
WindowKeyInfoChildren = (UIAccessor.GetChildWindows WindowChildren[lvi])
if (UIAccessor.getWindowText WindowKeyInfoChildren[1] == "Key Info") then
UIAccessor.PressButton WindowKeyInfoChildren[21]
-- 15 - SetKey Button
-- 17 - DeleteKey Button
-- 19 - SetPlantedKey Button
-- 21 - SetSlidingKey Button
-- 23 - SetFreeKey Button
-- 25 - Trajectories Button
print "Set Sliding Key at current time."


CGTalk Moderation
07-10-2012, 09:53 AM
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.