How to invert trackpad direction in 2.93 with Python add-on?

Hi, recently with the release of 2.92, a change has been introduce to correct a “bug”. The unfortunate thing about this change is that not only does it make this change it removes the option for the user to revert this change, leaving the user powerless essentially. Very much an ‘Apple’ move as one user mentioned here: https://developer.blender.org/rB055ed335a111bebed7193acd083f54d5c82929ff

I would like to create a Python add-on to revert this change and give the user the option to invert their trackpad movements to “Natural”

However, while I can code in Python, I’m not exactly sure how to do this within bpy.

The farthest I’ve gotten is find this: https://blender.stackexchange.com/questions/81794/how-to-used-the-mousescroll-to-as-a-modal-function-to-for-example-move-the-obj

However, the docs say " Note that [bpy.types.bpy_struct] is not actually available from within Blender, it only exists for the purpose of documentation."

I know that fundamentally this is a simple change, all it takes is just making the scroll direction negative if positive and positive if negative.

However, I’m not exactly sure how to access, and manipulate the scroll direction while also not affecting performance in any way.

I will be posting my progress here for those who want to help. Another thing I just found out, how to get the region matrix, which basically gives the coordinates of zoom, and location of the viewport navigation:

def get_region_matrix():
    for area in bpy.context.screen.areas:
        if area.type == 'VIEW_3D':
            return area.spaces[0].region_3d.view_matrix

Which results in:

<Matrix 4x4 (-0.4939,  0.8695, 0.0000,   0.0000)
            (-0.3341, -0.1898, 0.9232,   0.0000)
            ( 0.8027,  0.4560, 0.3843, -17.6787)
            ( 0.0000,  0.0000, 0.0000,   1.0000)>

And if you move your mouse around in the viewport, and run the function again, it’ll produce different numbers. Yay! One small step…

Okay, so now I know that where the -17 is controls the zoom. Now if you paste something like this in the Python console:

get_region_matrix()[2][-1] = -3

It will change the zoom. yay! another small step.

Hey - any update on this python add-on of yours?

Hey Noah, not yet, unfortunately. Been told it’s unadvisable because it might be a hacky way to do it (but maybe they just couldn’t think of a clean way to do it). But I plan to try it either way. Will let you know if I complete it.

Thanks man! Appreciate the reply nonetheless.

Hi Joe and Noah, I found a way to reverse the natural trackpad direction without python or anything.

You need to install “Scroll Reverser for MacOS” here’s the link : Scroll Reverser for macOS

It works perfectly with my 2021 MacBook 14" M1 Pro. Before I installed it, in my system preferences I ALREADY HAD natural trackpad direction ticked (in system preferences).

Once installed (and you have given it access to do it’s thing) make sure you have all of these ticked:

In terms of not letting it effect your scroll direction (when you’re on safari) play around with ticking and unticking “Natural trackpad direction” in system preferences and seeing which one was normal for you