Adding a user interface
We have already created the panel.py
module, which will contain all the user interface classes and functions, so this file is going to contain our panel class.
Writing the UI module
We will start importing the bpy
module and our collection of icons via a relative import of img_loader
:
import bpy
from . import img_loader
The OBJECT_PT_structured
class is derived from Panel
. Like the one from Chapter 5, it contains the bl_*
identifiers required by Blender in its static section:
class OBJECT_PT_structured(bpy.types.Panel): """Creates a Panel in the object context""" bl_label = "A Modular Panel" bl_idname = "MODULAR_PT_layout" bl_space_type ='PROPERTIES'
bl_region_type ='WINDOW'
bl_context ='object'
For now, our draw
function...