ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Scripting - how to copy a mask shape?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
James Primhak
Scripting - how to copy a mask shape?
on Nov 4, 2010 at 3:32:20 pm

Hi guys,

I am trying to write a script to copy masks from one solid to several other newly created solids. I have read Dan's tutorials on scripting and found them really useful, and have tried to get to grips with the AE Scripting Guide, but this is something I am really struggling with. How would you simply copy the mask shape of one mask to a mask on another solid?

I know this is probably very elementary, but I've been surprised at how little information there is on the internet regarding scripting. Are there any other sources of info/tutorials anyone recommends?

Thanks in advance,

Jim


Return to posts index

Dan Ebberts
Re: Scripting - how to copy a mask shape?
on Nov 4, 2010 at 9:07:42 pm

Try this:

var myComp = app.project.activeItem;

var mySourceLayer = myComp.layer("Source");
var myPath = mySourceLayer.property("Masks").property("Mask 1").property("Mask Path");
var myShape = myPath.value;

var myDestLayer = myComp.layer("Dest");
var myNewMask = myDestLayer.property("Masks").addProperty("Mask");
var myNewPath = myNewMask.property("Mask Path");
myNewPath.setValue(myShape);


Dan



Return to posts index

James Primhak
Re: Scripting - how to copy a mask shape?
on Nov 5, 2010 at 2:18:01 pm

Cheers Dan, that's awesome. I was on the right track, but I was doing a couple of things wrong. Your post has helped a lot. Thanks again.

Jim



Return to posts index


Robert Szilagyi
Re: Scripting - how to copy a mask shape?
on Jul 13, 2017 at 3:15:27 pm

Hi Dan,

Is there a similar method, to delete all masks from a given layer?

thanks!
robert


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]