[Closed] Script not finding keys on a constrained helper
I have been working on a script that copies animation from a bone based rig onto a biped and back, but I have hit a block, and was hoping someone could explain something for me. I am using a bunch of constrained dummies for my alignment because I can not change the rigs structure. the script keys the helpers any time the bone it corresponds to has a key, but it is failing when I try to use those keys. Can someone explain to me why my helper rig_a_LF_E_FK_Control returns no keys when it does have keys. Here is an example from the listener.
n = getNodeByName(“Bip001 L Forearm”)
$Biped_Object:Bip001 L Forearm @ [24.367407,-20.284365,85.081345]
n.controller
Controller:L_Forearm
n.controller.keys
#keys(0f, 2f, 6f, 12f, 14f, 18f, 24f)
n = getNodeByName(“rig_a_LF_E_FK_Control”)
$Point_Helper:rig_a_LF_E_FK_Control @ [24.456728,-20.146656,84.752327]
n.controller
Controller:Position_Rotation_Scale
n.controller.keys
#keys()
If I run trackbar.getPreviousKeyTime() or trackbar.getNextKeyTime() on rig_a_LF_E_FK_Control I get a valid results
I dont have max open but if I remember correctly you have to specify the controller… Something like $.pos.controller.keys Can’t remmber if you can get the keys from the transform.
If not you can store the posistion key time into an array and then use appendifunique to add rhe rotation key time. But thats depending on how you plan on transfering the animation. Biped to custom rig is fairly easy, but custom rig to biped might be a little bit harder.
If it you can use the fbx file format to transfer the animation.
Edit: dont forget about the interpolation, assuming your rig works with euler and you left the biped to his default quaternon state will give you different results when interpolating. Nothing major, but enough to piss off a well trained animator… In that case i’d suggest to simply use the collect command to get the transform at every frae and bake it back when transfering.
The prs controller doesn’t support keys. The keys are stored in its subcontrollers.
So, in order to get the keys you should either go for:
–Position keys
n.position.controller.keys
–Rotation keys
n.rotation.controller.keys
–Scalekeys
n.scale.controller.keys
( in this version you can’t get the values e.g.: n.position.controller.keys[1].value )
or for:
–Position keys
n.position.controller.X_position.controller.keys
n.position.controller.Y_position.controller.keys
n.position.controller.Z_position.controller.keys
–Rotation keys
n.rotation.controller.X_rotation.controller.keys
n.rotation.controller.Y_rotation.controller.keys
n.rotation.controller.Z_rotation.controller.keys
–Scalekeys
n.scale.controller.keys
( in this version you can get the values e.g.: n.position.controller.X_position.controller.keys[1].value )