Post #1719:
fj
📋 Metadata
- Author: roaoao
- Date: 2018-12-04 19:52:07
- Type:
answer - Quality Score: 8/10
- Reply to: post_01718
- Replies (1): post_01738
🏷️ Tags
pie-menu hotkeys advanced solved v1-18-8
⚙️ Related PME Features
- 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