Lock a layer's position without locking the layer.
If masking on a layer in the comp window, you can accidentally move the layer's
position when trying to move mask vertices, but you can't lock the layer because
you want to edit the masks on it.
This is only suitable for layers that don't change position, as the expression will
basically lock a layer in a certain position.
Select a 2D layer and press "p" to view its position property. In my case, the
position values are 160 and 120. Add an expression to position and enter this:
or whatever your position values are.
If you're using AE 6.0+, when you try and move the layer you'll find it won't move.
The position values are actually changing, but the expression is ignoring this as
we've told it to use a specific set of values.
In AE 5.0/5.5 you'll get a message coming up saying you can't change the
position because an expression is enabled, but at least it stops you from moving
the layer without realising.
NOTE: This expression is an example of an array. An array is basically just a set
of values, arranged in a certain order. In this case it's two values, the first being
160 and the second 120.
The expression shows the format that is used to create this 'array' of values.
Square brackets on either side and a comma between each of the values.
You'll probably only encounter arrays with 2 or 3 values, i.e. [x, y] or [x, y, z]
depending on if an expression is on 2D/3D position/orientation/scale properties.