Well, actually i found a solution walking to work(and thinking) this morning, and it was quite simple.
I’ve added an Angle Control Effect to the target which i want to get the real rotation, and added the code below.
If you want to put it on a 3D space, just make 3 copies of the Angle Control Effect and change “.rotation” to “.orientation[0]”, “.orientation[1]”, “.orientation[2]”.
Basically it checks for every parent and sums up its rotations.
result = effect("Angle Control")("Angle") + transform.rotation;
parentStack = [];
inheritance = true;
if(thisLayer.hasParent)
{
parentStack.push(thisLayer.parent);
while(inheritance)
{
if(parentStack[parentStack.length-1].hasParent)
{
parentStack.push(parentStack[parentStack.length-1].parent);
}else{
inheritance = false;
}
}
for(var i = 0, l = parentStack.length ; i<l;i++)
{
result += parentStack[i].rotation;
}
}
result