1

I write my Blender addon. And I need to redraw the panel and all panels below it in one of operator execute. So I can write

def redraw_panel():
    try:
        bpy.utils.unregister_class(PanelClass1)
        bpy.utils.unregister_class(PanelClass2)
        bpy.utils.unregister_class(PanelClass3)
    except:
        pass
bpy.utils.register_class(PanelClass1)
bpy.utils.register_class(PanelClass2)
bpy.utils.register_class(PanelClass3)

But so I have problems adding new panels below (I need to write register and unregister for them in above function).

Is there any other way in Blender api to redraw UI and panels in Blender?

Multifora
  • 63
  • 4
  • 3
    Suggest checking on if PanelClass1.is_registered: https://blender.stackexchange.com/a/202896/15543 Above pretty much depends on all being in sync. A tag redraw eg context.area.tag_redraw() is a common way to tag UI for redraw, although it is often not necessary https://blender.stackexchange.com/a/182852/15543 Assume you made some changes to panel class definition before calling op above? – batFINGER Jun 17 '21 at 17:03
  • Thanks for your comment! Should I write tag context.area.tag_redraw() in my panel draw method? – Multifora Jun 17 '21 at 17:21
  • 1
    Yes, that's the way to do it usually @Multifora – brockmann Jun 17 '21 at 17:36
  • 1
    Thanks @brockmann – Multifora Jun 17 '21 at 17:46

0 Answers0