Last active
February 6, 2021 15:52
-
-
Save yjlcoder/d34f547c1411d2f04626f7fccf25cacc to your computer and use it in GitHub Desktop.
Controller settings for photoshop digital painting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Persistent | |
| ; This script is for 8BitDo Lite to use shortcuts of photoshop | |
| ; The main purpose is to do digital painting | |
| JOY_STICK_NUMBER = 2 | |
| JOY_STICK_PREFIX = %JOY_STICK_NUMBER%Joy | |
| ButtonB = 1 | |
| ButtonA = 2 | |
| ButtonY = 3 | |
| ButtonX = 4 | |
| ButtonL = 5 | |
| ButtonR = 6 | |
| ButtonMinus = 7 | |
| ButtonPlus = 8 | |
| HotKey, %JOY_STICK_PREFIX%%ButtonB%, brush | |
| HotKey, %JOY_STICK_PREFIX%%ButtonA%, eraser | |
| HotKey, %JOY_STICK_PREFIX%%ButtonY%, smudge | |
| HotKey, %JOY_STICK_PREFIX%%ButtonX%, magicwand | |
| HotKey, %JOY_STICK_PREFIX%%ButtonL%, smallerBrush | |
| HotKey, %JOY_STICK_PREFIX%%ButtonR%, largerBrush | |
| HotKey, %JOY_STICK_PREFIX%%ButtonMinus%, Ctrl_key | |
| HotKey, %JOY_STICK_PREFIX%%ButtonPlus%, Alt_key | |
| JOY_X = %JOY_STICK_PREFIX%X | |
| JOY_Y = %JOY_STICK_PREFIX%Y | |
| JOY_Z = %JOY_STICK_PREFIX%Z | |
| JOY_U = %JOY_STICK_PREFIX%U | |
| JOY_R = %JOY_STICK_PREFIX%R | |
| JOY_POV = %JOY_STICK_PREFIX%POV | |
| setTimer, watchAxisL, 100 ; joyX - horizontal, joyY - vertical | |
| setTimer, watchPOV, 100 ; | |
| setTimer, watchAxisR, 50 ; joyU - horiontal, joyR - vertical | |
| setTimer, watchL2R2, 100 ; JoyZ < 10: L2, JoyZ > 90: R2 | |
| ; For L2 and R2 | |
| shiftPressed := false | |
| spacePressed := false | |
| ; For left Axis | |
| AxisLReset := true | |
| ; For POV | |
| POVHold := 0 | |
| return ; Code below will only run in event loop | |
| brush: | |
| Send, {b down} | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonB% | |
| Send, {b up} | |
| return | |
| eraser: | |
| Send, {e down} | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonA% | |
| Send, {e up} | |
| return | |
| undo: | |
| Send, ^z | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonY%, T0.5 | |
| While ErrorLevel { | |
| Send, ^z | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonY%, T0.1 | |
| } | |
| return | |
| smudge: | |
| Send {k down} | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonY% | |
| Send {k up} | |
| return | |
| magicwand: | |
| Send {w down} | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonX% | |
| Send {w up} | |
| return | |
| smallerBrush: | |
| Send, [ | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonL%, T0.5 | |
| While ErrorLevel { | |
| Send, [ | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonL%, T0.1 | |
| } | |
| return | |
| largerBrush: | |
| Send, ] | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonR%, T0.5 | |
| While ErrorLevel { | |
| Send, ] | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonR%, T0.1 | |
| } | |
| return | |
| Ctrl_key: | |
| Send, {Ctrl down} | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonMinus% | |
| Send, {Ctrl up} | |
| return | |
| Alt_key: | |
| Send, {Alt down} | |
| KeyWait, %JOY_STICK_PREFIX%%ButtonPlus% | |
| Send, {Alt up} | |
| return | |
| watchAxisL: | |
| JoyX := GetKeyState(JOY_X) | |
| JOyY := GetKeyState(JOY_Y) | |
| if (JoyX > 90) and (AxisLReset = true) { | |
| Send, ^j ; Copy selection to a layer | |
| AxisLReset := false | |
| return | |
| } | |
| if (JoyY < 10) and (AxisLReset = true) { | |
| Send ^+n ; New Layer | |
| AxisLReset := false | |
| return | |
| } | |
| if (JoyX < 10 && AxisLReset = true) { | |
| Send ^e ; Merge Layers | |
| AxisLReset := false | |
| return | |
| } | |
| if (JoyY > 90 and AxisLReset = true) { | |
| Send ^/ ; Lock Layer | |
| AxisLReset := false | |
| return | |
| } | |
| if (AxisLReset = false and JoyX <= 90 and JoyX >= 10 and JoyY <= 90 and JoyY >= 10) | |
| AxisLReset := true ; No button clicked. Reset. | |
| return | |
| watchAxisR: | |
| return | |
| watchPOV: | |
| ; -1: No direction | |
| ; 0: up | |
| ; 9000: right | |
| ; 18000: down | |
| ; 27000: left | |
| pov := GetKeyState(JOY_POV) | |
| if (pov == 0 or pov == 9000 or pov == 18000 or pov == 27000) | |
| POVHold += 1 | |
| else { | |
| POVHold := 0 | |
| return | |
| } | |
| if (POVHold == 1 or POVHold >= 6) { | |
| if (pov = 0) { | |
| Send, ^= ; Zoom in | |
| } else if (pov = 9000) { | |
| Send, ^+z ; Redo | |
| } else if (pov = 18000) { | |
| Send, ^- ; Zoom out | |
| } else if (pov = 27000) { | |
| Send, ^z ; Undo | |
| } | |
| } | |
| return | |
| watchL2R2: | |
| JoyZ := GetKeyState(JOY_Z) | |
| if (JoyZ > 90) { ; L2 | |
| if (!shiftPressed){ | |
| Send, {shift down} | |
| shiftPressed := true | |
| } | |
| } else if (JoyZ < 10) { ; R2 | |
| if (!spacePressed) { | |
| Send, {space down} | |
| spacePressed := true | |
| } | |
| } else { | |
| if (shiftPressed) { | |
| Send, {shift up} | |
| shiftPressed := false | |
| } | |
| if (spacePressed) { | |
| Send, {space up} | |
| spacePressed := false | |
| } | |
| } | |
| return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ButtonA = 1 ; E, Eraser | |
| ButtonB = 2 ; B, Brush | |
| ButtonX = 4 ; Ctrl + Z, Undo | |
| ButtonY = 5 ; Z, Zoom in and out | |
| ButtonL = 7 ; [, Smaller brush | |
| ButtonR = 8 ; ], Larger brush | |
| ButtonL2 = 9 ; Ctrl + D, Cancel selection | |
| ButtonR2 = 10 ; X, Exchange foreground color and background color | |
| ButtonSelect = 11 ; Ctrl, Ctrl key | |
| ButtonStart = 12 ; Alt, Alt key | |
| ButtonL3 = 14 ; Ctrl + Shift + , ; This is a custom shortcut I configure to reverse the canvas horizontally | |
| ButtonR3 = 15 ; Ctrl + J, Copy selection to a new layer | |
| ; If your system has more than one joystick, increase this value to use a joystick | |
| ; other than the first: | |
| JoystickNumber = 1 | |
| LoopInterval = 100 | |
| ; END OF CONFIG SECTION -- Don't change anything below this point unless you want | |
| ; to alter the basic nature of the script. | |
| #SingleInstance | |
| JoystickPrefix = %JoystickNumber%Joy | |
| Hotkey, %JoystickPrefix%%ButtonA%, ButtonEraser | |
| Hotkey, %JoystickPrefix%%ButtonB%, ButtonBrush | |
| HotKey, %joystickPrefix%%ButtonX%, ButtonUndo | |
| Hotkey, %JoystickPrefix%%ButtonY%, ButtonResize | |
| HotKey, %joystickPrefix%%ButtonSelect%, ButtonCtrl | |
| Hotkey, %JoystickPrefix%%ButtonStart%, ButtonAlt | |
| Hotkey, %JoystickPrefix%%ButtonL%, ButtonSmallerBrush | |
| Hotkey, %JoystickPrefix%%ButtonR%, ButtonLargerBrush | |
| Hotkey, %JoystickPrefix%%ButtonL2%, ButtonCancelSelection | |
| Hotkey, %JoystickPrefix%%ButtonR2%, ButtonExchangeColor | |
| Hotkey, %JoystickPrefix%%ButtonL3%, ButtonReverseCanvas | |
| Hotkey, %JoystickPrefix%%ButtonR3%, ButtonCopyToLayer | |
| ButtonUndo: | |
| Send, ^z | |
| LoopNum = 0 | |
| While GetKeyState(JoystickPrefix . ButtonX) | |
| { | |
| if (LoopNum < 5) { | |
| LoopNum := LoopNum + 1 | |
| } else { | |
| Send, ^z | |
| } | |
| sleep, LoopInterval | |
| } | |
| return | |
| ButtonEraser: | |
| Send {e down} | |
| While GetKeyState(JoystickPrefix . ButtonA) | |
| { | |
| sleep, LoopInterval | |
| } | |
| send {e up} | |
| return | |
| ButtonBrush: | |
| Send {b down} | |
| While GetKeyState(JoystickPrefix . ButtonB) | |
| { | |
| sleep, LoopInterval | |
| } | |
| send {b up} | |
| return | |
| ButtonResize: | |
| Send {z down} | |
| While GetKeyState(JoystickPrefix . ButtonY) | |
| { | |
| sleep, LoopInterval | |
| } | |
| send {z up} | |
| return | |
| ButtonCtrl: | |
| Send {Ctrl down} | |
| While GetKeyState(JoystickPrefix . ButtonSelect) | |
| { | |
| sleep, LoopInterval | |
| } | |
| send {Ctrl up} | |
| return | |
| ButtonAlt: | |
| Send {Alt down} | |
| While GetKeyState(JoystickPrefix . ButtonStart) | |
| { | |
| sleep, LoopInterval | |
| } | |
| send {Alt up} | |
| return | |
| ButtonSmallerBrush: | |
| Send, [ | |
| LoopNum = 0 | |
| While GetKeyState(JoystickPrefix . ButtonL) | |
| { | |
| if (LoopNum < 5) { | |
| LoopNum := LoopNum + 1 | |
| } else { | |
| Send, [ | |
| } | |
| sleep, LoopInterval | |
| } | |
| return | |
| ButtonLargerBrush: | |
| Send, ] | |
| LoopNum = 0 | |
| While GetKeyState(JoystickPrefix . ButtonR) | |
| { | |
| if (LoopNum < 5) { | |
| LoopNum := LoopNum + 1 | |
| } else { | |
| Send, ] | |
| } | |
| sleep, LoopInterval | |
| } | |
| return | |
| ButtonCancelSelection: | |
| Send, ^d | |
| return | |
| ButtonExchangeColor: | |
| Send, x | |
| return | |
| ButtonReverseCanvas: | |
| Send ^+, | |
| return | |
| ButtonCopyToLayer: | |
| Send ^j | |
| return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment