Post #1719: fj

📋 Metadata

🏷️ Tags

pie-menu hotkeys advanced solved v1-18-8

  • Pie Menu Editor
  • Poll methods
  • Python Scripting
  • Hotkey Configuration

💬 Content

fjg3d:

Is there a way to trigger a pie with just LMB (+ hold, for example) when over an empty part of the 3dview, without also triggering when over an object?

Blender 2.8 has bpy.ops.view3d.select_or_deselect_all() operator which can be useful in this case.

Use this code as a poll method.
No objects under mouse (your case):

bpy.ops.view3d.select_or_deselect_all('INVOKE_DEFAULT', True); is_empty_area = not C.selected_objects; bpy.ops.ed.undo(); return is_empty_area

Has objects under mouse:

bpy.ops.view3d.select_or_deselect_all('INVOKE_DEFAULT', True); is_empty_area = not C.selected_objects; bpy.ops.ed.undo(); return not is_empty_area

❤️ 2 likes


🔗 View on Blender Artists