invoke_props_dialog() window changes position on redraw if the window has sufficient vertical height #52999

Closed
opened 2017-10-05 03:55:40 +02:00 by Ryan Guy · 13 comments

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

Script:

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):
            self.layout.label(str(i))
    
    def execute(self, context):
        return {'FINISHED'}

    def invoke(self, context, event):
        return context.window_manager.invoke_props_dialog(self)
    
bpy.utils.register_class(MyDialogOperator)
bpy.ops.my_test.my_dialog_operator('INVOKE_DEFAULT')
  1. Open Blender and run script (Dialog opens)

  2. REPEAT:

  a) Reposition window to center of screen
  b) Click 'Toggle to redraw ' checkbox (Dialog window changes location)
**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** Script: ``` 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): self.layout.label(str(i)) def execute(self, context): return {'FINISHED'} def invoke(self, context, event): return context.window_manager.invoke_props_dialog(self) bpy.utils.register_class(MyDialogOperator) bpy.ops.my_test.my_dialog_operator('INVOKE_DEFAULT') ``` 1. Open Blender and run script (Dialog opens) 2. REPEAT: ``` a) Reposition window to center of screen ``` ``` b) Click 'Toggle to redraw ' checkbox (Dialog window changes location)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @rlguy

Added subscriber: @rlguy

Added subscriber: @Sergey

Added subscriber: @Sergey

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.

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.

Added subscriber: @VukGardasevic

Added subscriber: @VukGardasevic

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

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
Author

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:

T52999_screencast.mp4

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.

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: [T52999_screencast.mp4](https://archive.blender.org/developer/F962987/T52999_screencast.mp4) 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.
Bastien Montagne was assigned by Sergey Sharybin 2017-10-11 15:33:52 +02:00

Added subscriber: @mont29

Added subscriber: @mont29

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 popup.blend.

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

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 [popup.blend](https://archive.blender.org/developer/F997140/popup.blend). @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. :/

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. :/

This issue was referenced by 3b4f6996a8

This issue was referenced by 3b4f6996a8fd521b532eff0f8cbcd282d9a2c5b7

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...

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...

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#52999
No description provided.