Skip to content

Commit

Permalink
Added alternate keybinding setting and
Browse files Browse the repository at this point in the history
implementation for RMB
  • Loading branch information
jesus-g20 committed Oct 4, 2024
1 parent dbfffbf commit 8609e78
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions project/addons/terrain_3d/editor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,22 @@ func _forward_3d_gui_input(p_viewport_camera: Camera3D, p_event: InputEvent) ->
if p_event.get_button_index() == MOUSE_BUTTON_RIGHT and p_event.is_released():
ui.last_rmb_time = Time.get_ticks_msec()
ui.update_decal()

if p_event.get_button_index() == MOUSE_BUTTON_LEFT:

# Fetch the alternate key binding setting
var use_rmb = editor_settings.get_setting("config/alternate_key_binding")

# If alternate keybinding is enabled, use RMB instead of ALT + LMB
if use_rmb and p_event.get_button_index() == MOUSE_BUTTON_RIGHT:
if p_event.is_pressed():
if not editor.is_operating():
editor.start_operation(mouse_global_position)
editor.operate(mouse_global_position, p_viewport_camera.rotation.y)
return AFTER_GUI_INPUT_STOP
elif editor.is_operating() and p_event.is_released():
editor.stop_operation()
return AFTER_GUI_INPUT_STOP

elif not use_rmb and p_event.get_button_index() == MOUSE_BUTTON_LEFT:
if p_event.is_pressed():
if Input.is_mouse_button_pressed(MOUSE_BUTTON_RIGHT):
return AFTER_GUI_INPUT_STOP
Expand Down

0 comments on commit 8609e78

Please sign in to comment.