ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Re: Remove all fills in a shape layer?

COW Forums : Adobe After Effects Expressions

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Respond to this post   •   Return to posts index   •   Read entire thread


John Colombo
Re: Remove all fills in a shape layer?
on Nov 8, 2016 at 12:26:14 am
Last Edited By John Colombo on Nov 11, 2016 at 8:14:13 am

Give this one a try! I was looking for the same feature to quickly remove fills. With that in mind, I took some snippets from Miguel's code and made it loop through all the selected layers.

This script will toggle the fills without removing them.

Also, holding Alt (or Option) will toggle strokes instead of fills. Watch out for the "<=" in the second for(){} loop, the code box seems to mess it up.

Cheers!

// Define variables
app.beginUndoGroup("Remove Fill on Shape Layer");
var myComp = app.project.activeItem;
var myLayer = myComp.selectedLayers;
var myKeyState = ScriptUI.environment.keyboardState;

try {

for (var i=0;i<myLayer.length;i++){

if (myLayer[i] instanceof ShapeLayer){

//alert("This is a shape");
var contents = myLayer[i].property("ADBE Root Vectors Group");

for(s = 1; s <= contents.numProperties ; s++){
var shape = contents.property(s).property("Contents");
if (myKeyState.altKey == true){
if(shape.property("ADBE Vector Graphic - Stroke").active == false){
shape.property("ADBE Vector Graphic - Stroke").enabled = true;
}else{shape.property("ADBE Vector Graphic - Stroke").enabled = false}
}else{
if(shape.property("ADBE Vector Graphic - Fill").active == false){
shape.property("ADBE Vector Graphic - Fill").enabled = true;
}else{shape.property("ADBE Vector Graphic - Fill").enabled = false;}
}
}
}else{

continue //skip non-shape layers
}
}
}catch(err){
alert(err.line + "n" + err.toString());
}
app.endUndoGroup();
app.activeViewer.setActive();


John Colombo
Lead Creator
1Resonant Creation
http://www.1resonant.com


Posts IndexRead Thread 


Current Message Thread:





© 2019 CreativeCOW.net All Rights Reserved
[TOP]