Thursday, December 22, 2011

Setting a keyframe at the current time in Softimage with Javascript

With some help, I learned how I could set a keyframe at the current time in Softimage via Javascript.  Now, thanks to Myara, I can complete my synoptic page....

SaveKey(oObj.posx + "," + oObj.posy + "," + oObj.posz, getValue("PlayControl.Current"))


I couldn't get that syntax working, but I got a slightly different variation working:

function TL_MainBody(in_obj,in_mousebutton,in_keymodifier)
{
oObj = "Bkpk-Controls.NULL_MainBody";
SelectObj(oObj, null, true);
SetValue(oObj + ".kine.local.posx", -1, null);
SetValue(oObj + ".kine.local.posy", 1, null);
SetValue(oObj + ".kine.local.posz", 0, null);
SaveKey(oObj + ".kine.local.posx," + oObj + ".kine.local.posy," + oObj + ".kine.local.posz", getValue("PlayControl.Current"), null, null, null, null, null);
DeselectAll();
}

Sloppy, but it works!