Page MenuHome

invoke_props_dialog ignores height
Closed, ResolvedPublicKNOWN ISSUE

Description

System Information
Operating system: MacOS Mojave 10.14.4
Graphics card: None

Blender Version
Broken: Version 2.80 (2.80 2019-07-29)

Short description of error

invoke_props_dialog ignores passed height of window

Exact steps for others to reproduce the error

Create operator with invoke method:

def invoke(self, context, event):
     return context.window_manager.invoke_props_dialog(self, width=500, height=500)

Result:

Dialog window is opened with width 500 and low height

Expected

Dialog window is opened with width 500 and height 500.

Event Timeline

Hmm, not sure if the height is actually ever used. The height of things is probably always determined by the content. Not sure why there is a height parameter.

@Campbell Barton (campbellbarton) should the height parameter do something currently?

@Adam Stankiewicz (sheerun), can you provide a small script that we can just copy into the text editor to test this bug, please?

import bpy
 
class MessageBox(bpy.types.Operator):
    bl_idname = "message.messagebox"
    bl_label = ""
 
    def execute(self, context):
        return {'FINISHED'}
 
    def invoke(self, context, event):
        return context.window_manager.invoke_props_dialog(self, width = 500, height = 500)
 
class Test_PT_Panel(bpy.types.Panel):
    bl_idname = "object.custom_panel"
    bl_label = "My Plugin"
    bl_category = "YAY3"
    bl_space_type = "VIEW_3D"
    bl_region_type = "UI"

    def draw(self, context):
        layout = self.layout
        row = layout.row()
        row.operator("message.messagebox", text = "Message")
        
def register():
    bpy.utils.register_class(MessageBox)
    bpy.utils.register_class(Test_PT_Panel)
    
 
def unregister():
    bpy.utils.unregister_class(Test_PT_Panel)
    bpy.utils.unregister_class(MessageBox)
    
register()

Looked into it, while the height is used internally, the UI_block_bounds_set_popup call causes the height to be ignored.

Using the height could be used to add padding to the dialog but don't see this as being useful.

Unfortunately removing this argument will break scripts.

Unless there is a good reason to support empty space, I think this argument could be deprecated.

Campbell Barton (campbellbarton) lowered the priority of this task from 90 to Low.Aug 20 2019, 7:49 PM

Thanks for looking into it. I'm fine with deprecating the argument.

Jeroen Bakker (jbakker) changed the subtype of this task from "Report" to "Known Issue".Jan 28 2020, 10:51 AM
Jeroen Bakker (jbakker) edited projects, added Python; removed Tracker Curfew.

the width and height are set in rna_generic_op_invoke when the WM_GEN_INVOKE_SIZE option is set. WM_GEN_INVOKE_SIZE is used for invoke_props_dialog and invoke_popup. In our add-ons only create prim uses the height option. Both ignore the height option.