So here is my current pie menu. It works quite well but only on one object sadly.

What would be the best way to design a poll function so that based on what modifier type I select in the pie it will be applied to all selected objects.

Meaning is there a way to define this with one universal command?

class PieManipulateObject_Ext(Menu):
    bl_idname = "pie.manipulateobject_ext"
    bl_label = "Add Modifier"

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

        scene = context.scene  

        pie = layout.menu_pie()
        #4 - LEFT
        pie.operator("object.modifier_add", text="Array", icon="MOD_ARRAY").type='ARRAY'
        #6 - RIGHT
        pie.operator("object.modifier_add", text="Sub-Surface", icon="MOD_SUBSURF").type='SUBSURF'
        #2 - BOTTOM
        box = pie.box()
        col = box.column()
        col.operator("object.modifier_add", text="Shrinkwrap", icon="MOD_SHRINKWRAP").type='SHRINKWRAP'
        col.operator("object.modifier_add", text="Curve", icon="MOD_CURVE").type='CURVE'
        col.operator("object.modifier_add", text="Deform", icon="MOD_SIMPLEDEFORM").type='SIMPLE_DEFORM'
        col.operator("object.modifier_add", text="Displace", icon="MOD_DISPLACE").type='DISPLACE'        
        col.operator("object.modifier_add", text="Lattice", icon="MOD_LATTICE").type='LATTICE'
        #8 - TOP
        pie.operator("object.modifier_add", text="Screw", icon="MOD_SCREW").type='SCREW'
        #7 - TOP - LEFT
        pie.operator("object.modifier_add", text="Solidify", icon="MOD_SOLIDIFY").type='SOLIDIFY'
        #9 - TOP - RIGHT
        pie.operator("object.modifier_add", text="Mirror", icon="MOD_SUBSURF").type='MIRROR'
        #1 - BOTTOM - LEFT
        pie.operator("object.modifier_add", text="Edge Split", icon="MOD_EDGESPLIT").type='EDGE_SPLIT'
        #3 - BOTTOM - RIGHT
        pie.operator("object.modifier_add", text="Bevel", icon="MOD_BEVEL").type='BEVEL'
  • $\begingroup$ related: blender.stackexchange.com/a/42081/3710 $\endgroup$ – p2or Jan 27 '16 at 20:15
  • $\begingroup$ Yeah this is maybe related but I mainly am curious to have one operator that applies what ever selected modifier to the selected objects. The example works on an object per object basis. I want to prevent having to wrote 10 add modifier commands for 10 pie buttons if possible. $\endgroup$ – Claas Kuhnen Jan 27 '16 at 20:45
  • $\begingroup$ Related because: what if the modifier already exists? BTW: What about creating a dynamic modifier enum based on the selected object from a custom dict? Note that all modifiers are not accessable for all object types. $\endgroup$ – p2or Jan 28 '16 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.