0
$\begingroup$

My based problem is below:

I bought a new 3D Mouse and want to see if it's helpful for me. It's a mouse with extra buttons (Spacemouse Pro). I want to try if it's helpful for modelling. For sculpting with a Wacom tab, it's rather good.

So my spacemouse hase only 15 buttons, and at least 5 of them are already useful set by default. When I use the 3DConnexion Driver and set a button to a certain keyboard key, like G then it doesn't work in Blender. Only when I set the key directly in Blender it works. So when I set in Blender the key on the 3D Mouse, it's not possible to press G, because grab is now a key on the 3D Mouse and not G. So if I want to use the keyboard, I could, but without the main commands...

I decided to design pie menus with key functions.

So I wanted to design my add on so that I could see it as one entry for my user preferences.

So is there any way to set two keys for the same function in Blender?

So the code of my subfiles works quite well. It's in big parts a mod if the still existing pie menu add on (I'm completly new to python).

I have a problem with following code:

import bpy
from bpy.props import (
        BoolProperty,
        PointerProperty,
        )
from bpy.types import (
        PropertyGroup,
        AddonPreferences,
        )

bl_info = {
    "name": "3D Viewport Pie Menus",
    "author": "meta-androcto, pitiwazou, chromoly, italic, Manuel Matz",
    "version": (1, 1, 6),
    "blender": (2, 7, 9),
    "description": "Individual Pie Menu Activation List",
    "location": "Addons Preferences",
    "warning": "",
    "wiki_url": ""
                "",
    "category": "Pie Menu"
    }

sub_modules_names = (
    "Spacepie_3D_Cursor_Menu",
    "Spacepie_Add_Primitives_Edit_Menu",
    "Spacepie_Add_Primitives_Menu",
    "Spacepie_Add_Primitives_Object_Menu",
    "Spacepie_Basic_Actions_Edit",
    "Spacepie_Basic_Actions_Object",
    "Spacepie_Delete_Edit",
    "Spacepie_Modes",
    "Spacepie_Sculpt_Menu",
    "Spacepie_Selections",
    )


sub_modules = [__import__(__package__ + "." + submod, {}, {}, submod) for
              submod in sub_modules_names]
sub_modules.sort(key=lambda mod: (mod.bl_info['category'], mod.bl_info['name']))

Blender hangs at the place:

sub_modules = [__import__(__package__ + "." + submod, {}, {}, submod) for
              submod in sub_modules_names]
sub_modules.sort(key=lambda mod: (mod.bl_info['category'], mod.bl_info['name']))

Here an example Subfile

## Pie Menu: Basic Actions; Edit Mode

bl_info #...= {
    }

import bpy
from bpy.types import Menu

# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)

# define a central Classname

class Edit_Pie_Basic_Actions(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Action"
    bl_idname="mesh.BasicPie"
    def draw(self, context):
        layout = self.layout

        pie = layout.menu_pie()

        pie.operator("transform.translate", text="Grab")
        pie.operator("transform.rotate")
        #...
        pie.operator("mesh.edge_face_add")

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

    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name="Mesh")
    kmi = km.keymap_items.new("wm.call_menu_pie", "NDOF_BUTTON_ROTATE", "PRESS").properties.name="mesh.BasicPie"

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

if __name__ == "__main__":
    register()
$\endgroup$
4
  • $\begingroup$ Yes, you can have multiple shortcuts to the same operator. $\endgroup$ Commented May 28, 2018 at 20:23
  • $\begingroup$ Thanks. Also to Ray. I just add a new entry to the key map and copy the Entries and use another key setting at the copied entry, right? That's i didnt saw... $\endgroup$
    – M. Matz
    Commented May 28, 2018 at 20:45
  • $\begingroup$ Correct. New entry with everything exactly same except the shortcut, should work fine. $\endgroup$ Commented May 28, 2018 at 21:48
  • $\begingroup$ Okay, the Problem seems to be in the sub modules names block, but I'm still don't find the error $\endgroup$
    – M. Matz
    Commented May 30, 2018 at 16:14

0

You must log in to answer this question.

Browse other questions tagged .