0
$\begingroup$

I'm trying to add a boolean to my addon preferences menu that when toggled will remove the selected panel. Unfortunately I have no idea how to do this without registering/unregistering which doesn't work once unregistered. Any ideas?

    if bpy.context.scene.hideCryptoBool == True:
        bpy.utils.unregister_class(bpy.types.DARROW_PT_cryptoPanel)

    if bpy.context.scene.hideCryptoBool == False:
        bpy.utils.register_class(bpy.types.DARROW_PT_cryptoPanel)

    return {'FINISHED'}
$\endgroup$
3
  • 1
    $\begingroup$ Test bpy.context.scene.hideCryptoBool in the panel's poll? $\endgroup$
    – scurest
    Feb 2, 2021 at 6:25
  • $\begingroup$ Re registering class see blender.stackexchange.com/questions/202889/… and import DARROW_PT_cryptoPanel from module where it is defined. $\endgroup$
    – batFINGER
    Feb 2, 2021 at 9:12
  • $\begingroup$ could you explain what exactly poll is, and how its useful? $\endgroup$ Feb 2, 2021 at 15:54

0

Browse other questions tagged .