PDA

View Full Version : Bug in keyGet ?



skarloc
08-20-2012, 01: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)
break
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...

EDIT:

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)
break


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.

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

Bravo to Lightwave !