Keymaps added from python doesn't behave correctly. #60776

Closed
opened 2019-01-23 00:13:04 +01:00 by Jean Da Costa · 7 comments

System Information
Operating system: Windows 7
Graphics card: Nvidia geforce 1050

Blender Version
Broken: 7f40d553f9

Short description of error
A keymap added from python to call a custom menu makes the menu behaves incorrectly.
The menu requires a double click in order to activate any entrie

Exact steps for others to reproduce the error
use the default cube scene
go to edit mode
paste and run this code on text editor:
press Alt + W to activate the custom menu,
in principle, it might look ok but if you try to select an option, it requires a second click (which shouldn't).

  import bpy
  from bpy.types import Menu
# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)
  class VIEW3D_PIE_template(Menu):
    # label is displayed at the center of the pie menu.
      bl_label = "Select Mode"
      def draw(self, context):
          layout = self.layout
          pie = layout.menu_pie()
        - operator_enum will just spread all available options
        - for the type enum of the operator on the pie
          pie.operator_enum("mesh.select_mode", "type")
  def register():
      km = bpy.context.window_manager.keyconfigs.addon.keymaps.new(name="3D View", space_type="VIEW_3D")
      kmi = km.keymap_items.new("wm.call_menu_pie", type="W", alt=True, value="PRESS")
      kmi.properties.name = "VIEW3D_PIE_template"
      
      bpy.utils.register_class(VIEW3D_PIE_template)
  if __name__ == "__main__":
      register()
**System Information** Operating system: Windows 7 Graphics card: Nvidia geforce 1050 **Blender Version** Broken: 7f40d553f903 **Short description of error** A keymap added from python to call a custom menu makes the menu behaves incorrectly. The menu requires a double click in order to activate any entrie **Exact steps for others to reproduce the error** use the default cube scene go to edit mode paste and run this code on text editor: press Alt + W to activate the custom menu, in principle, it might look ok but if you try to select an option, it requires a second click (which shouldn't). ``` import bpy from bpy.types import Menu ``` # spawn an edit mode selection pie (run while object is in edit mode to get a valid output) ``` class VIEW3D_PIE_template(Menu): ``` # label is displayed at the center of the pie menu. ``` bl_label = "Select Mode" ``` ``` def draw(self, context): layout = self.layout ``` ``` pie = layout.menu_pie() ``` - operator_enum will just spread all available options - for the type enum of the operator on the pie ``` pie.operator_enum("mesh.select_mode", "type") ``` ``` def register(): km = bpy.context.window_manager.keyconfigs.addon.keymaps.new(name="3D View", space_type="VIEW_3D") kmi = km.keymap_items.new("wm.call_menu_pie", type="W", alt=True, value="PRESS") kmi.properties.name = "VIEW3D_PIE_template" bpy.utils.register_class(VIEW3D_PIE_template) ``` ``` if __name__ == "__main__": register()
Author

Added subscriber: @jeacom

Added subscriber: @jeacom
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

Seems to work as expected here. Can you upload a short .gif to show the issue?

pie menu.gif

Seems to work as expected here. Can you upload a short .gif to show the issue? ![pie menu.gif](https://archive.blender.org/developer/F6377908/pie_menu.gif)
Author

@JacquesLucke It turns out that this problem is being caused by the emulate 3 button mouse option,
here's the .gif
ezgif-2-9880e1caa243.gif

@JacquesLucke It turns out that this problem is being caused by the emulate 3 button mouse option, here's the .gif ![ezgif-2-9880e1caa243.gif](https://archive.blender.org/developer/F6379665/ezgif-2-9880e1caa243.gif)

Added subscriber: @brecht

Added subscriber: @brecht

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Brecht Van Lommel self-assigned this 2019-01-25 12:00:54 +01:00

Already solved in 0b37399cbe.

Already solved in 0b37399cbe.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#60776
No description provided.