0
$\begingroup$

I made an operator, which have an UNDO panel with my custom properties.

If UNDO panel was collapsed – it remembers this state and next time will appear also collapsed:

enter image description here

__

It's not ok in my case.

I would like to either:

  1. control the panel's state dynamically (depending on the result of execute() function)

  2. or if dynamic control is not possible – to force the panel ALWAYS to stay maximized.

*(1) is preferable

How can I do either of these things?

$\endgroup$
1
  • 1
    $\begingroup$ Note the shortcut F9 can be used to expand the panel, it calls bpy.ops.screen.redo_last $\endgroup$
    – Gorgious
    Commented Apr 11 at 7:25

2 Answers 2

1
+50
$\begingroup$

the Python API can't handle opening and closing panels

https://blender.stackexchange.com/a/3042/76897

isn’t exposed via the Python API

https://devtalk.blender.org/t/how-can-i-determine-if-a-panel-is-collapsed-or-expanded/19300

The region of the panel is named Adjust Last Operation. The region itself can be hidden with show_region_hud.

The collapse state of the panel is defined by a flag value PNL_CLOSED which is set on different conditions but not accessible via the Python API.

$\endgroup$
1
  • $\begingroup$ So no way to control it via API... Pity. Anyway huge thanks for your deep research and for the the useful links. $\endgroup$
    – Yaroslav
    Commented Apr 23 at 11:37
0
$\begingroup$

A lot of time later I've figured a solution:

as mentioned @gorgious bpy.ops.screen.redo_last can call UNDO panel, though this panel will appear in the place where mouse pointer is located - additionally to previous (minimized) panel.

Displaying two UNDO panels at once is not optimal...

But we can show new (maximized) panel on top of the old (minimized) one, so only the new one will be visible.

To force panel's location - before calling it the mouse pointer should be set in the right place via python:

context.window.cursor_warp(x, y)

*in case of x=0 and y=0 it will be left bottom corner of the screen – and old (minimized) panel will be completely hidden by the new (maximized) one.


$\endgroup$

You must log in to answer this question.

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