2 Replies Latest reply on Nov 22, 2017 3:10 AM by sillybomb

    Using Create Nulls From Paths without Nulls (self contained)

    sillybomb Level 1

      Is it possible to use the new "Create nulls from paths" and relink the expression to its own layer rather than the null object.

      I have a very basic object - a flower

      It has a stem which is one single path.

      Using Create Nulls from paths makes one at the stop of the stem and the bottom as you would expect

      I then link the top of the stem null to the flower petals position.
      This way I can move the flower and the stem bends and follows nicely

       

      However I am wondering if I can alter the expression to bypass the null and link it directly to the position of the petals object group.

       

      The direct code created out of create nulls from paths script.

       

      I have been able to link the stem up using the Expression controls automatically created to select the shape instead of the null

      however the null which then does nothing, breaks the code if deleted and it no longer works.

      So I can bypass the null but its effectiveness is still dependent on the existence of the null which  makes the attempt pointless.

       

      var nullLayerNames = ["Shape Layer 2: Path 1 [5.1.0]","Shape Layer 2: Path 1 [5.1.1]"];
      var origPath = thisProperty;
      var origPoints = origPath.points();
      var origInTang = origPath.inTangents();
      var origOutTang = origPath.outTangents();
      var getNullLayers = [];
      for (var i = 0; i < nullLayerNames.length; i++){
          try{ 
              getNullLayers.push(effect(nullLayerNames[i])("ADBE Layer Control-0001"));
          } catch(err) {
              getNullLayers.push(null);
          }}
      for (var i = 0; i < getNullLayers.length; i++){
          if (getNullLayers[i] != null && getNullLayers[i].index != thisLayer.index){
              origPoints[i] = fromCompToSurface(getNullLayers[i].toComp(getNullLayers[i].anchorPoint)); 
          }}
      createPath(origPoints,origInTang,origOutTang,origPath.isClosed());
      

       

      I can do without obviously but I was hoping to make the flower self-contained if possible. And then if it were possible to bypass the null I could learn by extrapolation and apply the bypass to other projects