How to Create a New OFXChoice Class?

william-j wrote on 10/5/2021, 12:08 PM

I want to use the script to change a choice parameter of an OFXEffect. But it seems that I cannot construct an OFXChoice Class, I can only use the exist OFXChoice instances and read them. The OFXChoice Class just gives the Name and the Index of it, and they are read-only. I cannot change them. If I want to create a new OFXChoiceParameter Class, the only way is to get a OFXChoice instances, but I cannot create it.

Comments

jetdv wrote on 10/5/2021, 4:06 PM

Yes, you can change which "choice" is chosen in a script. Please take a look here:

http://www.jetdv.com/2021/09/20/adjust-generated-media-parameters-in-vegas-pro-using-titles-and-text-as-an-example/

This might also help.

OFXChoiceParameter p3 = (OFXChoiceParameter)ofx[Parameter];
OFXChoice oc;
oc = p3.Choices[choiceIndex];
if (oc != null)
    p3.Value = oc;

And here's the example used in the tutorial above:

OFXChoiceParameter anchorPoint = (OFXChoiceParameter)fxo.FindParameterByName("Alignment");
anchorPoint.Value = anchorPoint.Choices[0]; //Top Left

 

william-j wrote on 10/6/2021, 11:10 AM

Yes, you can change which "choice" is chosen in a script. Please take a look here:

http://www.jetdv.com/2021/09/20/adjust-generated-media-parameters-in-vegas-pro-using-titles-and-text-as-an-example/

This might also help.

OFXChoiceParameter p3 = (OFXChoiceParameter)ofx[Parameter];
OFXChoice oc;
oc = p3.Choices[choiceIndex];
if (oc != null)
    p3.Value = oc;

And here's the example used in the tutorial above:

OFXChoiceParameter anchorPoint = (OFXChoiceParameter)fxo.FindParameterByName("Alignment");
anchorPoint.Value = anchorPoint.Choices[0]; //Top Left

 

Thanks, so actually there are a lot of public methods that are not mentioned in the Vegas Scripting API Manual.

As an aside, last time I want to change the time stretch and pitch shift method of audio events, the manual does not mention that it can be modified. However, the manual gives a "TimeStretchPitchShift Enumeration" and is not used anywhere. Finally I found that it can be modified by `AudioEvent.Method`.