1
$\begingroup$

I seem to be unable to find any information online about how to define a pie menu operator position. They seem to change a lot - for example the three button section flips position between 7 and 3.

Is there no way to force a button to only show up on a certain position?

enter image description here enter image description here

$\endgroup$
3
$\begingroup$

You are showing two different menus, one in object mode the other in edit mode, the different names above the centre circle indicate they are using different code - the name comes from bl_label of the menu class.

While the order that items appear does seem odd at first, there is an order to the madness. The primary design is to have one operator at each position, starting from the left, then the right, bottom, top, then the top diagonals and the bottom diagonals.

Run the following script in the text editor and have a look at the items positions, then uncomment one of the lines between operators and see how it effects the layout of the menu, repeat for each commented line.

import bpy

class VIEW3D_PIE_template(bpy.types.Menu):
    bl_label = "Render"

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

        pie = layout.menu_pie()
        pie.operator("render.render", text='one')
        #pie = pie.column()
        pie.operator("render.render", text='two')
        pie.operator("render.render", text='three')
        #pie = layout.menu_pie()
        pie.operator("render.render", text='four')
        #pie = pie.row()
        pie.operator("render.render", text='five')
        pie.operator("render.render", text='six')
        #pie = layout.menu_pie()
        pie.operator("render.render", text='seven')
        pie.operator("render.render", text='eight')

if __name__ == "__main__":
    try:
        bpy.utils.unregister_class(VIEW3D_PIE_template)
    except:
        pass
    bpy.utils.register_class(VIEW3D_PIE_template)

    bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_template")
$\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.