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.
toWorld scripting equivalent
Moderator: Paul Tuersley
Hello. I found boundingbox in world coordinates like this. Very strange method

Code: Select all
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;
}
I was looking for exactly the same thing. Did you find anything?