Expressions/Scripts/Presets

Moderator: Paul Tuersley

 
User avatar
axymark
Topic Author
Posts: 23
Joined: Fri Nov 29, 2013 7:04 am

toWorld scripting equivalent

Sun Dec 07, 2014 6:45 am

Hi,

Is there a scripting equivalent of toWorld expression? I need to find world position of (possibly) parented objects.

Thanks




edit: I realize i can set expression to temporary property and calculate it that way, but I dont want to do this.
 
shtep
Posts: 1
Joined: Mon Dec 29, 2014 9:02 am
Location: Russia

Re: toWorld scripting equivalent

Mon Dec 29, 2014 11:25 am

Hello. I found boundingbox in world coordinates like this. Very strange method :roll:

var slLayer = app.project.activeItem.selectedLayers[0];
wPoints=layerBoundingVertices(slLayer);
alert (wPoints[0][0]+" "+wPoints[0][1]+" "+wPoints[1][0]+" "+wPoints[1][1]);
function layerBoundingVertices(layer) {
   var boundingBox = layer.sourceRectAtTime(layer.inPoint, 1);
   var boundingVertices = [[boundingBox.left,boundingBox.top],[boundingBox.left,(boundingBox.top+boundingBox.height)],[(boundingBox.left+boundingBox.width),(boundingBox.top+boundingBox.height)],[(boundingBox.left+boundingBox.width),boundingBox.top]];
   var boudVertices = boundingVertices;
    layer.Effects.addProperty("Point Control");
    var NewBoundVertices = new Array();
    NewBoundVertices = [];
    layer("Effects")("Point Control")("Point").expression="thisLayer.toComp(["+boudVertices[0][0]+","+boudVertices[0][1]+"])";

    NewBoundVertices.push([layer("Effects")("Point Control")("Point").value[0],layer("Effects")("Point Control")("Point").value[1]]);

    layer("Effects")("Point Control")("Point").expression="thisLayer.toComp(["+boudVertices[1][0]+","+boudVertices[1][1]+"])";
    NewBoundVertices.push ([layer("Effects")("Point Control")("Point").value[0],layer("Effects")("Point Control")("Point").value[1]]);
   
    layer("Effects")("Point Control")("Point").expression="thisLayer.toComp(["+boudVertices[2][0]+","+boudVertices[2][1]+"])";
    NewBoundVertices.push ([layer("Effects")("Point Control")("Point").value[0],layer("Effects")("Point Control")("Point").value[1]]);
   
    layer("Effects")("Point Control")("Point").expression="thisLayer.toComp(["+boudVertices[3][0]+","+boudVertices[3][1]+"])";
    NewBoundVertices.push ([layer("Effects")("Point Control")("Point").value[0],layer("Effects")("Point Control")("Point").value[1]]);
    layer("Effects")("Point Control").remove();
   
   return NewBoundVertices;
}
 
stib
Posts: 15
Joined: Sun Dec 10, 2006 10:23 pm
Contact:

Re: toWorld scripting equivalent

Tue Nov 10, 2015 5:13 am

I was looking for exactly the same thing. Did you find anything?

Who is online

Users browsing this forum: No registered users and 5 guests