4

The mesh hide has two options, hide selected or hide non selected. So you need two buttons, but could it be possible to simply call the pie menu and then with an addition button pressed lets say RMB execute the other options?

this would be like this:

Shift+Alt+ RMB calls the Pie menu

LMB executes hide selected MBB executes hide unselected

enter image description here

Ray Mairlot
  • 29,192
  • 11
  • 103
  • 125
Claas Kuhnen
  • 1,727
  • 4
  • 18
  • 40

1 Answers1

0

I've found an answer on this, but it still need some coding

Standard Pie Menu looks like this:

class PieMenuClass(Menu):
    bl_idname = "pie.pie_menu_class"
    bl_label = ""

    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()


        pie.operator("mesh.subdivide", text="Subdivide")
        ...

This Pie adds a subdivide operator. Let's say we add more two options - unsubdivide while holding "Shift" and Smooth subdivide with CTRL pressed.

First add register!!! =) one more class:

class MYSubdivide(Operator):
    bl_idname = "class.my_subdivide"
    bl_label = "Ctrl - unsubdivide, Shift - Smooth"


    def invoke(self,context,event):
        if event.shift:
            bpy.ops.mesh.subdivide(smoothness = 1)
        elif event.alt:
            bpy.ops.mesh.unsubdivide()
        elif event.ctrl:
                bpy.ops.mesh.subdivide_edgering(number_cuts =1)
        else:
            bpy.ops.mesh.subdivide()


        return {'FINISHED'}

First declaration then changed to call this class:

class PieMenuClass(Menu):
    bl_idname = "pie.pie_menu_class"
    bl_label = ""

    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()


        pie.operator("class.my_subdivide", text="Subdivide")

The only problem is that after using this method it's impossible for me to use REDO LAST function F6 ==(( steel need a solution.

user2439
  • 351
  • 1
  • 2
  • 8
  • 1
    see this https://blender.stackexchange.com/questions/23998/python-ctrlclick-for-buttons-capture-invocation-event – user2439 May 24 '17 at 09:04
  • 1
    and this https://docs.blender.org/api/blender_python_api_2_73a_release/bpy.types.Event.html – user2439 May 24 '17 at 09:04