Maya Alt like Navigation with Spacebar (AHK script)

Hello, coming from XSI and Maya I’ve had a hard time getting into Blenders default navigation scheme as I much prefer to use 3 button mouse or wacom pen. I don’t want to use the Industry Standard keymap as it lacks a lot of shortcuts compared to Blender’s keymap and it’s also really hard to follow along tutorials while learning the program.

So I’ve created an Autohotkey script that works with Blender’s default keymap while also retaining the native use of the spacebar. Simply put the script intercepts spacebar and mouse clicks and checks if space is being held down, if so then sends correct default Blender navigation keys instead. If there was no mouse clicks and if space is released within a short duration (like tap) it will send a regular space key to trigger play or menu or what ever you’ve set it to.

The advantage with this is that you don’t have to manually try and remap the keys in Blender for all the views and editors. The reason for creating this script was that I ran into so much trouble trying to modify the existing Blender keymap to use space for navigation and it created so many conflicts with tools like the knife and in some cases didn’t work at all in texture paint/sculpt mode etc as there seem to be a lot of hard-coded stuff in blender and this AHK script circumvents this entirely.

Usage:

  1. Download and install Autohotkey (google it).
  2. Copy this code and save it as Blender_Spacebar_Navigation.ahk file.
  3. Run the scipt.
  4. Navigate with spacebar and mouse/wacom pen, Viola!

Edited 2020-03-23 - Corrected middle mouse button from just clicking to being able to being held down.

; JoelArt | 2020-03-23 | Version 1.01
if not A_IsAdmin {
  Run *RunAs "%A_ScriptFullPath%"
  ExitApp
}

#IfWinActive ahk_exe blender.exe
#NoEnv
#Persistent
#SingleInstance Force
SetKeyDelay,-1
SendMode Input


$Space::
start := A_TickCount            ; measure current time.
KeyWait, Space                  ; wait for Space to be released.
duration := A_TickCount - start ; calculate if Space was held for less than ### ms.
if (duration < 180){            ; if so
	SendEvent, {Space}            ; send Space else send nothing.
}
return



$LButton::
if GetKeyState("Space", "p"){ ; If Spacebar is being held down while Mouse button is pressed.
	Send {MButton Down}
	KeyWait, LButton
	Send {MButton Up}
return
} else {
	Click, down ; Click is necessary over Send as the button sometimes stops responding for unknown reasons.
	KeyWait, LButton
	Click, up
	return
}
return



$RButton::
if GetKeyState("Space", "p"){
	SendEvent, ^{MButton Down}
	KeyWait, RButton
	SendEvent, ^{MButton Up}
	Return
} else {
	Click, down, Right
	KeyWait, RButton
	Click, up, Right
	return
}
return


; Middle mouse seems to work differently fomr LMB and RMB so use these lines instead.
$MButton::
if GetKeyState("Space", "p"){
	SendEvent +{Mbutton down} ; Use SendEvent "+" so not to trigger the shift+space command in Blender.
	Return
} else {
	Click, down, Right
	KeyWait, RButton
	Click, up, Right
	Return
}
Return

MButton up::
	SendEvent {Mbutton up}
Return



; Extra Commands

; ; Sets the window in focus to On Top so to make the system console or torn off floating panels stay ontop of Blender's UI (Space + F1)
; $F1::
; if GetKeyState("Space", "p"){
; Winset, Alwaysontop, , A
; } else {
; 	SendEvent {F1}
; 	Return
; }
; Return


; Pause::
; TrayTip ExitApp, Blender_Spacebar_Navigation.ahk
; ; Sleep 1250
; ExitApp
; Return


; ScrollLock::
; TrayTip Reloading, Blender_Spacebar_Navigation.ahk
; ; Sleep 1250
; Reload
; Return
1 Like

Hello, i’ve gone ahead and moved your thread to Tutorials, Tips and Tricks as it seems to be more tutorial related.

There is also this by the way, which is being actively updated. If you’re having trouble adapting from maya to blender then this might be good for you to check out.

Tnx, wasn’t sure where to post it. I’ve tried that addon but it wasn’t for me, I basically just want the navigation changed while keeping most of Blender default keys in place.

1 Like