Popup dialog does not redraw updated labels #48874

Closed
opened 2016-07-17 21:57:49 +02:00 by domlysz · 4 comments

Blender 2.77 linux64

In this scenario, the main operator popup display another operator, also calling using invoke_props_dialog, which update a property displayed as label in the main popup. It seems there is no redraw triggered after validating the second popup.

import bpy

bpy.types.Scene.myInt = bpy.props.IntProperty()


class Increment(bpy.types.Operator):

    bl_idname = "test.increment"
    bl_label = "Increment"
    bl_options = {'REGISTER', 'UNDO'}
    
    value = bpy.props.IntProperty(default=10)  
    
    def invoke(self, context, event):
        return context.window_manager.invoke_props_dialog(self, width=200)

    def execute(self, context):
        context.scene.myInt += self.value
        context.area.tag_redraw()    
        return {'FINISHED'}



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

    def check(self, context):
        return True

    def draw(self, context):
        scn = context.scene
        layout = self.layout
        row = layout.row()
        row.label(str(scn.myInt))
        row.operator('test.increment')

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

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


bpy.utils.register_module(__name__)

bpy.ops.ui.propsdialog('INVOKE_DEFAULT')

It work correctly if the same draw function is used in a panel:

class PANEL(bpy.types.Panel):
    bl_category = "TEST"
    bl_label = "Tst"
    bl_space_type = "VIEW_3D"
    bl_region_type = "TOOLS"

    def draw(self, context):
        scn = context.scene
        layout = self.layout
        row = layout.row()
        row.label(str(scn.myInt))
        row.operator('test.increment')
Blender 2.77 linux64 In this scenario, the main operator popup display another operator, also calling using invoke_props_dialog, which update a property displayed as label in the main popup. It seems there is no redraw triggered after validating the second popup. ``` import bpy bpy.types.Scene.myInt = bpy.props.IntProperty() class Increment(bpy.types.Operator): bl_idname = "test.increment" bl_label = "Increment" bl_options = {'REGISTER', 'UNDO'} value = bpy.props.IntProperty(default=10) def invoke(self, context, event): return context.window_manager.invoke_props_dialog(self, width=200) def execute(self, context): context.scene.myInt += self.value context.area.tag_redraw() return {'FINISHED'} class Dialog(bpy.types.Operator): bl_idname = "ui.propsdialog" bl_label = "Props Dialog" bl_options = {'REGISTER', 'UNDO'} def check(self, context): return True def draw(self, context): scn = context.scene layout = self.layout row = layout.row() row.label(str(scn.myInt)) row.operator('test.increment') def execute(self, context): return {'FINISHED'} def invoke(self, context, event): return context.window_manager.invoke_props_dialog(self) bpy.utils.register_module(__name__) bpy.ops.ui.propsdialog('INVOKE_DEFAULT') ``` It work correctly if the same draw function is used in a panel: ``` class PANEL(bpy.types.Panel): bl_category = "TEST" bl_label = "Tst" bl_space_type = "VIEW_3D" bl_region_type = "TOOLS" def draw(self, context): scn = context.scene layout = self.layout row = layout.row() row.label(str(scn.myInt)) row.operator('test.increment') ```
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @domlysz

Added subscriber: @domlysz

This issue was referenced by blender/blender@277cb12395

This issue was referenced by blender/blender@277cb12395a8c97ddf7c68cb559ef5aacd4827d9

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#48874
No description provided.