PDA

View Full Version : Apparent bug in getKeyCurve function



Blypht
07-23-2004, 05:19 PM
It appears that the getKeyCurve function fails whenever it encounters a Bezier-type key.

The text of the returned error is:
Line #, stack empty, no value to assign to variable UDF::VARNAME

Sounds like the function is not returning a value when it encounters a Bezier, but is returning one for all other types.

If anyone knows a workaround, I'd love to see it.

I'm running LW 7.5, don't know my LScript version.

Below is a script to reproduce the bug. You'll need to do setup as follows:
1) Start Layout
2) Select an object (any one will do)
3) Invoke the Graph Editor
4) Select the first channel (probably position.x)
5) Add one or more keys
6) Make the last key a Bezier (others can be anything but)
7) Invoke the LScript (below)

@version 2.2
@warnings
@script generic
@name "Bezier Key Test"

generic
{
// Get the first selected object
objSelected = Scene().firstSelect();

// Valid object?
if (objSelected != nil)
{
// Get the first channel of the object
chnSelected = objSelected.firstChannel();

// Cycle through all keys in the first channel
intKeyCount = chnSelected.keyCount;
for (i = 1; i <= intKeyCount; i++)
{
// Get the key ID
numKey = chnSelected.keys[i];

// Get the curve type
intCurveType = chnSelected.getKeyCurve(numKey);
switch (intCurveType)
{
case CHAN_TCB:
strCurveType = "TCB";
break;
case CHAN_HERMITE:
strCurveType = "Hermite";
break;
case CHAN_BEZIER:
strCurveType = "Bezier";
break;
case CHAN_LINEAR:
strCurveType = "Linear";
break;
case CHAN_STEPPED:
strCurveType = "Stepped";
break;
default:
}

// Tell user all the key info
info("Object.Channel.Key Index.Key ID.Curve Type = ",objSelected.name,".",chnSelected.name,".",i,".",hex(numKey),".",strCurveType);
}
}
else
info("No selected objects.");
}

faulknermano
07-24-2004, 03:21 AM
beziers will crash lscript and lw along with it. i dont know if this has been fixed in later revisions.

Lynx3d
07-24-2004, 01:46 PM
Same error here...LW8, whatever the LScript version that ships with it is.

Don't think there's an error in your script, so pretty much seems like a bug, and according to faulknermano it's (yet another) a known one :(