Post #5188: Hello. Can anyone help me with a poll? Right now I have a pie menu assigned when

📋 Metadata

🏷️ Tags

pie-menu hotkeys intermediate unsolved

  • 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


🔗 View on Blender Artists