Hello,
I'm trying to set and retrieve keyframes for a floating point slider parameter but experience some problems in FCP X 10.0.5-7:
Firstly, it seems I cannot read back the keyframe information correctly. The code is as below: When reading back the keyframes, the keyframe count is correct but keyframe times (e.g. 0, 47, 207, 207, 207, ...) and tangent values are wrong. The used methods don't return any errors.
id<FxKeyframeAPI> keyframeApi = [apiManager apiForProtocol:@protocol(FxKeyframeAPI)]; FxKeyframeInfo info = {kFxKeyframeInfo_CurrentVersion, 0, kFxKeyframeStyle_Constant, 0, 0, 0, 0}; NSError *error = nil; NSUInteger i, count = 0;
// remove all keyframes error = [keyframeApi removeAllKeyframesForParam: paramID andChannel: 0];
// set some keyframes first FxInitKeyframeInfo (info); info.style = kFxKeyframeStyle_Constant; info.inTangentX = 1.0; info.inTangentY = 1.0; info.outTangentX = 1.0; info.outTangentY = 1.0;
for (i = 0; i<100; i+= 10) { info.time = (double)i; error = [keyframeApi addKeyframe: info toParam: paramID andChannel: 0]; }
// now read the keyframes error = [keyframeApi keyframeCount: &count forParam: paramID andChannel: 0]; for (i=0; i<count; i++) { FxInitKeyframeInfo (info); error = [keyframeApi keyframeInfo: &info forParam: paramID channel: 0 andIndex: i]; NSLog (@"time: %d", (int)info.time); }
The other issue: When trying to navigate to these keyframes by pressing the previous/next keyframe buttons in the parameter panel, the play head does not always jump to the correct time but may be off by up to 4 frames.
Are these problems already known, and is there any workaround?
Regards, Eberhard |