Page MenuHome

invoke_props_dialog() window changes position on redraw if the window has sufficient vertical height
Closed, ResolvedPublic


System Information
Operating system: Windows 7
Graphics: Intel HD4400

Blender Version
Broken: 2.79 5bd8ac9

Short description of error
After repositioning a dialog window, when redrawn, the window will change location. After a few repositions (around 4), the window will stay in place after redraws as expected. The number of repetitions until the dialog is stabilized seems to depend on the height of the dialog window with more repetitions required for a taller windows.

Exact steps for others to reproduce the error


import bpy

class MyDialogOperator(bpy.types.Operator):
    bl_idname = "my_test.my_dialog_operator"
    bl_label = "My Dialog Operator"
    toggle = bpy.props.BoolProperty()

    def check(self, context):
        return True
    def draw(self, context):
        self.layout.prop(self, "toggle", text="Toggle to redraw")
        for i in range(20):
    def execute(self, context):
        return {'FINISHED'}

    def invoke(self, context, event):
        return context.window_manager.invoke_props_dialog(self)
  1. Open Blender and run script (Dialog opens)
  1. REPEAT:

    a) Reposition window to center of screen

    b) Click 'Toggle to redraw ' checkbox (Dialog window changes location)

Event Timeline

Sergey Sharybin (sergey) lowered the priority of this task from Needs Triage by Developer to Needs Information from User.Oct 5 2017, 12:17 PM

I can not reproduce the issue on Linux, so either initial positions of popup are different, or something is platform-specific. Please describe steps as clear as possible, maybe with some screenshots or so.

When redraw code is used

def check(self, context):
    return True

the Operator pop-up can change it's location (jump around on the screen) depending on the cursor's position and height of the pop-up (for instance after tweaking some values in properties).

For instance that can happen with Discombobulator from Add Mesh: Extra Objects

Thanks for the quick responses. I am able to reproduce this on Windows 10 (GTX 1070 8GB) with the same build, and also with using the 'Discombobulator' menu. I have attached a screencast of the issue:

Is there a way to prevent the pop-up from jumping around when the check() redraw is used? I would like to have a pop-up that redraws menu items dependant on which options are selected and it could be distracting to the user if the pop-up jumps locations.

Sergey Sharybin (sergey) raised the priority of this task from Needs Information from User to Confirmed, Medium.

Now i see the problem. The trick was to make popup to "stick" to one of the window corners. Here is a .blend file i've used


@Bastien Montagne (mont29), is this area something you're comfortable with? :)

Not really comfortable with our UI popup code no… this code is a bit of a maze, with lots of indirect/callbacks stuff that makes it difficult to track. :|

Anyway, root of the issue is that floating UI_BLOCK_BOUNDS_POPUP_MOUSE and UI_BLOCK_BOUNDS_POPUP_MENU blocks use the mouse position as base to decide where they popup on screen. That initial mouse position is stored, and updated when you drag the popup around. BUT! Initial position of the popup may be adjusted to keep it fully inside main window - and this is where the can of worms opens.

Will try to figure out a way around that mess. :/

Fix incoming.

Note that panel will still jump in case user dragged it partially out of view - we could prevent that, but imho it's better to keep that behavior, since redraw can generate a popup of different size, which could end up with a totally out-of-view one...