Last active
August 20, 2022 06:42
-
-
Save aescripts/d3600be6ba22cb53138a4477684998e4 to your computer and use it in GitHub Desktop.
#AfterEffects #Script #KBar #AutoTrace Auto Traces and copies the masks from the layer above
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
AutoTrace and copy Masks from Layer Above.jsx | |
By Lloyd Alvarez https://aescripts.com/ | |
Selects the layer above | |
Invokes Auto-Trace... | |
Copies the masks to the layer below | |
Deletes the layer above | |
*/ | |
try{ | |
app.beginUndoGroup("Auto-trace and copy masks from Layer Above"); | |
var myComp = app.project.activeItem; | |
var myLayer = myComp.selectedLayers[0]; | |
var layerAbove = myComp.layer(myLayer.index-1); | |
layerAbove.selected = true; | |
myLayer.selected = false; | |
app.executeCommand(app.findMenuCommandId("Auto-trace...")); | |
for (var j=1; j<= layerAbove.property("Masks").numProperties; j++) { //loop through the parent properties | |
if (layerAbove.property("Masks").property(j).hasOwnProperty("Mask Path")) { | |
var myPath = layerAbove.property("Masks").property(j).property("Mask Path"); | |
var myShape = myPath.value; | |
var myNewMask = myLayer.property("Masks").addProperty("Mask"); | |
var myNewPath = myNewMask.property("Mask Path"); | |
myNewPath.setValue(myShape); | |
} | |
} | |
layerAbove.remove(); | |
app.endUndoGroup(); | |
} | |
catch (e) { | |
alert(e.toString()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much for your help:)
Is it Possible to not have this message?