0
$\begingroup$

I was making a custom pie menu and all was well, I had set it up to activate when 'E' was pressed. Suddenly blender crashed, and I reopened it, and then the whole thing didn't work anymore. I tried coping and pasting working versions of the code (from other questions on here) and they no longer worked. I tried removing the keyboard shortcut manually, and found there were like 8 of the exact same one there so I removed all but one, still nothing, I then removed that last one and run the script, it made a new one but still didn't work. I then removed that one and made a new shortcut manually, still nothing. For a while though it did work in the properties panel and outliner, but not the 3D View, but now it doesn't work in any of those. I also tried putting back the line of code that activated the pie menu as the script is run and that works, but the items I had in the pie menu before this happened are no longer there. And there are also no errors in the console or info panel either...I'm really not sure what happened, could someone take a look at my code and see if there's something wrong with that or if theres anything else I've missed...Thanks, Matthew

*Update*

I've now got it going again in the 3D Viewport, but my items are all still missing...

Here is my code:

import bpy
from bpy.types import Menu

from bpy.props import BoolProperty

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
        # get the camera, use a poll method to check no cam
        scene = context.scene
        camera = scene.camera.data
        pie = layout.menu_pie()

        pie.prop(camera, "iSight_Camera_Indicator", text="iSight Camera Indicator")
        pie.prop(camera, "dirt_dust", text="Dirt and Dust")
        pie.prop(camera, "menubar_dock", text="Menubar and Dock")


def register():

    #iSight Camera Indicator
    bpy.types.Object.iSight_Camera_Indicator = BoolProperty(
        name = "iSight Camera Indicator Toggle",
        description = "Toggles the iSight Camera Indicator ON and OFF",
        default = False
    )

    #Dirt and Dust
    bpy.types.Object.dirt_dust = BoolProperty(
        name = "Dirt and Dust Toggle",
        description = "Toggles the dirt and dust ON and OFF",
        default = False
    )

    #Menubar and Dock
    bpy.types.Object.menubar_dock = BoolProperty(
        name = "Menubar and Dock Toggle",
        description = "Toggles the menubar and dock ON and OFF",
        default = False
    )

    bpy.utils.register_class(VIEW3D_PIE_template)

    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name = "Window",space_type='EMPTY', region_type='WINDOW')
    kmi = km.keymap_items.new("wm.call_menu_pie", type = "E", value = "PRESS")
    kmi.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="object_mode.mc_pie_menu")
$\endgroup$
  • $\begingroup$ I would try disabling the Pie Menus add-on entirely, save your settings, quit and relaunch Blender, then re-enable, then re-add your custom Pie Menu, then re-customize the shortcut. It may also be a good idea to back up your custom Pie menus before removing the add-on... not sure how that add-on stores its data, but when in doubt, back up. $\endgroup$ – Mentalist Dec 27 '15 at 5:36
1
$\begingroup$

In your register function you are adding properties to bpy.types.Object but in the menu you are displaying properties of a camera, which doesn't have the properties you registered.

You need to adjust your register function to add the properties to bpy.types.Camera

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.