I have a curve with one keyframe, say, at time 3.
When I try to do
newframe = new Keyframe(0, oldframe.value);
curve.MoveKey(0, newframe)
it simply adds the new frame at curve.keys[0].time, which (according to the documentation) is what should happen if there’s already a keyframe on the curve with time 0, but that isn’t the case here (since the only keyframe is at time 3).
I can work around this by simply removing the existing keyframe and adding a new one, but I want to preserve the keyframe indicies. Given that, a workaround is to remove all keyframes, then re-add them in order (with the move manually applied). What would be very nice is if this actually worked as expected, and I didn’t have to do that. Is there something else I need to be doing for this to work properly?
Note that MoveKeyframe works fine for all other times I’ve tested, just not zero. I can, however, adda new keyframe without a problem at time 0.