Total beginner: can't find a way to toggle overlay options in 3D View

Hi guys. I have started to learn e little bit how to automate my stuff in Blender that I do often. So far object creation and changing parameters goes very well. But I’m stuck for two hours trying to automatically toggle off normals and handles for my curves.

Can you help me figure this one out?

I’m in a curve object, already in edit mode. How would I be able to toggle the overlay to hide the normals or handles off?

This obviously didn’t work. That is what pops up in the info log once I click it in the menu.

bpy.context.space_data.overlay.show_curve_normals = False

I’ve come to the conclusion it should have anything to do with ‘VIEW_3D’ and I am willing to dive deeper into coding, but I am a total noob. Thanks in advance!

1 Like

Ok, been looking for an answer. This is it. Maybe someone else is looking for it. https://blender.stackexchange.com/questions/162459/access-viewport-overlay-options-using-python-api

1 Like

great great and thanks very much.
so the code for turning off the viewport layout is:

import bpy
for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        for space in area.spaces:
            if space.type == 'VIEW_3D':
                space.overlay.show_overlays=False
                break
1 Like

as a shortcut- a VIEW_3D area only has one space, so you could simplify this to just call area.spaces[0].overlay.show_overlays directly.

2 Likes