-
Light to each layer selected
Hello, id like to parent a ¨Light¨ to each layer selected for now i am using this script https://aescripts.com/add-parented-null-to-selected-layers/
Which adds a null object. is There any way i could modify the contents of it so instead of a null it creates a light.
This are the contents of it
// Add Parented Null to Each Selected Layer.jsx
// ©July 2009 Lloyd Alvarez https://aescripts.com
//
// Creates a new parented Null for every one of the selected layers.
// You can define what the Suffix name for the null layer is in the user variables below.
// If you want to include the layer name in the Adj Layer set the variable to 1.
// To not include the layer name set the variable to 0.
// *****Note that in CS3 and below After Effects has a 31 character limit for layer names so the name of the
// Null will be truncated to the first 31 characters ********
// CS4 does not have a character limit for layers.
//
// version history
// 1.51 fixed "set value" bug Sep 2011
// 1.5 Checks to see if layer is 3D or parented and sets null at the same position and make it 3D if necessary. Sep 2011
// 1.0 Initial release. Jul 2009
//
//////////////////////////////////////////////////////////////////////
//
// USER VARIABLES:
//
var nullSuffix = "-Null";
var addLayerNameBeforeSuffix = 1; // 1 for yes, 0 for no
//
//
//////////////////////////////////////////////////////////////////////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;
var saveIn = 0;
var saveOut = 0;
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;
saveName = (addLayerNameBeforeSuffix) ? currentLayer.name+nullSuffix : nullSuffix;var myName = (parseFloat(app.version) < 8.0) ? saveName.substring(0, 31) : saveName;
var newNull = myComp.layers.addNull(myComp.duration);
if (currentLayer.threeDLayer) newNull.threeDLayer = true;
var tempParent = null;
if (currentLayer.parent != null) {
tempParent = currentLayer.parent;
var tempLayer = currentLayer.duplicate();
tempLayer.parent = null;
newNull.transform.position.setValue(tempLayer.transform.position.value);
//newNull.transform.scale.setValue(tempLayer.transform.scale.value);
if (tempLayer.threeDLayer) {newNull.transform.xRotation.setValue(tempLayer.transform.xRotation.value);
newNull.transform.yRotation.setValue(tempLayer.transform.yRotation.value);
newNull.transform.zRotation.setValue(tempLayer.transform.zRotation.value);
} else {
newNull.transform.rotation.setValue(tempLayer.transform.rotation.value);
}
tempLayer.remove();
} else {
newNull.transform.position.setValue(currentLayer.transform.position.value);
//newNull.transform.scale.setValue(currentLayer.transform.scale.value);
if (currentLayer.threeDLayer) {
newNull.transform.orientation.setValue(currentLayer.transform.orientation.value);
newNull.transform.xRotation.setValue(currentLayer.transform.xRotation.value);
newNull.transform.yRotation.setValue(currentLayer.transform.yRotation.value);
newNull.transform.zRotation.setValue(currentLayer.transform.zRotation.value);
} else {
newNull.rotation.setValue(currentLayer.transform.rotation.value);
}
}
if (tempParent != null) newNull.parent = tempParent;
newNull.moveBefore(myLayers[i]);
newNull.inPoint = saveIn
newNull.outPoint = saveOut;
currentLayer.parent = newNull;
newNull.name = myName;
}app.endUndoGroup();
} else {
alert("Please select an active comp to use this script");
}
}
else
{
alert("Please open a project first to use this script.");
}