I have a simple pie menu and I have it setup to allow the user to change a custom property value. But I don't want the user to have to choose a value, I want it to be an ON/OFF. So I want to make a checkbox and have it shown in the pie menu, then when they select that, it will change the custom property value to what I need it to be. I have tried going through this but its pretty confusing for me. Could someone show me how to do this?
My current code:
import bpy
from bpy.types import Menu
from bpy.props import BoolProperty
# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)
iSight_Camera_Indicator = BoolProperty(
name = "iSight Camera Indicator Toggle",
description = "Turns the iSight Camera Indicator ON and OFF",
default = False
)
class VIEW3D_PIE_template(Menu):
# label is displayed at the center of the pie menu.
bl_label = "Macbook_Controller"
bl_idname = "Object Mode.mc_pie_menu"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
"""
pie.prop(context.object, '["00_iSight Camera Indicator"]', text="iSight Camera Indicator Toggle")
pie.prop(context.object, '["01_Dirt and Dust"]', text="Dirt and Dust Toggle")
pie.prop(context.object, '["03_Menubar and Dock"]', text="Menubar and Dock Toggle")
pie.prop(context.object, '["04_Screen Rotation"]', text="Screen Rotation")
"""
pie.prop(Macbook_Controller, "iSight_Camera_Indicator", text="iSight Camera Indicator Toggle")
def register():
bpy.utils.register_class(VIEW3D_PIE_template)
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name = "Object Mode")
kmi = km.keymap_items.new("wm.call_menu_pie", "E", "PRESS").properties.name = "Object Mode.mc_pie_menu"
def unregister():
bpy.utils.unregister_class(VIEW3D_PIE_template)
if __name__ == "__main__":
register()
#bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_template")