Lock X and Y axis of vertices in edit mode from python I using Blender to edit terrain files that are later exported and used in my game engine. Terrain files there are planes with a fixed number of vertices with consistent spacing between them. I want to somehow be able to lock editing of X and Y coordinates of objects with some certain property on the scene. Is that possible somehow?

I came up with the idea that having a way to somehow check the execution context of bpy.ops.transform.translate would help me, since it is the operator called with specific arguments, so I just could check if X and Y coordinates are zeros, or cancel the operator. Is there any way to hook or wrap this operator?

Or is there any other ways to achieve this goal?
Once you start moving an object you can press Z to lock all motion to the z axis (preventing changes in x or y).

https://docs.blender.org/manual/en/dev/editors/3dview/object/editing/transform/control/precision/axis_locking.html