|
Thanks, that sounds pretty much like what I experience here. I will
package it for support, thanks again.
-André
Brent McPherson wrote:
Andre,
I will have a more detailed look at your script when I get a chance but I believe the layer offsets are calculated from the current time. If I remember correctly it is done this way to support the "key time" functionality in XSI where you can MMB on the timeline to set a keytime which is different from the current frame. (and the problem with SaveKey is there is no way to specify that the offset should be evaluated at the key time)
The best bet would be to send this in to support(at)softimage.com (so it doesn't get lost) and we can figure out whether it is a bug vs something we might need to support by using an extra flag to SaveKey.
Thanks.
--
Brent
-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of André Adam
Sent: Monday, April 16, 2007 5:01 PM
To: xsi(at)Softimage.COM
Subject: Scripting Animation Layers
Heya,
what are people's experiences with scripting Animation Layers? I'm just
in the middle of designing an offset system and have to plot IK driven
animation on top of an FK layer.
*Any* attempt to do a simple SaveKey() inside of a cycle fails
miserably, the plottet offsets make no sense at all. *However*, if I
move the timeline manually (oPlayCtrl.Parameters("Current").Value =
blabla) and call a Refresh() from within the cycle, it works. This must
be the most ugly code ever; is this a bug, really meant to work like
this or me not getting something? To my understanding the offset keys
are solved through the interface?
Thanks in advance if anybody has a little bit of experience to share
with this new feature's internals. Oh, and a bit of repro code below...
Cheers!
-André
//1: Build and animate a skeleton:
//Create Skeleton
Create2DSkeleton(0, 0, 0, 0, 1, -3, 0, 90, 0, 4);
AppendBone("eff", 0, 0, -6);
//Key FK Animation
SaveKey("bone.kine.local.rotx,bone.kine.local.roty,bone.kine.local.rotz,bone1.kine.local.rotx,bone1.kine.local.roty,bone1.kine.local.rotz",
1);
Rotate("bone", 50, 0, 0, siRelative, siGlobal, siObj, siXYZ);
Rotate("bone1", -100, 0, 0, siRelative, siGlobal, siObj, siXYZ);
SaveKey("bone.kine.local.rotx,bone.kine.local.roty,bone.kine.local.rotz,bone1.kine.local.rotx,bone1.kine.local.roty,bone1.kine.local.rotz",
100);
//Key Effector, overriding the FK animation
SaveKey("eff.kine.local.posx,eff.kine.local.posy,eff.kine.local.posz", 1);
Translate("eff", 3, -1.5, 3, siRelative, siGlobal, siObj, siXYZ);
SaveKey("eff.kine.local.posx,eff.kine.local.posy,eff.kine.local.posz", 100);
AddAnimationLayer("Scene_Root");
SelectObj("bone,bone1");
//2.: Trying to plot the delta between FK and IK the straight forward
way, does not work:
function fPlotRotationOffsets(cObjs, aInOut){
var cKeyParams = new ActiveXObject("XSI.Collection");
var eObjs = new Enumerator(cObjs);
while(!eObjs.atEnd()){
cKeyParams.Add(eObjs.item().RotX);
cKeyParams.Add(eObjs.item().RotY);
cKeyParams.Add(eObjs.item().RotZ);
eObjs.moveNext();
}
for(var i=aInOut[0]; i<aInOut[1]+1; i++){
SaveKey(cKeyParams.GetAsText(), i, null, -1, -1, false);
}
}
fPlotRotationOffsets(Selection, new Array(1,100));
//3.: I have to do this instead:
function fPlotRotationOffsets(cObjs, aInOut){
var cKeyParams = new ActiveXObject("XSI.Collection");
var eObjs = new Enumerator(cObjs);
while(!eObjs.atEnd()){
cKeyParams.Add(eObjs.item().RotX);
cKeyParams.Add(eObjs.item().RotY);
cKeyParams.Add(eObjs.item().RotZ);
eObjs.moveNext();
}
var oPlayCtrl = ActiveProject.Properties.Find("PlayControl");
for(var i=aInOut[0]; i<aInOut[1]+1; i++){
oPlayCtrl.Parameters("Current").Value = i; //Bad!
Refresh(); //Even worse!
SaveKey(cKeyParams.GetAsText());
}
}
fPlotRotationOffsets(Selection, new Array(1,100))
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
|