Creating an OFXStringKeyframe in Vegas Pro 14.0?

Jeremy-Greco wrote on 1/27/2021, 9:55 PM

I'm trying to write a script that will add keyframes to the text animation of a generated text video. (It Doesn't need to add text to them, just the keyframes so I can go back and add the appropriate text more easily) and I found the Keyframes property of the OfxStringParameter property with the name "Text" which seems to be the collection I need to add to - showing a count of the Keyframes in a video file I'd already messed with gave me the number I expected. However, I can't seem to create an OFXStringKeyframe class to add to it. Can anyone help me here?

Comments

Jeremy-Greco wrote on 1/28/2021, 8:32 AM

I got the answer from Edward at JetDV. You don't manually create a new KeyFrame, you call SetValueAtTime on the Parameter. Here's the e-mail he sent me:

 

Adding keyframes should be pretty straightforward. Try something like this:

--------------------------------------------------------------------------

OFXStringParameter p5 = (OFXStringParameter)ofx[Parameter]; //your string parameter

p5.IsAnimated = true; //You must make sure this parameter can be keyframed! This line is critical.

Timecode tc = new Timecode("00:00:01:00"); //timecode for the keyframe
string oc = "My new string"; //the new value
p5.SetValueAtTime(tc, oc); //create the new keyframe at the time tc with the value oc


--------------------------------------------------------------------------

Then you can access each of the individual keyframes with p5.Keyframes[i] changing "i" for the number of each keyframe (naturally "0" is the first keyframe)

All of the OFX parameter types behave this exact same way. The only difference would be the OFX parameter type (for example, OFXBooleanParameter), and then change the "oc" type to that type (using OFXBooleanParameter, it would be "Boolean"). The rest of the process is exactly the same.

jetdv wrote on 1/28/2021, 3:51 PM

Glad I could help. The rest of your questions have been answered as well!