Post #5188: Hello. Can anyone help me with a poll? Right now I have a pie menu assigned when
📋 Metadata
- Author: paololazatin
- Date: 2024-07-25 02:11:12
- Type:
question - Quality Score: 7/10
- Replies (1): post_05189
🏷️ Tags
pie-menu hotkeys intermediate unsolved
⚙️ Related PME Features
- Pie Menu Editor
- Python Scripting
💬 Content
Hello. Can anyone help me with a poll? Right now I have a pie menu assigned when in editing a mesh and face mode is on. This is what I have for my poll:
return
bpy.context.selected_editable_objects and
bpy.context.active_object.type == 'MESH' and
bpy.context.object.mode=='EDIT' and
bpy.context.scene.tool_settings.mesh_select_mode[2]
Now what I want is to check if there is actually a face selected. I thought adding
any(face.select for face in bpy.context.active_object.data.polygons) would do the trick, but it always returns true.
And there is another thing. When I am in object mode, and I enter edit mode, select a face, my poll fails because selected_editable_objects returns empty, even if I already selected a face. So the workaround is to select the object first and then go to edit mode. This additional step is quit inconvenient.
So basically what I want is to have a poll that will allow me to popup my menu when there is any face selected, whether or not I selected the object before going into edit mode. Is this possible?
❤️ 1 likes