0
$\begingroup$

Documentation: View3DOverlay.show_stats.

The UI shows the following:

enter image description here

However when I run bpy.data.screens['Layout'].overlay.show_stats, there is an error: AttributeError: 'Screen' object has no attribute 'overlay.

$\endgroup$
2
$\begingroup$

Look at the type.

Sometimes the tooltips can be screwy as shown in question the overlay is not a property of screen.

On the bpy.types.View3DOverlay help page linked go to the bottom to references.

WIll see a link to SpaceView3D.overlay

which is the space assigned to the 3d view.

In the python console

>>> for i, a in enumerate(C.screen.areas):
...     i, a.type
...     
(0, 'PROPERTIES')
(1, 'CONSOLE')
(2, 'OUTLINER')
(3, 'VIEW_3D')

>>> 
>>> space = C.screen.areas[3].spaces.active
>>> space.overlay.show_stats
True

>>> type(space)
<class 'bpy.types.SpaceView3D'>

>>> type(space.overlay)
<class 'bpy.types.View3DOverlay'>

If a script is run within the context of the 3Dview area, a panel draw, menu shortcut etc, then

space = context.space_data

The blender screen is split into areas. When you change the area type in UI, the active space used is associated with that type. When you see the type SpaceFoo you know its the space of the "Foo" area. eg "SpaceProperties", "SpaceConsole"

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.