Highlighted

How to add mask by plugin?

New Here ,
Aug 02, 2020

Copy link to clipboard

Copied

Hello, I am a newer to AE. I have some problem with plugin development.

I want to add masks by plugin. Just like Brush Tool, it has a independent  timeline and can be adjusted in every frame.  How to implement it by cpp code?

not sure what you want to do but if it helps this is a function to create a mask

 

 

 

 

 

// a= project item, b= layer
// c, vertice 1, x d= vertice 1 y= vertice 2 x, f= vertice 2 y g= vetrice 3 x, h= vertice 3 y, i = veirtice 4 x , j = vertice 4y
// h= feather

function mask_2(a346,b346,c346,d346,e346,f346,g346,h346,i346,j346){


var x346 = app.project.item(a346).layer(b346);
newMask346 = x346.Masks.addProperty("Mask");
myMaskShape346 = newMask346.property("maskShape");
myShape346 = myMaskShape346.value;
myShape346.vertices = [[c346,d346],[e346,f346],[g346,h346],[i346,j346]];
myShape346.closed = true;
myMaskShape346.setValue(myShape346);
app.project.item(a346).layer(b346).property("Masks").property(1).property("Mask Feather").setValueAtTime([0], [h346/10,h346/10]);


}


mask_2(2,2,100,100,200,100,200,200,100,200,20)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Topics

How to, Scripting, SDK, User interface or workspaces

Views

38

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to add mask by plugin?

New Here ,
Aug 02, 2020

Copy link to clipboard

Copied

Hello, I am a newer to AE. I have some problem with plugin development.

I want to add masks by plugin. Just like Brush Tool, it has a independent  timeline and can be adjusted in every frame.  How to implement it by cpp code?

not sure what you want to do but if it helps this is a function to create a mask

 

 

 

 

 

// a= project item, b= layer
// c, vertice 1, x d= vertice 1 y= vertice 2 x, f= vertice 2 y g= vetrice 3 x, h= vertice 3 y, i = veirtice 4 x , j = vertice 4y
// h= feather

function mask_2(a346,b346,c346,d346,e346,f346,g346,h346,i346,j346){


var x346 = app.project.item(a346).layer(b346);
newMask346 = x346.Masks.addProperty("Mask");
myMaskShape346 = newMask346.property("maskShape");
myShape346 = myMaskShape346.value;
myShape346.vertices = [[c346,d346],[e346,f346],[g346,h346],[i346,j346]];
myShape346.closed = true;
myMaskShape346.setValue(myShape346);
app.project.item(a346).layer(b346).property("Masks").property(1).property("Mask Feather").setValueAtTime([0], [h346/10,h346/10]);


}


mask_2(2,2,100,100,200,100,200,200,100,200,20)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Topics

How to, Scripting, SDK, User interface or workspaces

Views

39

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Aug 02, 2020

Copy link to clipboard

Copied

not sure what you want to do but if it helps this is a function to create a mask

 

 

 

 

 

// a= project item, b= layer
// c, vertice 1, x d= vertice 1 y= vertice 2 x, f= vertice 2 y g= vetrice 3 x, h= vertice 3 y, i = veirtice 4 x , j = vertice 4y
// h= feather

function mask_2(a346,b346,c346,d346,e346,f346,g346,h346,i346,j346){


var x346 = app.project.item(a346).layer(b346);
newMask346 = x346.Masks.addProperty("Mask");
myMaskShape346 = newMask346.property("maskShape");
myShape346 = myMaskShape346.value;
myShape346.vertices = [[c346,d346],[e346,f346],[g346,h346],[i346,j346]];
myShape346.closed = true;
myMaskShape346.setValue(myShape346);
app.project.item(a346).layer(b346).property("Masks").property(1).property("Mask Feather").setValueAtTime([0], [h346/10,h346/10]);


}


mask_2(2,2,100,100,200,100,200,200,100,200,20)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Aug 03, 2020

Copy link to clipboard

Copied

Thank you for answer. I have found the solution.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...