后效 - 通过脚本选择渲染队列项

时间:2016-06-23 11:09:16

标签: queue render after-effects

我正在寻找一种通过脚本在渲染队列中选择项目的方法。 我正在创建一个包含所有RQ项目的listBox(我需要以比RQ窗口更简单的方式列出它们,并且我保留每个项目的索引号),我想从中选择列出项目并在RQ中选择它们。 想法?
感谢

德罗尔



try{  
       
function createUserInterface (thisObj,userInterfaceString,scriptName){  
            var pal = (thisObj instanceof Panel) ? thisObj : new Window("palette", scriptName,  
                                        undefined,{resizeable: true});  
            if (pal == null) return pal;  
              
            var UI=pal.add(userInterfaceString);  
              
            pal.layout.layout(true);  
            pal.layout.resize();  
            pal.onResizing = pal.onResize = function () {  
                                                            this.layout.resize();  
                                                            }  
            if ((pal != null) && (pal instanceof Window)) {  
                    pal.show();  
            }  
    return UI;  
};  
  
  
  
  
  
  
{var res ="group {orientation:'column',\  
                                    alignment:['fill','fill'],\  
                                    alignChildren:['fill','top'],\  
                                    folderPathListbox:ListBox{\  
                                                        alignment:['fill','fill'],\  
                                                        properties:{\  
                                                        multiline:true,\  
                                                        multiselect:true,\  
                                                        numberOfColumns:6,\  
                                                        showHeaders:true,\  
                                                        columnTitles: ['#','OM','Date','Time', 'Comp Name', 'Render Path']}\  
                                                        },\  
                                    buttonGroup:Group{orientation:'row',\  
                                                            alignment:['fill','bottom']\  
                                                            alignChildren:['fill','bottom'],\  
                                                            buttonPanel: Panel{\  
                                                                                    text:'Actions',\  
                                                                                    orientation: 'row',\  
                                                                                     alignment:['fill','bottom']\  
                                                                                    refButton: Button{text:'Refresh'}\  
                                                                                    dupButton: Button{text:'Duplicate'}\  
                                                                                    selButton: Button{text:'Select in RQ'}\  
                                                                                    expButton: Button{text:'Export'}\  
                                                                                }\  
                                                            searchPanel: Panel{\  
                                                                                    text:'Search',\  
                                                                                    orientation: 'row',\  
                                                                                    searchBox: EditText{text:'search by fileName'},\  
                                                                                    searchButton: Button{text:'Search'},    \  
                                                                                }\  
                                                            }\  
                    }";  
                          
}  
function listRQ (rqList){  
    try{  
            var folderPathListbox = rqList;  
            var proj = app.project;  
            var totalRenderQ = proj.renderQueue.numItems;  
            for(var i= 1; i<=totalRenderQ;  i++){  
                    var totalOM= proj.renderQueue.item(i).numOutputModules;  
                     for (var om= 1; om<=totalOM; om++){  
                                    var dateList, timeList, curItem;  
                                    if (proj.renderQueue.item(i).startTime != null){  
                                                var min = proj.renderQueue.item(i).startTime.getMinutes() <10 ? "0"+ proj.renderQueue.item(i).startTime.getMinutes() : proj.renderQueue.item(i).startTime.getMinutes();  
                                                var year = proj.renderQueue.item(i).startTime.getFullYear().toString().substr (-2,2);  
                                                timeList = (proj.renderQueue.item(i).startTime.getHours()-1)+":" + min;   
                                                dateList =proj.renderQueue.item(i).startTime.getDate()+"/"+(proj.renderQueue.item(i).startTime.getMonth()+1)+"/"+year ;  
                                    }else{        
                                            dateList = "not ";  
                                            timeList = "rendered";  
                                        }  
                                    curItem = folderPathListbox.add ('item', i );                              // Column 1  
                                    curItem.subItems[0].text = om;                                               // Column 2  
                                    curItem.subItems[1].text = dateList.toString();                          // Column 3  
                                    curItem.subItems[2].text = timeList.toString();                          // Column 4  
                                    curItem.subItems[3].text = proj.renderQueue.item(i).comp.name; // Column 5  
                                    curItem.subItems[4].text = proj.renderQueue.item(i).outputModule(om).file.toString().replace(new RegExp(",","g"), "\r").replace(new RegExp("%20","g"), " ").replace(new RegExp("%5B","g"), "[").replace(new RegExp("%5D","g"), "]"); // Column 6      
                                }  
            }  
          }catch(err){alert(err)}  
    return folderPathListbox;  
    }  
  
  
var UI = createUserInterface(this,res,"Better RQ");  
var myList = UI.folderPathListbox;  
var lsRq = listRQ(myList);  
//~ alert(lsRq.toString());  
  
  
{ // buttons action  
UI.buttonGroup.buttonPanel.refButton.onClick = function () {  
                                                    lsRq.removeAll();  
                                                    listRQ(myList);  
                                                    writeLn("all done");  
                                                    }  
UI.buttonGroup.buttonPanel.dupButton.onClick = function () {  
                                                    var lstSlct = new Array ;  
                                                    lstSlct = myList.selection;  
                                                    if ( lstSlct != null){  
                                                        var totalDup = lstSlct.length;  
                                                        for (var i= 0; i<totalDup;  i++){  
                                                                var lsId = lstSlct[i].toString();  
                                                                var dup =  parseInt(lsId);  
                                                                app.project.renderQueue.item(dup).duplicate();  
                                                                writeLn("duplicated #"+dup);  
                                                            }     
                                                    }else{  
                                                        alert ("select Something");     
                                                     }  
                                                      
                                                    }  
UI.buttonGroup.buttonPanel.selButton.onClick = function () {  
                                                                        app.project.renderQueue.showWindow(true) ; //shows the RQ  
                                                                        alert ("selButton");  
    }  
UI.buttonGroup.buttonPanel.expButton.onClick = function () {  
                                                                                       // var  compName = myList.                         
                                                                                        alert ("expButton");  
    }  
}  
  
  
  
  
}  
catch(err){   
    alert ("Error at line # " + err.line.toString() + "\r" + err.toString());  
    }  
&#13;
&#13;
&#13;

0 个答案:

没有答案