2
$\begingroup$

I want to make in my addon PIE like that (next GIF PIE's made by PME addon), when PIE menu item call another PIE menu.

I have no ideas how PME do this and dig inside not the best option - ton of stuff going on under the hood. I can't find such examples across the internet - 100 500 tutorials for just PIE, but not PIE inside PIE.

When I try to put just menu it gives me menu like this. Not what I looking for.

class FRP_MT_PIE_Menu(bpy.types.Menu):
bl_idname = 'FRP_MT_PIE_Menu'
bl_label = 'FRP_MT_PIE_Menu'

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

    sc_frp = context.scene.frp_props
    an_a = sc_frp.frp_angle_a
    an_b = sc_frp.frp_angle_b
    to = sc_frp.frp_transform

    #LT
    pie.operator("fgt.frp_rotator", text="- 90", icon='LOOP_FORWARDS').R_Angle = -90.0
    #RT
    pie.operator("fgt.frp_rotator", text="90", icon='LOOP_BACK').R_Angle = 90.0
    #TO
    pie.operator("fgt.frp_rotator", text="180", icon='FILE_REFRESH').R_Angle = 180.0
    #BO
    pie.menu("FRP_MT_PIE_SMenu_TO", text="TO - " + to, icon='NONE')
    #LTTO
    pie.operator("fgt.frp_rotator", text='- ' + an_a, icon='LOOP_FORWARDS').R_Angle = -1 * float(an_a)
    #RTTO
    pie.operator("fgt.frp_rotator", text= an_a, icon='LOOP_BACK').R_Angle = float(an_a)
    #LTBO
    pie.operator("fgt.frp_rotator", text='- ' + an_b, icon='LOOP_FORWARDS').R_Angle = -1 * float(an_b)
    #RTBO
    pie.operator("fgt.frp_rotator", text= an_b, icon='LOOP_BACK').R_Angle = float(an_b)

Using some menu_pie or pie instead of just menu give error like this:

layout.menu_pie("FRP_MT_PIE_SMenu_TO", text="TO - " + to, icon='NONE')
TypeError: UILayout.menu_pie(): takes at most 0 arguments, got 3"

Any ideas guys how to make it work as on first GIF - PIE menu inside PIE menu?

$\endgroup$
2
  • $\begingroup$ Thank you for reply ,but gives a big clue how to do this gives, maybe, for you. I have read this API doc page already... and it gives 0 clues for me how to make PIE inside PIE. I really don't understand how it have to look to work as I want. I'm not some coder CODER man, just some copy/paste coder, beginer if you want. If you can help - show please some example, please, or write some explanation. If I knew how and what I wouldn't ask here for help. $\endgroup$
    – IIIFGIII
    May 18 '21 at 14:43
  • $\begingroup$ Apologies. IIRC this has changed and could previously add a pie menu to a pie menu (at least thought you could, on testing see that it expands as a regular menu as shown (using pie.menu) Added an answer of how to do this with bpy.ops.wm.call_menu_pie $\endgroup$
    – batFINGER
    May 18 '21 at 14:51
2
$\begingroup$

Call pie menu operator.

Example using the Text Editor > Templates > Python > UI Menu Pie template.

Calls itself if clicked on and expands as another pie menu.

Note. Does not auto expand as a pie menu.

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)


class VIEW3D_MT_PIE_template(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Select Mode"

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

        pie = layout.menu_pie()
        # operator_enum will just spread all available options
        # for the type enum of the operator on the pie
        pie.operator_enum("mesh.select_mode", "type")

        # this one expands as a regular menu
        pie.menu('VIEW3D_MT_PIE_template')
        
        # this one when pressed expands as a pie menu (of self)
        op = pie.operator("wm.call_menu_pie")
        op.name = 'VIEW3D_MT_PIE_template'

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


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


if __name__ == "__main__":
    register()

    bpy.ops.wm.call_menu_pie(name="VIEW3D_MT_PIE_template")
$\endgroup$
1
  • $\begingroup$ In my case pie.operator("wm.call_menu_pie", text="TO - " + to, icon='NONE').name = 'FRP_MT_PIE_SMenu_TO'. Thank you kindly, I hope this topic would help others like me (already spent hours to guess how to make it...) $\endgroup$
    – IIIFGIII
    May 18 '21 at 15:09

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.