Quickly showing/hiding gizmos in Blender

Whether to use gizmos when working in Blender is a highly debated topic among 3D artists. However, even without using gizmos on a regular basis, there are times when “those arrows” could be very useful. If gizmos are hide by default in our Blender settings, we can write a simple script that will temporarily show and hide gizmos in the 3D viewport.

Gizmo display in the 3D viewport’s area is controlled through its “space” pointer. We should manipulate with properties’ names begin with “show_gizmo_object_” and are followed by the desired gizmo type: “rotate,” “scale,” or “translate,” for the rotation, scale, and translation gizmos, respectively. For example, to display the translation gizmo, the “show_gizmo_object_translate” property is used.

Let’s write a script that will control the translation gizmo’s display when executed. We’ll create it in “toggle” mode, meaning that if the gizmo isn’t displayed, it will be shown, and if it’s already shown, it will be hidden.

To control the state of the 3D viewport’s area from the text editor’s area, we should use a temporary context override.

Let’s get a pointer to the 3D viewport area,

and call temp_override() with the area specified in the parameters.

Now, among the 3D viewport spaces, we determine the one in which the rendering actually occurs.

Having obtained a pointer to the viewport space, we can change the value of the gizmo’s display property in it to the opposite value each time the code is executed.

As a result, each time the script is executed, the gizmo in the 3D viewport will be toggled on or off.

The full code:

We can also configure the rotation and scaling gizmos to be on or off using the corresponding properties.

For scaling:

and for rotation:

We can also use any combination of these three gizmo types.

For convenience, we can bind such a script to keystrokes and enable and disable the desired gizmos in a “single button” mode.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments