I’m trying toggle the transform overlays using python, but I can’t seem to get it to work. I think it’s a context issue, but I’m not sure. When you toggle the move gizmo, this comes up in the info window:
I’m in the process of putting the gizmo popover, and a few others like interaction mode and object select/visibility, into their own menu in the 3d header. I know that making an operator class for every single item isn’t the most elegant way to do it, but it works fine.
It doesn’t do anything, but it does toggle the option inside the popover. So whatever it’s supposed to do is being done I guess. Show_gizmo, the one that toggles everything, makes the translate gizmo show/hide. So maybe something goofy right now or I don’t understand what it is supposed to be for. Everything else works like it should though, like navigate.
class VIEW3D_gizmo_translate(bpy.types.Operator):
"""Show Translate Gizmo"""
bl_idname = "view3d.gizmotranslate"
bl_label = "Showgizmotranslate Operator"
def execute(self, context):
space = context.space_data
if space.show_gizmo_object_translate == True:
space.show_gizmo_object_translate = False
else:
space.show_gizmo_object_translate = True
return{'FINISHED'}
I managed to work out what I was looking for today. I wanted to be able to toggle each of the transform gizmos using the keyboard instead of having to go into the Viewport Gizmos dropdown. I did this as an exercise and proof of concept for the Industry Compatible Keymap task. The addon I created as well as the modified keymap are on my github. The issue I was having when I created this thread was that I needed to get the context of each 3d View to be able to activate the gizmo in all of them. I did so by going through every area in the active screen and seeing if it’s a 3d View and then toggling the show_gizmo_object_… properties using the trick I showed you above:
import bpy
areas = bpy.context.workspace.screens[0].areas
for area in areas:
for space in area.spaces:
if space.type == 'VIEW_3D':
space.show_gizmo_object_translate^= True