1
$\begingroup$

I'm trying to see if there is a way for me to get a boolean value for the tools menu being opened or closed. I know you can see a few toggle options using something like console.toggle() but I wasn't able to find anything about the tools menu in the Blender Documentation or other similar questions on this platform. Thanks!

The tools menu open Tools Menu Open

The tools menu closed Tools Menu Closed

$\endgroup$

1 Answer 1

1
$\begingroup$

I fiddled a bit in the python console and found the show_region_ui property of the 3D Viewport space indicating this:

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        for space in area.spaces:
            if space.type == 'VIEW_3D':
                # True: n-panel is open
                # False: n-panel is closed
                n_panel_is_open = space.show_region_ui

                # You can even set it
                if not n_panel_is_open:
                    space.show_region_ui = True

                break
$\endgroup$
2
  • $\begingroup$ Thank you so much! Is show_region_ui in the docs? Every time I search for it I don't get results... this is such a useful method to know! $\endgroup$ Sep 26, 2022 at 21:23
  • $\begingroup$ Well, technically there is an entry in the docs, but it is explaining nothing, so not of much use. $\endgroup$ Sep 26, 2022 at 22:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .