View Full Version : Bug in keyGet ?

08-20-2012, 02:41 PM
Hi to all you Pythoners (and anyone else...)

I have a small bit of code (cut from the rest of the program) :

selected_items = lwsdk.LWInterfaceInfo().selected_items()
sgroupID = lwsdk.LWItemInfo().chanGroup( selected_items[0] )
schanID = lwsdk.LWChannelInfo().nextChannel(sgroupID, None)
while schanID:
channelName = lwsdk.LWChannelInfo().channelName(schanID)
if channelName == "Color.R":
senvID = lwsdk.LWChannelInfo().channelEnvelope(schanID)
keyID = lwsdk.LWEnvelopeFuncs().nextKey(senvID, None)
while keyID:
result, time = lwsdk.LWEnvelopeFuncs().keyGet(senvID, keyID, lwsdk.LWKEY_TIME)
result, value = lwsdk.LWEnvelopeFuncs().keyGet(senvID, keyID, lwsdk.LWKEY_VALUE)
result, shape = lwsdk.LWEnvelopeFuncs().keyGet(senvID, keyID, lwsdk.LWKEY_SHAPE)
result, tens = lwsdk.LWEnvelopeFuncs().keyGet(senvID, keyID, lwsdk.LWKEY_TENSION)
print "@ %f, %f %d %f" % (time,value,shape,tens)
keyID = lwsdk.LWEnvelopeFuncs().nextKey(senvID, keyID)
schanID = lwsdk.LWChannelInfo().nextChannel(sgroupID, schanID)

If you take a light, add an envelope to the colour (here, I'm just scanning the Red) and set the incoming curve to Linear (or anything other than TCB), all of the above keyGets work EXCEPT LWKEY_SHAPE, which always returns 0. Is this a bug with my program, with the Python SDK or elsewhere ? I've tried displaying it as a float (just in case) but to no avail...

BTW, if you set it to TCB it always works ;)...

Thanks guys...


Just for fun, I thought I'd test keySet with the folloing code :

newKeyID = lwsdk.LWEnvelopeFuncs().createKey(senvID, time + 1, value)
lwsdk.LWEnvelopeFuncs().keySet(senvID, newKeyID, lwsdk.LWKEY_SHAPE, 3)

The curve created was TCB and wasn't Linear... So keySet doesn't seem to work either, which makes me think that LWKEY_SHAPE may not be correctly defined... Note that the break stops it from running indefinitely.

08-31-2012, 02:17 PM
Right, update - it's effectively a bug and has been fixed for the next release.

Bravo to Lightwave !