ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How to remove child content from shape layers massively

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ánfer Chávez
How to remove child content from shape layers massively
on Mar 3, 2018 at 6:21:14 pm

I'm working with a lot of .ai files converted into shape layers. In this convertion, After Effects creates additional sub-groups for each element/group inside the layer which I want to get rid of. Also it creates a Merge Paths feature that I want to remove as well. I just found this script that removes all "ADBE Vector Graphics - Fills" for a given selected layer, so I'm wondering how to tell the script that look for Merge Paths and this sub-groups.

// handler : g should be a property group that can be added to a shape (empty group / path /stroke / fill / trim path etc)
function myHandler(g){
if (g.matchName === "ADBE Vector Graphic - Fill") g.remove();

// main function : g is expected to be a shape layer or a shape group (shape "sublayer")
// handler : what to do with the addable content of g
// recursive, and recurses backwards, in case some children are removed...
// doesnt scout the transform group, only addable things
function scoutContent(g, handler){
var n, child;
if (!g.content) return;
g = g.content;
for (n=g.numProperties; n>0; n--){
child =;
if (Object.isValid(child) && child.content) scoutContent(child, handler);

scoutContent(app.project.activeItem.selectedLayers[0], myHandler);

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 All Rights Reserved