I'm not sure whether it is a bug or if I misunderstand something, but I observed the same behavior on both CS3 and CS4 (Mac & Win).
Setting the 3D flag to true, when the layer is already 3D, resets the Z position to 0. It seems that internally the 3D switch is first disabled, and then it is (re)enabled. This could explain why the former Z value is lost.
To test the snippet below, create a new solid, enable its 3D switch, and change the Z position.
Code: Select all
var comp = app.project.activeItem;
var layer = app.project.activeItem.layer(1); // assume 3D layer
var prevZ = layer.position.value[2];
layer.threeDLayer = true;
var curZ = layer.position.value[2];
alert("Previous Z: " + prevZ + "\r Current Z: " + curZ);