Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Scripting question about shape layers

  • Scripting question about shape layers

     Nick Hill updated 1 week, 5 days ago 2 Members · 6 Posts
  • Nick Hill

    September 22, 2022 at 12:27 pm

    I’m trying to make a script that creates a shape layer, then a group, then a (freeform) path, stroke and fill within that. This is what I’ve got – the createPath function doesn’t work, and causes AE to white-out and crash. Any ideas why?

    The script works fine if I comment that line out.

    var shp = createShape(comp);
    shp.name = ("Curve");
    var curvgrp = createShapeGroup(shp);
    curvgrp.name = ("CurveGrp");
    // var curv = createPath(curvgrp);  // COMMENTED BECAUSE IT KILLS AE
    var curvstrk = createStroke(curvgrp);
    var curvfll = createFill(curvgrp);
    function createShape(targetComp) {
            return targetComp.layers.addShape();
        }
        function createShapeGroup(shape) {
            return shape.property("Contents").addProperty("ADBE Vector Group");
        }
        function createPath(group) {
            return group.property("Contents").addProperty("ADBE Vector Shape");
        }
        function createStroke(group) {
            return group.property("Contents").addProperty("ADBE Vector Graphic - Stroke");
        }
        function createFill(group) {
            return group.property("Contents").addProperty("ADBE Vector Graphic - Fill");
        }

  • Filip Vandueren

    September 22, 2022 at 12:38 pm

    You’d need to add a (“ADBE Vector Shape – Group”) to (“Contents”) before you can add the (“ADBE Vector Shape”) to that new Group

  • Nick Hill

    September 22, 2022 at 12:53 pm

    Thanks Filip. So that’s an extra step after adding the ADBE Vector Group?

    Would this work for the createPath function:

    group.property(“Contents”).addProperty(“ADBE Vector Shape – Group”);

    return group.property(“Contents”).addProperty(“ADBE Vector Shape”);

    …or does the ADBE Vector Shape have to sit within the ADBE Vector Shape – Group?

  • Nick Hill

    September 22, 2022 at 1:11 pm

    If I change createPath to this, it works. So what’s the difference between a parametric path and a freeform one, in terms of how AE references them?

    function createPath(group) {

    return group.property(“Contents”).addProperty(“ADBE Vector Shape – Star”);

    }

  • Filip Vandueren

    September 22, 2022 at 3:56 pm

    Hi Nick,

    I’m not sure why. I don’t have a scripting setup available at the moment to test, sorry.

  • Nick Hill

    September 22, 2022 at 4:04 pm

    don’t worry, this works:

    function createPath(group) {

    return group.property(“Contents”).addProperty(“ADBE Vector Shape – Group”);

    }

    thanks for your help!

Viewing 1 - 6 of 6 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy