Skip to content

Commit

Permalink
Fix freelook issue (#29)
Browse files Browse the repository at this point in the history
* Fix freelook issue

* Oops, wrongly inserted a fix for another issue. Removed

* Wrong spacing changes. Removed.

* Another wrong space

* Rename to _is_pressing_right_mouse_button

---------

Co-authored-by: Tan Jian Ping <[email protected]>
  • Loading branch information
farfalk and imjp94 authored Feb 15, 2024
1 parent 79bd3a1 commit 3fa009d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions addons/gd-blender-3d-shortcuts/plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ var _cache_transforms = [] # Nodes' local transform relative to pivot_point
var _input_string = ""
var _is_global_on_session = false
var _is_warping_mouse = false
var _is_pressing_right_mouse_button = false


func _init():
Expand Down Expand Up @@ -257,6 +258,10 @@ func find_focused_control(node):
func _forward_3d_gui_input(camera, event):
var forward = false
if current_session == SESSION.NONE:
# solve conflict with free look
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_RIGHT:
_is_pressing_right_mouse_button = event.is_pressed()
if _is_editing:
if event is InputEventKey:
if event.pressed:
Expand All @@ -269,8 +274,10 @@ func _forward_3d_gui_input(camera, event):
forward = true
KEY_S:
if not event.ctrl_pressed:
start_session(SESSION.SCALE, camera, event)
forward = true
# solve conflict with free look
if not _is_pressing_right_mouse_button:
start_session(SESSION.SCALE, camera, event)
forward = true
KEY_H:
commit_hide_nodes()
KEY_X:
Expand Down

0 comments on commit 3fa009d

Please sign in to comment.