Hi Raffaele,
I made a test with object model and it looks really fast.
Code Snipet :
for(var i=0; i<100; i++)
{
// Create a null
var nullobj = ActiveSceneRoot.AddNull();
//position
var posxArray = [0,5,10,50];
var posyArray = [0,7,9,500];
var poszArray = [0,15,9,12];
CreateCurveThenAddKeys( nullobj.posx, posxArray );
CreateCurveThenAddKeys( nullobj.posy, posyArray );
CreateCurveThenAddKeys( nullobj.posz, posyArray );
}
function CreateCurveThenAddKeys( channel, arrayValues )
{
// Create empty fcurves
var fcurve = channel.AddFCurve();
// Define the number of keys
var nbkeys = arrayValues.length ;
// Start editing the fcurve
fcurve.BeginEdit();
// Add keys to the fcurve
for ( var i=0; i<nbkeys; i++ )
{
fcurve.AddKey( i, arrayValues[i] );
}
//End editing the fcurves and put the undo event onto
// the undo/redo stack
fcurve.EndEdit();
return fcurve;
}
Cheers
--
Guillaume Laforge | La Maison
On Tue, 24 Jul 2007 14:31:10 -0400 (EDT), Raffaele Scaduto-Medola <raffaele(at)inch.com> wrote:
Hello all,
I was wondering if anyone on the list might have run into this problem
before.
I am trying to apply some x,y,z position values to a set of nulls, and
keyframe that set of nulls. Unfortunately, the technique I am using now
(with JScript is still slow). But I was wondering if anyone might have a
faster "object" based approach to applying and keyframing data onto a
group of null (or any objects).
Right now I use
var $o_obj = ActiveSceneRoot.findChild("null128") ;
//============================================== set x,y,z position
$o_obj.Kinematics.Global.Parameters("posx").value = $valueX ;
$o_obj.Kinematics.Global.Parameters("posy").value = $valueY ;
$o_obj.Kinematics.Global.Parameters("posz").value = $valueZ ;
//============================================== save the keyframe
savekeyOnKeyable($o_obj, $frame );
The problem is I have to do 266 of this operation for 300-500 frames.
If anyone knows a faster technique I could use, any hints and sample code
would be much appreciated.
THX
RSM
_____________________________________________________
Raffaele Scaduto-Mendola - www.turbolinea.com
raffaele(at)turbolinea.com
-
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi