DOUBLE_CLICK type not being recognized within modal operation #69235

Closed
opened 2019-08-28 04:02:01 +02:00 by Sam Vimes · 6 comments

System Information
Operating system: Windows-8.1-6.3.9600 64 Bits
Graphics card: GeForce GTX 1660 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.39

Blender Version
Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: f6cb5f5449
Worked: (optional)

Short description of error
When trying to work in some custom actions through a modal to recognize a Double Click event type, the action is not recognized. I have tried raising and lowering the double click timing in preferences, but nothing seems to work.

Exact steps for others to reproduce the error
This script checks for type DOUBLE_CLICK first, and then posts a RELEASE type to verify it passed through with LEFTMOUSE.

I'm newish to Blender but not to Python. Apologies if I missed something in this setup, but it seems pretty straightforward.

import bpy

class ModalTimerOperator(bpy.types.Operator):
    """Operator which runs its self from a timer"""
    bl_idname = "wm.modal_timer_operator"
    bl_label = "Modal Timer Operator"

    _timer = None

    def modal(self, context, event):
        if event.type in {'LEFTMOUSE'}:
            if event.value in {'DOUBLE_CLICK'}:
                print('DOUBLE CLICK')
            elif event.value in {'RELEASE'}:
                print('RELEASE')
            return {'RUNNING_MODAL'}

        if event.type in {'ESC'}:
            self.cancel(context)
            return {'CANCELLED'}

        if event.type == 'TIMER':
            pass

        return {'PASS_THROUGH'}

    def execute(self, context):
        wm = context.window_manager
        self._timer = wm.event_timer_add(1, window = context.window)
        wm.modal_handler_add(self)
        return {'RUNNING_MODAL'}

    def cancel(self, context):
        wm = context.window_manager
        wm.event_timer_remove(self._timer)

def register():
    bpy.utils.register_class(ModalTimerOperator)

def unregister():
    bpy.utils.unregister_class(ModalTimerOperator)

if __name__ == "__main__":
    register()
    # test call
    bpy.ops.wm.modal_timer_operator('INVOKE_DEFAULT')
**System Information** Operating system: Windows-8.1-6.3.9600 64 Bits Graphics card: GeForce GTX 1660 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.39 **Blender Version** Broken: version: 2.80 (sub 75), branch: master, commit date: 2019-07-29 14:47, hash: `f6cb5f5449` Worked: (optional) **Short description of error** When trying to work in some custom actions through a modal to recognize a Double Click event type, the action is not recognized. I have tried raising and lowering the double click timing in preferences, but nothing seems to work. **Exact steps for others to reproduce the error** This script checks for type DOUBLE_CLICK first, and then posts a RELEASE type to verify it passed through with LEFTMOUSE. I'm newish to Blender but not to Python. Apologies if I missed something in this setup, but it seems pretty straightforward. ``` import bpy class ModalTimerOperator(bpy.types.Operator): """Operator which runs its self from a timer""" bl_idname = "wm.modal_timer_operator" bl_label = "Modal Timer Operator" _timer = None def modal(self, context, event): if event.type in {'LEFTMOUSE'}: if event.value in {'DOUBLE_CLICK'}: print('DOUBLE CLICK') elif event.value in {'RELEASE'}: print('RELEASE') return {'RUNNING_MODAL'} if event.type in {'ESC'}: self.cancel(context) return {'CANCELLED'} if event.type == 'TIMER': pass return {'PASS_THROUGH'} def execute(self, context): wm = context.window_manager self._timer = wm.event_timer_add(1, window = context.window) wm.modal_handler_add(self) return {'RUNNING_MODAL'} def cancel(self, context): wm = context.window_manager wm.event_timer_remove(self._timer) def register(): bpy.utils.register_class(ModalTimerOperator) def unregister(): bpy.utils.unregister_class(ModalTimerOperator) if __name__ == "__main__": register() # test call bpy.ops.wm.modal_timer_operator('INVOKE_DEFAULT') ```
Author

Added subscriber: @Vimes

Added subscriber: @Vimes

Added subscribers: @ideasman42, @iss

Added subscribers: @ideasman42, @iss

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

I can confirm, that event vale is never 'DOUBLE_CLICK'.

I am not 100% sure, but seems like bug to me

@ideasman42 can you classify this?

I can confirm, that event vale is never `'DOUBLE_CLICK'`. I am not 100% sure, but seems like bug to me @ideasman42 can you classify this?

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'
Campbell Barton self-assigned this 2020-01-10 06:03:16 +01:00

Marking as invalid since this is working as intended, see wm_event_modalkeymap.

If we removed logic to suppress double-click for modal operators, existing operators that compare against 'PRESS' would need to account for double click events too.

Marking as invalid since this is working as intended, see `wm_event_modalkeymap`. If we removed logic to suppress double-click for modal operators, existing operators that compare against 'PRESS' would need to account for double click events too.
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#69235
No description provided.