Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Convert mask vertices to text…

  • Barend Onneweer

    June 21, 2012 at 6:52 pm

    Hmmm… I can of course paste the path into the position property to get an array of coordinates… but when I paste the position keyframes into a text file there’s no tangent information.

    Raamw3rk – independent colourist and visual effects artist

  • Dan Ebberts

    June 21, 2012 at 7:23 pm

    That should work. Your script should be able to harvest the tangent arrays.

    Dan

  • Barend Onneweer

    June 24, 2012 at 7:39 pm

    Hi Dan,

    So… a little later I actually ‘got my nerd on’ and managed to get the full vertex data including tangents to a text file.

    Now I’m stuck getting the script to draw the shape as a shape layer.

    I found examples for generic built-in Ellipses etc, but I can’t figure out where exactly to put my vertex data… This must be one of the least travelled areas of AE scripting…

    This is what I got for drawing a generic Ellipse:

    var myEllipseSize = [100,200];
    var myStrokeColor = [1,0,0];

    var myShapeLayer= thisComp.layers.addShape();

    var myShapeLayerContents = myShapeLayer.property("ADBE Root Vectors Group");
    var myShapeGroup = myShapeLayerContents.addProperty("ADBE Vector Group");
    myShapeGroup.name = "Circle";
    var myEllipse = focusShapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Shape - Ellipse");
    myEllipse.property("ADBE Vector Ellipse Size").setValue(myEllipseSize);

    And I get that I need to take out the Ellipse bits, but I’m missing something somewhere…

    Any pointers would once again be much appreciated!

    Raamw3rk – independent colourist and visual effects artist

  • Dan Ebberts

    June 24, 2012 at 9:23 pm

    The shape stuff is pretty tricky. This should draw a squished oval:

    var myVertices = [[0,-150],[-30,0],[0,150],[30,0]];
    var myInTangents = [[145,0],[0,-60],[-145,0],[0,60]];
    var myOutTangents = [[-145,0],[0,60],[145,0],[0,-60]];

    var myComp = app.project.activeItem;
    var myShapeLayer = myComp.layers.addShape();
    var myShapeLayerContents = myShapeLayer.property(“ADBE Root Vectors Group”);
    var myShapeGroup = myShapeLayerContents.addProperty(“ADBE Vector Group”);
    var myShapeContents = myShapeGroup.addProperty(“ADBE Vectors Group”);
    var myPathGroup = myShapeContents.addProperty(“ADBE Vector Shape – Group”);
    var myPathObject = myPathGroup.property(“ADBE Vector Shape”);

    var myPath = myPathObject.value;
    myPath.vertices = myVertices;
    myPath.inTangents = myInTangents;
    myPath.outTangents = myOutTangents;
    myPath.closed = true;
    myPathObject.setValue(myPath)

    Good luck. 🙂

    Dan

  • Barend Onneweer

    June 25, 2012 at 6:43 am

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