Home Marmoset

[API] First key set with setKeyframe() does not respect interpolation type

It looks like there might be a bug with the setKeyframe() method. 

When I run the following code line-by-line from the interactive console:
new_grp = mset.groupObjects([mset.findObject('Main Camera')])
new_grp.setKeyframe('linear')
mset.getTimeline().setTime(2)
new_grp.position = [0,10,0]
new_grp.setKeyframe('linear')
I get two keyframes at 0 and 2 seconds with a spline curve between them. Clearly not the intended result. 

If I go back and overwrite that first keyframe at 0 seconds with this code, also one line at a time:
mset.getTimeline().setTime(0)
new_grp.setKeyframe('linear')
the curve becomes linear as expected. 

This should be easy enough to automate but when I run that code from a plugin (or as a multiline block vs. line-by-line in the interactive console) I get a curve with keyframes in the correct locations but the values are both [0,10,0]. So it looks like setTime() doesn't update attribute values when running in this context.

Again, this should be easy enough to fix by modifying that second chunk of code to manually set the initial values after moving the playhead back to 0 seconds:
mset.getTimeline().setTime(0)
new_grp.position = [0,0,0]
new_grp.setKeyframe('linear')
and that works when run line-by-line but when I do it as a block or from a plugin I just get a spline curve again! 

So I guess this could be two bugs: 
+ setKeyframe() doesn't respect interpolation type on the first instance of a keyframe
+ the Python API isn't evaluating the same way in all contexts

Any thoughts on this? 

Thanks!

Replies

Sign In or Register to comment.