48
$\begingroup$

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))
#...
$\endgroup$
9
  • 1
    $\begingroup$ Could be a bug or missing feature, you should contact a dev in IRC. $\endgroup$
    – CodeManX
    Dec 11, 2013 at 1:48
  • $\begingroup$ @rraallvv was this ever resolved? $\endgroup$
    – zeffii
    Jun 8, 2015 at 17:44
  • 3
    $\begingroup$ 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 developer.blender.org/T30746 $\endgroup$ Aug 24, 2015 at 0:03
  • $\begingroup$ Have you tried reading through the C code to see how those events are generated? $\endgroup$
    – dr. Sybren
    Jun 12, 2017 at 15:02
  • 1
    $\begingroup$ @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. $\endgroup$
    – rraallvv
    Jun 12, 2017 at 15:19

1 Answer 1

0
$\begingroup$

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

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .