Toggle Constraint Axis

by Tokage IT Lab. in Scripts and Addons

Description

This add-on adds checkboxes to toggle the View 3D header to constraint the axis when moving objects, vertices or etc. using tools such as "Tweak" or "Move".

Constraining the axis would normally require pressing the "X" or "Y" or "Z" key while moving something, but when you need to move many objects, it is a silly thing to have to press the hotkeys again and again. This add-on works by overriding some of the settings which calling transform.translate in keymap. Please be careful about installing, uninstalling, and rewriting preferences, although I pay attention to the register / unregister process as much as possible.

Update Log

v1.0 (Feb 21, 2021):

  • Release

Features

The checkboxes are corresponding to the transform.translate attribute.

For example,

  • [X, Y, Z] = [False, False, False]
  • [X, Y, Z] = [True, True, True]

do not constraint movement.

  • [X, Y, Z] = [True, False, False]

allows only X-axis movement.

  • [X, Y, Z] = [True, True, False]

allows only XY-plane movement.

Preferences

The addon's default hotkeys for axis constraints are Ctrl + Alt + [X] or [Y] or [Z]. Be careful, if you are using the 2.7x hotkeys, Ctrl + Alt + [Z] may conflict with Undo history, so please rewrite or disable it.

There is a list of string of keymap categories will be overridden by searching for transform.translate. It must be written in JSON syntax.

Note

If you press the modal key, modal will have priority.

In addition, if you are using the move tool's gizmo, the gizmo will take priority. It means that if you grab the X-axis of the gizmo, it will move to the X-axis regardless of the constraints. Also, if you grab the white circle in the center of the gizmo, it will move to all directions.