Page 1 of 1
Adding additional output modules...
Posted: February 21st, 2009, 9:16 pm
by vfxman
Adding additional output modules without using
Code: Select all
executeCommand(app.findMenuCommandId("Add Output Module"));
I am able to access OM 2 and change it like this...
Code: Select all
curItem.outputModule(2).applyTemplate(templateName);
...but obviously only when OM index 2 exists to begin with. I was trying to add a second OM via:
but I'm not figuring out the syntax for that. Is that even possible? Would I need to loop through the OM's first?
Re: Adding additional output modules...
Posted: February 22nd, 2009, 4:20 am
by Paul Tuersley
Here's an example that should help:
Code: Select all
{
var activeItem = app.project.activeItem;
// make sure a comp is selected
if (activeItem != null && activeItem instanceof CompItem) {
// if there is one, grab the first existing render queue item
if (app.project.renderQueue.numItems != 0) {
var RQitem = app.project.renderQueue.item(1);
} else {
// othewise create a new one from the selected comp
var RQitem = app.project.renderQueue.items.add(activeItem);
}
// grab the first output module
var OMitem1 = RQitem.outputModules[1];
// if there is only one output module, add another one
if (RQitem.outputModules.length > 1) {
var OMitem2 = RQitem.outputModules[2];
} else {
var OMitem2 = RQitem.outputModules.add();
}
// apply templates
RQitem.applyTemplate("Draft Settings");
OMitem1.applyTemplate("Photoshop");
OMitem2.applyTemplate("Alpha Only");
}
}
Re: Adding additional output modules...
Posted: February 22nd, 2009, 8:25 pm
by vfxman
Thanks Paul, works great. I modified it a little more so it loops through all items in render queue and changes them, which is what I will end up needing for a project next week. As always I appreciate the help.
Here's the new code:
Code: Select all
{
var activeItem = app.project.activeItem;
// make sure a comp is selected
if (activeItem != null && activeItem instanceof CompItem) {
// if there is one, grab the first existing render queue item
if (app.project.renderQueue.numItems != 0) {
var existingRQ = app.project.renderQueue.numItems;
for (a = 1; a <= existingRQ; a++) {
var curItem = app.project.renderQueue.item(a);
if (curItem.status == RQItemStatus.QUEUED) {
// if there is only one output module, add another one
if (curItem.outputModules.length > 1) {
var OMitem2 = curItem.outputModules[2];
} else {
var OMitem2 = curItem.outputModules.add();
}
var OMitem1 = curItem.outputModules[1];
// apply templates
curItem.applyTemplate("Best Settings");
OMitem1.applyTemplate("RGB");
OMitem2.applyTemplate("Alpha Only");
}
}
}
}
}