Page MenuHome

Adjust last operation: can't reset properties to default value
Confirmed, NormalPublicBUG

Description

Blender Version
Broken: 2.8x

Short description of error
In the Adjust Last Operation panel, the context menu for any property has the Reset to Default Value options disabled, although they are enabled in the operator panel.

Exact steps for others to reproduce the error

  1. Load the default scene
  2. Enter edit mode on the cube
  3. Bevel an edge
  4. Expand the operator panel in the bottom left
  5. Right click any property, note that Reset to Default Value option is enabled and works
  6. Go Edit -> Adjust Last Operation
  7. Right click the same property in that panel, note that Reset to Default Value option is disabled

Event Timeline

Philipp Oeser (lichtwerk) lowered the priority of this task from 90 to 50.Nov 11 2019, 12:52 PM

Can confirm this one also.

Note T71470 is very related [even though in this case -- opposed to T71470 -- it doesnt work well when called via F9 either...]

Jacques Lucke (JacquesLucke) changed the subtype of this task from "Report" to "Bug".

The poll function of the "Reset to Default Value" operator fails in the popup menu.
This is because it cannot find the active uiBut.
This is because CTX_wm_region(C) does not return the region of the currently open menu popup in ui_context_rna_button_active.

A quick hack to make this particular case work is to replace the function with:

static uiBut *ui_context_rna_button_active(const bContext *C)
{
  bScreen *screen = CTX_wm_screen(C);
  if (screen && screen->regionbase.first) {
    return ui_context_button_active(screen->regionbase.first, ui_context_rna_button_active_test);
  }
  return ui_context_button_active(CTX_wm_region(C), ui_context_rna_button_active_test);
}

This breaks other cases though. I assume the real fix would have to make sure that CTX_wm_region(C) actually returns the popup region, don't know for sure.

The preferable way to achieve this is using CTX_wm_menu(), it returns the menu region if there is one. If it returns NULL, the current CTX_wm_region() can be used.

However I don't know if this change is safe to do, after all this is called from many different places.