49

I'm trying to write an addon to customize the trackpad panning, zoomimg, and rotating gestures, but can't find a way to read the actual trackpad parameters for position and so on. The properties in the event structure (mouse_prev_x/y, mouse_x/y, mouse_region_x/y) shows the current pointer position which happens to be standing still on the screen.

This is the addon that I'm talking about:

space_view3d_pan_naturally.py

There are no examples on the web for handling the TRACKPADPAN event.

The class bpy.types.Event is the one that is supposed to have the relevant parameters to retrieve from the TRACKPADPAN event, that is what I'm guessing from the documentation.

This snippet of code in particular, from my add-on, printf to the info view that the trackpad event has nothing to do with the mouse coordinates that are available in bpy.types.Event

#....
def modal(self, context, event):
    #....
    if event.type == 'TRACKPADPAN':     
        self.report({'INFO'}, str(event.mouse_x))
#...
Sushith
  • 3
  • 4
rraallvv
  • 4,551
  • 3
  • 19
  • 28
  • 1
    Could be a bug or missing feature, you should contact a dev in IRC. – CodeManX Dec 11 '13 at 01:48
  • @rraallvv was this ever resolved? – zeffii Jun 08 '15 at 17:44
  • 3
    There is a patch for this on the developers page if you want to build your own blender from it ir take over the patch so it can go into official blender https://developer.blender.org/T30746 – Aaron Carlisle Aug 24 '15 at 00:03
  • Have you tried reading through the C code to see how those events are generated? – dr. Sybren Jun 12 '17 at 15:02
  • 1
    @dr.Sybren If I remember correctly I needed to patch the sources in order to get the plugin to work correctly, but that kind of defeats the propose of scripting a plugin in the first place. I haven't tried with the latest release though. – rraallvv Jun 12 '17 at 15:19
  • Well, if you add something nice, you can always send in a patch and get it into Blender itself. – dr. Sybren Jun 12 '17 at 15:37
  • @dr.Sybren I'm mostly using maya for 3d modeling these days , but if I get the chance I'll give it a try with the latest release. – rraallvv Jun 12 '17 at 16:00
  • I'm not sure what you actually need, but try this https://www.reddit.com/r/blender/comments/840439/navigating_with_a_trackpad/ – joejoejoebob0 Nov 28 '18 at 14:47
  • pan - shift + click scroll button zoom in/out - Move scroll wheel up or down Rotate - click mouse button and move around. – JakeT Oct 25 '19 at 21:25
  • trackpadpan, i can't find docs on an underlying library. my reasoning currently thinks this would be effectively trackpad "scroll" events, or atleast, by the time we're in desktop-land, a trackpad pan-up pan-down is often considered a mosuewheel up/down event.

    so i wonder if part of the disconnect is coming from the hardware/driver/desktop before blender handles the event data at all. for comparison, SDL doesn't have a primitive for trackpad pan, only down up and motion from which we could build our own pan event accumulator glue DIY

    – ThorSummoner Jan 13 '24 at 08:17

1 Answers1

0

Go to menu Edit > Preferences > Input and tick the Emulate 3 Button Mouse checkbox.

Harry McKenzie
  • 10,995
  • 8
  • 23
  • 51
Tech Crate
  • 403
  • 4
  • 18