Quick Shape Layer Navigation

You have a simple problem: a Shape Layer in your comp has many, many Groups. Maybe you imported an Illustrator file and converted it to Shapes, hoping to get access to the path for that one squircle because a rounded rectangle will not do. You just need to be able to track that shape down. Everything’s overlapped, so there no way of just clicking on that squircle. Those full-comp-size paths that AE adds when it can’t deal with Illustrator styling… they’re all in the way. What a nightmare. You just need to be able to navigate the groups like you do with layers. And, obviously, Adobe didn’t build in a command/control + up or command/control + down equivalent keyboard shortcut to step through Shape Groups because of course it didn’t.

Sure, there are probably big, all-in-one Shape Layer utility scripts you can buy that probably have this functionality built-in. You may already own one. Do you remember which tab it’s in? Uh oh. Did you not configure the bar with those buttons? How could you not? How do you do that? Go back to the product page for the documentation. (Sorry. That was salty.)

You just need a quick way to click through the groups to find that squircle. The need is simple. You’re not looking to navigate a hierarchy– you’re not diving down to children folders. You’re not editing the fill opacity of every shape. You’re not adding a Polystar with 10 points to every group. (How did you ever get by without that 10-point Polystar button?) You just need to step through the top-level groups. The Composition window gives you the visual feedback to know when you’ve found the right group. Up and down buttons. That’s all you need. Simple.

  function navShapeGroups(dir){
    var prop = app.project.activeItem.selectedProperties;
    if (prop.length == 1) {
      var p = prop[0];
      if (p.matchName == "ADBE Vector Group"){
        var ind = p.propertyIndex;
        var parGroup = p.propertyGroup(1);
        if (dir == -1 && ind > 1) {
          p.selected = false;
          parGroup.property(ind + dir).selected = true;
        if (dir == 1 && ind < parGroup.numProperties){
          p.selected = false;
          parGroup.property(ind + dir).selected = true;
  function myScript(thisObj) {
    function myScript_buildUI(thisObj) {
      var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "sm_quickShapeLayerNav", [0, 0, 50, 50]);
      res = "group{orientation:'column', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'], spacing:2,\
              upButton: Button{text:'⯅'},\
              downButton: Button{text:'⯆'},\
      // Adds resource string to panel
      myPanel.grp = myPanel.add(res);
      // Assign function to UI elements
      myPanel.grp.upButton.onClick = function(){
      myPanel.grp.downButton.onClick = function(){
      // Setup panel sizing and make panel resizable
      //myPanel.grp.minimumSize = myPanel.grp.size;
      myPanel.onResizing = myPanel.onResize = function () {this.layout.resize();}
      return myPanel;
    // Build script panel
    var myScriptPal = myScript_buildUI(thisObj);
    if ((myScriptPal != null) && (myScriptPal instanceof Window)) {
 // Execute script

I won’t go into too much detail about the specifics, but I’m leaning heavily on propertyGroup() attribute to access Shape Groups located before and after the current selected Group (the siblings). (And yes. You could use parentProperty in this example, in place of propertyGroup(1).)

shape layer navigation script demo
Up and down. Is that too much to ask?

There are definitely ways to improve/augment this script. For example, I’ve forced the script to only work when one Shape Group is selected– to make my boundary checking more simple (the cases where we’ve reached the bottom Group or top Group).

For my particular use case, this script doesn’t need to do anything differently. It’s a script that works for me. I don’t have error checks that you’d expect to find in a script you’d buy or download. It only works when the golden path is appeased. There are no alerts to tell me what I’m doing wrong. It works correctly or it doesn’t work at all.

The point of scripting this way is self-reliance. You know more than anyone how you work. The things you need to automate are uniquely your own. Learn to script in a lean way. Get more things done. The pressure to think through every possible scenario– and each escape plan for all of the ways your script can go wrong– is real. It’s real because scripting is programming. There’s a way to script that is messy and fast, though. A way that will leave you with a folder full of shamefully sloppy, hard-coded scripts that… like… set the radius of the third instance on a Circle Effect on every layer to the x-scale of the layer above…. or jam a padded-number prefix onto every layers’ name based on the distance away from the “nucleus” layer. Once you need to operate on more than 10 layers, you should really see what you can accomplish with a script. And don’t worry about the mess. You’re the only one who needs to see it.

Published by thatsmadden

I'm an animation artist with an interest in code-driven motion.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website with WordPress.com
Get started
%d bloggers like this: