There’s more context to this, like I’m not just straight up disabling the second pie menu slice, it’s based on a bool. I’m going out of my way a bit, even though it isn’t necessary outside of pie menu, to completely separate these 2 pie slices. Despite this, and disabling the second one, the first one is also greyed out and disabled. The same will happen for all 8 pie slices, even if I only disable one of them. Why?
I not sure there is a way to disable only one pie menu slice.
Why your code disables everything though is seems you can’t have pie menus inside of pie menus (blender source code). If you call menu_pie() from a pie menu layout, it returns itself, so pie, sub, pie2, and sub2 are actually all the same pie menu.
There should be a way to disable one slice, because it doesn’t make sense otherwise. It isn’t doing what you are actually telling it to do, and is inconsistent with everything else.
That goofy code is my example of “going out of my way a bit” to somehow separate these pie slices from each other as far as Blender deciding to disable all of them, instead of what I’ve asked it to do. This is what I want, and is what works elsewhere:
layout = self.layout
pie = layout.menu_pie()
pie.operator("view3d.square_select", icon='MESH_PLANE', depress=inputs.square_select)
pie = layout.menu_pie()
pie.enabled = False
pie.operator("view3d.toggle_backface", icon='NORMALS_FACE', depress=depress_bface)
If I just make it into a row instead of a pie menu, it acts the way you tell it to. I would get 2 operators next to each other, but only the second one would be disabled, not both.
layout = self.layout
pie = layout.row()
pie.operator("view3d.square_select", icon='MESH_PLANE', depress=inputs.square_select)
pie = layout.row()
pie.enabled = False
pie.operator("view3d.toggle_backface", icon='NORMALS_FACE', depress=depress_bface)
Sounds like something is broken, or the solution to this is just obscure enough that it’s somewhat unknown. I was pretty sure that I’ve seen some of the built-in pie menu stuff greyed out in a way that makes sense, instead of this “all or nothing” situation I am dealing with.
Yeah the Blender API documentation does not make it clear that menu_pie() does not return a new menu pie if the layout already has a pie menu in it. That is a special case only for pie meuns.
pie = layout.menu_pie()
# because pie is already a pie menu, menu_pie() returns pie,
# so all this does is set sub equal to pie
sub = pie.menu_pie()
# This is the same as pie.enabled = True because sub and pie are the exact same object
sub.enabled = False
Rows work because row() creates a new row and you have two different rows to work with, which is impossible with menu_pie().
Operators can disable themselves with their poll method, and then would show up disabled in the pie menu. If you are calling your own operators, and you can figure out if the operator should be disabled based only on the data from the context, you could use that.