Dear Vegas Pro scripters,
I'm working on a C# script that takes the labels of regions and adds a Titler Pro title for each region.
So far it successfully adds a new video track, adds events in the correct places and also the generated media. The problem is the final step of the configuration.
The "CustomData" parameter contains the TitlerPro XML configuration of the title. The script extracts this into an XML document and replaces the necessary parts of the configuration. At this point it attempts to assign the XML back to the CustomData parameter:
The first message box contains the correct XML as I expect it to be created. After assigning it to the custo.Value and then displaying that content, the value is truncated.
Is this a problem:
a) in my code (do I need to allocate memory differently or assign the value in a different way?)
b) something controlled by the parameters in Vegas Pro?
c) Titler Pro 3 or 4 behaviour on notification that this parameter is modified?
I am new to C#, but experienced at programming in other languages.
Thank you for your time in advance!
System: Windows 10 64-Bit, Vegas Pro 13 Build 453 64-Bit, NewBlueFX TitlerPro3 OpenFX.
I'm working on a C# script that takes the labels of regions and adds a Titler Pro title for each region.
So far it successfully adds a new video track, adds events in the correct places and also the generated media. The problem is the final step of the configuration.
The "CustomData" parameter contains the TitlerPro XML configuration of the title. The script extracts this into an XML document and replaces the necessary parts of the configuration. At this point it attempts to assign the XML back to the CustomData parameter:
PlugInNode pluginNB3 = myVegas.Generators.FindChildByName("NewBlue Titler Pro 3 - OpenFX");
// Creation of Media item performed here.
Media item = new Media(pluginNB3);
OFXEffect effect = item.Generator.OFXEffect;
OFXCustomParameter custo = effect.FindParameterByName("CustomData") as OFXCustomParameter;
XmlDocument custoDoc = new XmlDocument();
custoDoc.LoadXml(custo.Value);
XmlNode custoTitleNode = custoDoc.SelectSingleNode("/title");
// Customisation of XML code omitted here, but functions as expected.
StringBuilder sb = new StringBuilder(300000);
using (StringWriter sw = new StringWriter(sb))
{
XmlWriterSettings xmlSettings = new XmlWriterSettings();
xmlSettings.Encoding = Encoding.ASCII;
xmlSettings.OmitXmlDeclaration = true;
xmlSettings.WriteEndDocumentOnClose = true;
xmlSettings.Indent = true;
xmlSettings.Async = false;
xmlSettings.CheckCharacters = true;
using (XmlWriter tx = XmlWriter.Create(sw, xmlSettings))
{
custoTitleNode.WriteTo(tx);
}
string xmlString = sw.ToString();
MessageBox.Show("producedXml: " + xmlString); // XML String is complete and contains all expected content.
custo.Value = xmlString;
MessageBox.Show("After asignment: " + custo.Value); // XML String is truncated, normally the same length by varies within about 10 characters.
}
The first message box contains the correct XML as I expect it to be created. After assigning it to the custo.Value and then displaying that content, the value is truncated.
Is this a problem:
a) in my code (do I need to allocate memory differently or assign the value in a different way?)
b) something controlled by the parameters in Vegas Pro?
c) Titler Pro 3 or 4 behaviour on notification that this parameter is modified?
I am new to C#, but experienced at programming in other languages.
Thank you for your time in advance!
System: Windows 10 64-Bit, Vegas Pro 13 Build 453 64-Bit, NewBlueFX TitlerPro3 OpenFX.