I’ve been slowly learning python, but I’m having trouble with drop down menu’s and checkboxes. I can easily duplicate one from the existing UI, but I can’t figure out how to make one from scratch.
Any help would be apprecieated. Thanks in advance.
import bpy
class HelloWorldPanel(bpy.types.Panel):
"""Creates a Panel in the Scene properties window"""
bl_label = "Hello World Panel"
bl_idname = "SCENE_PT_hello"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
def draw(self, context):
layout = self.layout
wm = context.window_manager
layout.prop(wm, "your_prop")
def register():
bpy.types.WindowManager.your_prop = bpy.props.BoolProperty(name="Your Prop")
bpy.utils.register_module(__name__)
def unregister():
bpy.utils.unregister_module(__name__)
del bpy.types.WindowManager.your_prop
if __name__ == "__main__":
register()
For UI-only properties, you may use WindowManager (but beware, those won’t be saved in the .blend), or on the appropriate “thing”, like Object, Scene, Bone… these will be saved in .blend.