RE: [script] Creating relative values fcurve

Date : Mon, 30 Apr 2007 16:19:43 +0100
To : <XSI(at)Softimage.COM>
From : "kim aldis" <kim.aldis(at)gmail.com>
Subject : RE: [script] Creating relative values fcurve
The code below works as I'd expect, Bernard. One key added at frame one,
value 1.0 the next at frame 25, value 10.

oFcurve = selection(0).posx.source;

var oFcurveKeys = new Array( 1,0,25,10 )
oFcurve.beginedit();
iLength = oFcurveKeys.length;


 for( i = 0; i < iLength; i=i+2 ) {
   fTime = oFcurveKeys[i];
  fValue = oFcurveKeys[i+1];
  oFcurve.addkey( fTime, fValue, 0, true );
  
}
 oFcurve.endedit();

> -----Original Message-----
> From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On
> Behalf Of Bernard Lebel
> Sent: 30 April 2007 14:58
> To: XSI(at)Softimage.COM
> Subject: Re: [script] Creating relative values fcurve
> 
> Okay I tried it with the other possible tolerance value, -1. Same
> result: the second key is at frame 1/value 1 instead of frame 25/value
> 1.
> 
> 
> 
> "The tolerance argument can be used to merge all keys within a certain
> range. The range is defined as Frame - Tolerance and Frame +
> Tolerance. The merged key inherits the constraints of the nearest key
> within this range. "
> 
> I don't see how this description explains the result I'm getting.... :-
> (
> 
> 
> Cheers
> Bernard
> 
> 
> 
> 
> On 4/27/07, Bradley Gabe <withanar(at)stanwinston.com> wrote:
> >
> >  Bernard, not a showstopper. Check the documentation on the addkey()
> method
> > and you'll see what's happening. The third parameter is for
> tolerance, which
> > you have set to 0, and that forces the key to be set on exact frames.
> >
> >  -Brad
> >
> >
> >
> >
> > Hello,
> >
> > I'm running into this show-stopper.
> >
> > I'm trying to re-create the fcurve of a relative value expression.
> > I create the expression, no problem at all.
> > Then I get its relative fcurve parameter, no problem.
> > Then I loop over a one dimensional array of time/value numbers, and
> > create the keyframes:
> >
> >
> > oFcurve.beginedit();
> > iLength = oFcurveKeys.length;
> >
> > for( i = 0; i < iLength; i=i+2 ) {
> >  fTime = oFcurveKeys[i];
> >  fValue = oFcurveKeys[i+1];
> >  oFcurve.addkey( fTime, fValue, 0, true );
> > }
> >
> > oFcurve.endedit();
> >
> > (in this example I use a loop, but the SetKeys method gives the same
> > result I'm about to describe)
> >
> >
> > Now, I get all the keyframes. In this particular, I have two
> > keyframes. The first one is all right. BUT the second one, for the
> > life of me, refuses to be placed anywhere else than at frame 1.0.
> >
> > If I then print its frame, it's the frame I specified (25, for
> > example). But in the animation editor, it's located at 1/1. Also,
> when
> > viewing its effect in viewport, I can *see* it's 1/1. Yet printing
> its
> > frame says 25.
> >
> > ARGGGGHHHH
> >
> >
> > Any idea?
> >
> >
> > Thanks
> > Bernard
> > ---
> > 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


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.