Skip to content

Layout Accordion

BleuRaven edited this page Jan 29, 2024 · 4 revisions

For use this:
image

  1. Import and register bbpl.
from . import bbpl
def register():
    bbpl.register()

def unregister():
    bbpl.unregister()
  1. Create a child class of BBPL_UI_ExpendSection from bbpl.blender_layout.layout_expend_section and register the child class.
from .bbpl.blender_layout.layout_expend_section.types import (
        BBPL_UI_ExpendSection,
        )

class MyAddon_UI_ExpendSection(BBPL_UI_ExpendSection):
    pass

bpy.utils.register_class(BFU_UI_ExpendSection)
  1. Create a pointer of your child class and add an name.
bpy.types.Scene.bfu_object_properties_expanded = bpy.props.PointerProperty(type=MyAddon_UI_ExpendSection, name="Object Properties")
  1. Use draw(layout: bpy.types.UILayout) for draw the section button and is_expend() to check if the section is open.
scene.bfu_nomenclature_properties_expanded.draw(layout)
if scene.bfu_nomenclature_properties_expanded.is_expend():
    # The data to show when is expend

Here the result in my addon Blender For Unreal Engine:

Layout Extent Sections

Clone this wiki locally