Trouble with Batch Render Script

n5zq wrote on 4/20/2003, 11:57 PM
I wrote a script a couple of months ago, based on the Batch Render GUI script, which allows the user to batch render multiple project files to multiple formats. The script can be found here

A problem has cropped up since version 4.0b was released. I now get the error "Error: Object reference not set to an instance of an object" when the script is run. I have found the line of code causing the problem, but am having trouble fixing it.

In the BatchRenderDialog function in the BatchRenderDialog class the line of code causing the problem is:
FillTemplateTree();

That is the call to the class member function that finds all of the templates and creates the tree.

Thank you in advance for the help.
Steven

Comments

n5zq wrote on 4/21/2003, 12:09 AM
I did a little more investigating and have determined the exact line in the FillTemplateTree function.

function FillTemplateTree() {
var renderers = new Enumerator(Vegas.Renderers);
while (!renderers.atEnd()) {
var renderer = renderers.item();
var rendererNode = new TreeNode(renderer.FileTypeName);
rendererNode.Tag = renderer;
templateTree.Nodes.Add(rendererNode);
var templates = new Enumerator(renderer.Templates);
while (!templates.atEnd()) {
var template = templates.item();
--->>>The following line is causing the problem
var templateNode = new TreeNode(template.Name);

var tag = new Object();
tag.renderer = renderer;
tag.template = template;
templateNode.Tag = tag;
rendererNode.Nodes.Add(templateNode);
templates.moveNext();
}
renderers.moveNext();
}
}

Thanks again for the help.
Steven
roger_74 wrote on 4/21/2003, 4:07 AM
It's the frameserver plugin that breaks it. It told Satish about it in the Vegas Video forum but he has not responded.
n5zq wrote on 4/21/2003, 7:40 AM
You are absolutely right. Hopefully he will fix his plugin quickly. It is a big problem to break other peoples code.

Thanks for the info.
satish wrote on 4/21/2003, 11:50 PM
The frameserver does not "break" anybody's code... if you see closely it still has a default template while rendering. I guess it is just a bug in the script engine's enumerating level (nothing to do with the FS directly) anyway i'll look at it.

Thanks
aboukirev wrote on 4/22/2003, 9:31 AM
I recently discovered that Vegas 4.0b seems to return the parent object upon first iteration of Enumerator when I enumerate bins in MediaPool. It is possible that you have similar situation, i.e. the first "template" is not template at all. Try to add a check
if (template instanceof RenderTemplate) {
...
}
and skip item otherwise. That at least will make your code more robust.

Alexei
n5zq wrote on 4/22/2003, 6:02 PM
I am more than willing to help you test if you would like.
satish wrote on 4/22/2003, 10:30 PM
Thanks, i will be trying to reproduce and will contact you/post for you here when i start doing that.
satish wrote on 4/23/2003, 5:00 PM
I have this problem fixed, and the fix will be available in the next release of PluginPac FS.
n5zq wrote on 4/25/2003, 12:57 AM
Thank you very much!! I have tested and all is well.