ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` // Add Parented Null to Selected Layers.jsx // ©July 2009 Lloyd Alvarez http://aescripts.com // // Creates a parented null for the selected layers. // // // var proj = app.project; var undoStr = "Add Parented Null to Selected Layers"; if (proj){ var myComp = app.project.activeItem; if (myComp != null && (myComp instanceof CompItem)){ app.beginUndoGroup(undoStr); var myLayers = myComp.selectedLayers; if (myLayers.length != 0) { var saveIn = myComp.duration; var saveOut = 0; var saveIndex = myComp.numLayers; var newInpoint=myComp.duration, newOutpoint=0, myIndex=myComp.numLayers; var newNull = myComp.layers.addNull(myComp.duration); for (i=0; i <= myLayers.length-1; i++){ currentLayer = myLayers[i]; saveIn = (currentLayer.stretch < 0) ? currentLayer.outPoint : currentLayer.inPoint; saveOut = (currentLayer.stretch < 0) ? currentLayer.inPoint : currentLayer.outPoint; saveIndex = currentLayer.index; if (saveIn < newInpoint) {newInpoint = saveIn} if (saveOut > newOutpoint) {newOutpoint = saveOut} if (saveIndex < myIndex) {myIndex = saveIndex} currentLayer.parent = newNull; } newNull.moveBefore(myComp.layer(myIndex)); newNull.inPoint = newInpoint; newNull.outPoint = newOutpoint; app.endUndoGroup(); } else { alert("Please select at least one layer"); } } else { alert("Please select an active comp to use this script"); } } else { alert("Please open a project first to use this script."); } ```