Redrawing dialogs/popups with ID properties #47691

Closed
opened 2016-03-04 21:00:50 +01:00 by Aleksandr Zinovev · 8 comments

System Information
Kubuntu 15.10
Nvidia GeForce 9600 GT (driver: 340.96)

Blender Version
Broken: (2.76b)

Short description of error
Redrawing dialogs (invoke_props_dialog) doesn't work when changing ID property.
Works for popups (invoke_props_popup) but only after second redraw.
obj.gif

import bpy

class WM_OT_my_props_dialog(bpy.types.Operator):
    bl_idname = "wm.my_props_dialog"
    bl_label = "Props Dialog"
    bl_options = {'REGISTER', 'UNDO'}

    def check(self, context):
        return True

    def draw(self, context):
        layout = self.layout
        layout.prop(context.scene.objects, "active")
        if context.scene.objects.active:
            layout.prop(context.scene.objects.active, "data")

    def execute(self, context):
        return {'FINISHED'}

    def invoke(self, context, event):
        # return context.window_manager.invoke_props_dialog(self)
        return context.window_manager.invoke_props_popup(self, event)

bpy.utils.register_module(__name__)

bpy.ops.wm.my_props_dialog('INVOKE_DEFAULT')

Exact steps for others to reproduce the error

  1. Run the script in blender's text editor.
  2. Change active object 3 times (popup will be redrawn on 2nd and 3rd time).
  3. Uncomment the line and repeat steps 1-2 with invoke_props_dialog.
**System Information** Kubuntu 15.10 Nvidia GeForce 9600 GT (driver: 340.96) **Blender Version** Broken: (2.76b) **Short description of error** Redrawing dialogs *(invoke_props_dialog)* doesn't work when changing ID property. Works for popups *(invoke_props_popup)* but only after second redraw. ![obj.gif](https://archive.blender.org/developer/F287649/obj.gif) ``` import bpy class WM_OT_my_props_dialog(bpy.types.Operator): bl_idname = "wm.my_props_dialog" bl_label = "Props Dialog" bl_options = {'REGISTER', 'UNDO'} def check(self, context): return True def draw(self, context): layout = self.layout layout.prop(context.scene.objects, "active") if context.scene.objects.active: layout.prop(context.scene.objects.active, "data") def execute(self, context): return {'FINISHED'} def invoke(self, context, event): # return context.window_manager.invoke_props_dialog(self) return context.window_manager.invoke_props_popup(self, event) bpy.utils.register_module(__name__) bpy.ops.wm.my_props_dialog('INVOKE_DEFAULT') ``` **Exact steps for others to reproduce the error** 1. Run the script in blender's text editor. 2. Change active object 3 times (popup will be redrawn on 2nd and 3rd time). 3. Uncomment the line and repeat steps 1-2 with *invoke_props_dialog*.
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @AleksandrZinovev-2

Added subscriber: @AleksandrZinovev-2

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Did this ever work? if so what version.

Did this ever work? if so what version.
Author
Member

No, afaik.
Tested in versions 2.71-2.76.

No, afaik. Tested in versions 2.71-2.76.

Investigated the bug,
The problem here is there is a button update callback which normally ensures changing the buttons re-draws the interface.

The dialog_check_cb callback initially set here:

https://developer.blender.org/diffusion/B/browse/master/source/blender/windowmanager/intern/wm_operators.c;431a5b623e2c7309517bdcaf3e665c08a6c3e2d0$1430

Is being overwritten by UI_but_func_search_set here:

https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface.c;431a5b623e2c7309517bdcaf3e665c08a6c3e2d0$4338

1   UI_but_func_set        interface.c         4150 0x15a6a2b      
2   UI_but_func_search_set interface.c         4338 0x15a83bc      
3   ui_but_add_search      interface_layout.c  1675 0x165eada      
4   uiItemFullR            interface_layout.c  1359 0x165b524      
5   rna_uiItemR            rna_ui_api.c        125  0x4254d89      
6   UILayout_prop_call     rna_ui_gen.c        1410 0x425e608
Investigated the bug, The problem here is there is a button update callback which normally ensures changing the buttons re-draws the interface. The `dialog_check_cb` callback initially set here: https://developer.blender.org/diffusion/B/browse/master/source/blender/windowmanager/intern/wm_operators.c;431a5b623e2c7309517bdcaf3e665c08a6c3e2d0$1430 Is being overwritten by `UI_but_func_search_set` here: https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface.c;431a5b623e2c7309517bdcaf3e665c08a6c3e2d0$4338 ``` 1 UI_but_func_set interface.c 4150 0x15a6a2b 2 UI_but_func_search_set interface.c 4338 0x15a83bc 3 ui_but_add_search interface_layout.c 1675 0x165eada 4 uiItemFullR interface_layout.c 1359 0x165b524 5 rna_uiItemR rna_ui_api.c 125 0x4254d89 6 UILayout_prop_call rna_ui_gen.c 1410 0x425e608 ```

This issue was referenced by blender/blender@19ec1bfa89

This issue was referenced by blender/blender@19ec1bfa89f74dbda02ce62fcf9c88032840c624

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 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#47691
No description provided.