Pie Menu Editor 1.16.4

Try to copy this fix (PME 1.16.4) to scripts/addons/pie_menu_editor/ folder and restart Blender.

1 Like

Question

i created pie menu and i want to use my custom regular menu as popup
is it possible to achieve this kind of layout ex.

image

currently my problem is this i cant make it popup or open ( need 2 clicks )
image

note : i want to use regular menu not the Popup dialog

Is it possible to detect if you’re in Local View? Like, run this command only when in Local View.

Try this code in Custom tab:

menu = "My Regular Menu"; col = L.column(align=True); bpy.types.WM_OT_pme_user_pie_menu_call.draw_rm(prefs().pie_menus[menu], col)
3 Likes

Yes, check C.space_data.local_view value. Eg:

print("Local Mode: OFF") if C.space_data.local_view is None else print("Local Mode: ON")
2 Likes

thanks you for answers
i notice the ui of Regular menu becomes popup dialog style UI
image

is it possible to achieve or retain the style of UI ( Regular Menu ) but in popup form , no 2 clicks
the reason i l want to use regular menu over / vs popup dialog there is a snap feeling when hovering

image

It worked for meshes, but I continue to have problems with GP. I’ll have to do some more tests and get back to you

To make progress on the following problem:
https://blenderartists.org/t/free-animation-kit-needs-your-help/1189275
2 important questions to be answered please:

1.)
Is “Pie Menu Editor” capable of switching between pre-created custom workspaces,
in order to switch between different workspaces more easily via pie menus than with
tedious default top bar side scrolling?

2.)
Can I save & export custom pie menus created with “Pie Menu Editor” and distribute them for free to people who didn’t purchase and install “Pie Menu Editor”?

Thanks for any clarifying information.

Could you show me how to use it in a case like this (macro)?
blender_2019-11-13_22-31-41

  1. yes
  2. no pme is needed

So not the final blender 2.80 upgrade solution for my CC-BY-SA-4.0 project :frowning:
https://flattiefolks.wordpress.com
but thanks anyway. (and despite PME’s fair price)

The example works with 1 click in my case:
Hold down a hotkey to open the pie,
hover a button you want to click and release the hotkey.

Not sure this is possible. Will try to find a way.

1 Like

Yes, you can do this in PME.
But in your case it’s better to code some custom search-operator, which opens a search popup:

import bpy


class WORKSPACE_OT_select(bpy.types.Operator):
    bl_idname = "workspace.select"
    bl_label = "Select Workspace"
    bl_description = "Select workspace"
    bl_property = "workspace"

    enum_items = None

    def get_items(self, context):
        if WORKSPACE_OT_select.enum_items is None:
            enum_items = []

            for w in bpy.data.workspaces:
                identifier, name, description = \
                    w.name, w.name, w.name
                if context.workspace.name == identifier:
                    name += "|Active"
                enum_items.append((
                    identifier,
                    name,
                    description))

            WORKSPACE_OT_select.enum_items = enum_items

        return WORKSPACE_OT_select.enum_items

    workspace = bpy.props.EnumProperty(items=get_items)

    def execute(self, context):
        if not self.workspace or self.workspace not in bpy.data.workspaces:
            return {'CANCELLED'}

        context.window.workspace = bpy.data.workspaces[self.workspace]
        return {'FINISHED'}

    def invoke(self, context, event):
        WORKSPACE_OT_select.enum_items = None
        context.window_manager.invoke_search_popup(self)
        return {'FINISHED'}



def register():
    bpy.utils.register_class(WORKSPACE_OT_select)


def unregister():
    bpy.utils.unregister_class(WORKSPACE_OT_select)


if __name__ == "__main__":
    register()

    # test call
    bpy.ops.workspace.select('INVOKE_DEFAULT')

You can test this operator in Blender Text Editor.
Copy, paste and press Run Script button.

No, PME doesn’t support this.

4 Likes

Try this:

return C.space_data.local_view is not None
2 Likes

Thanks, will check your menus in GP mode tomorrow.

2 Likes

@roaoao:
Wow, your script is working like a charm, exactly what I’m looking for. :+1:
By your much appreciated help, the further development of “Flattiefolks Animation Kit” seems to be assured, at last. Thank you so much!!!

Is there any way to call the workspaces dropdown menu from your script within any blender view window by keyboard shortcut? So far this only worked for a “Run Script” shortcut within the text editor area only.

Yes, use Screen Editing keymap which allows to override all existing keyboard shortcuts in all areas.
Eg (ctrl+shift+Space shortcut):

import bpy


class WORKSPACE_OT_select(bpy.types.Operator):
    bl_idname = "workspace.select"
    bl_label = "Select Workspace"
    bl_description = "Select workspace"
    bl_property = "workspace"

    enum_items = None

    def get_items(self, context):
        if WORKSPACE_OT_select.enum_items is None:
            enum_items = []

            for w in bpy.data.workspaces:
                identifier, name, description = \
                    w.name, w.name, w.name
                if context.workspace.name == identifier:
                    name += "|Active"
                enum_items.append((
                    identifier,
                    name,
                    description))

            WORKSPACE_OT_select.enum_items = enum_items

        return WORKSPACE_OT_select.enum_items

    workspace = bpy.props.EnumProperty(items=get_items)

    def execute(self, context):
        if not self.workspace or self.workspace not in bpy.data.workspaces:
            return {'CANCELLED'}

        context.window.workspace = bpy.data.workspaces[self.workspace]
        return {'FINISHED'}

    def invoke(self, context, event):
        WORKSPACE_OT_select.enum_items = None
        context.window_manager.invoke_search_popup(self)
        return {'FINISHED'}


addon_keymaps = []


def register():
    bpy.utils.register_class(WORKSPACE_OT_select)
    
    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(
        name='Screen Editing')

    kmi = km.keymap_items.new(
        WORKSPACE_OT_select.bl_idname, 'SPACE', 'PRESS', 
        ctrl=True, shift=True)

    addon_keymaps.append((km, kmi))


def unregister():
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
        
    addon_keymaps.clear()
    
    bpy.utils.unregister_class(WORKSPACE_OT_select)


if __name__ == "__main__":
    register()


4 Likes

This is the perfect solution, now I can register your enhanced script and save it in combination with the project file. Thank you very much again :congratulations:, your coding knowledge is excellent. Can the script also be installed from file (Preferences/Add-ons) as *.py Add-on?

Besides, maybe you’d have an idea to help me out with this one last step, too?:

Sure, just add add-on metadata:

bl_info = {
    "name": "My Add-on Name",
    "category": "Scene",
}

import bpy

...

Yes, you can override TOPBAR_HT_upper_bar.draw_left() function:

import bpy


def my_draw_left(self, context):
    layout = self.layout

    window = context.window
    screen = context.screen

    bpy.types.TOPBAR_MT_editor_menus.draw_collapsible(context, layout)

    layout.separator()

    if not screen.show_fullscreen:
        pass
    else:
        layout.operator(
            "screen.back_to_previous",
            icon='SCREEN_BACK',
            text="Back to Previous",
        )


def register():
    bpy.types.TOPBAR_HT_upper_bar.default_draw_left = \
        bpy.types.TOPBAR_HT_upper_bar.draw_left
    bpy.types.TOPBAR_HT_upper_bar.draw_left = my_draw_left


def unregister():
    bpy.types.TOPBAR_HT_upper_bar.draw_left = \
        bpy.types.TOPBAR_HT_upper_bar.default_draw_left


if __name__ == "__main__":
    register()

Comment or delete bpy.types.TOPBAR_MT_editor_menus.draw_collapsible(context, layout) line to hide menubar.

2 Likes

How do you check if there’s an Active Selection under the mouse?