TokisanGames / Terrain3D

A high performance, editable terrain system for Godot 4.
MIT License
2.26k stars 134 forks source link

Added alternate key binding setting and updated documentation #509

Closed jesus-g20 closed 1 month ago

jesus-g20 commented 1 month ago

This pull request adds a new editor setting (config/alternate_key_binding) to toggle between ALT+LMB and RMB for terrain editing operations. Documentation has also been updated to reflect this new option.


Admin edit Fixes #441

TokisanGames commented 1 month ago

I've made my change, renaming lift_flatten to modifier_alt. This means ALT is pressed.

You can now rebase your PR git pull --rebase upstream main and continue fixing your implementation, then force push into this branch.

Don't duplicate the operation function calls. All you need to do is swap the functionality of ALT and RMB. If in alternate keybind mode then when MOUSE_BUTTON_RIGHT is checked instead check ALT, and vice versa.

Some references are embedded in conditionals. It might be best to check alternate mode at the beginning of such a function, then check the appropriate button and set a boolean. Then all other conditionals in that function can just check the boolean.

Also it's not ideal to check something with a string in a function that's called continuously like mouse motion input. editor_settings.get_setting("config/alternate_key_binding"). Instead call this in editor._edit() and set a variable so during mouse motion only a boolean is checked.

We'll release when all of the items in the 0.9.3 column on the roadmap are completed.

TokisanGames commented 1 month ago

I'm taking over this PR so we can get it implemented. I've reviewed the 3D navigation scheme key bindings and compared with Terrain3D operations:

Godot

Operation Binding
Orbit MMB
Cam Rotate RMB
Pan SHIFT+MMB
Zoom Wheel

Maya

Operation Binding
Orbit ALT+LMB
Cam Rotate RMB
Pan MMB (documented but doesn't work in 4.2)
Pan(fast) SHIFT+MMB
Zoom ALT+RMB, Wheel

Modo

Operation Binding
Orbit ALT+LMB
Cam Rotate RMB
Pan ALT+SHIFT+LMB
Zoom ALT+CTRL+LMB

Terrain3D

Operation Binding
Apply LMB
Inverse CTRL+LMB
Smooth SHIFT+LMB
Alt ALT+LMB

Alt is used for lifting floors, flattening peaks, and inversing the slope filter.

What I've concluded is that MMB and RMB are occupied for most keymappings. So rather than change our Alt mode to block a different Godot feature, it's best to move it to an unoccupied spot. I'm allowing specifying what we use for an Alt modifier key with: Alt, Space, Meta, Capslock.

TokisanGames commented 1 month ago

Thanks for the start on this.