invoke_props_dialog ignores height #68749

Closed
opened 2019-08-16 22:38:41 +02:00 by Adam Stankiewicz · 10 comments

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.

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

Added subscriber: @sheerun

Added subscriber: @sheerun
Member

Added subscribers: @ideasman42, @JacquesLucke

Added subscribers: @ideasman42, @JacquesLucke
Member

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.

@ideasman42 should the height parameter do something currently?

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

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. @ideasman42 should the height parameter do something currently? @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()
``` 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.

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

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

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

This issue was referenced by blender/blender@e64166652b

This issue was referenced by blender/blender@e64166652b17631e9c2a5b64bd54e7cf38af8ebb
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Member

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.

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

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Jeroen Bakker self-assigned this 2020-02-17 15:04:58 +01:00
Sign in to join this conversation.
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-addons#68749
No description provided.