Set up the edit mode buttons to actually reflect state.

This commit is contained in:
Relintai 2021-12-31 07:51:23 +01:00
parent f25e9aa3ad
commit 9962ef777a
2 changed files with 29 additions and 6 deletions

View File

@ -21,16 +21,13 @@ func _unhandled_key_input(event : InputEventKey) -> void:
#if event.key
if event.scancode == KEY_G:
#translate
if plugin:
plugin.set_translate(event.pressed)
set_edit_mode_translate()
elif event.scancode == KEY_S:
#scale? probably needs a differrent key
if plugin:
plugin.set_scale(event.pressed)
set_edit_mode_scale()
elif event.scancode == KEY_R:
#rotate
if plugin:
plugin.set_rotate(event.pressed)
set_edit_mode_rotate()
elif event.scancode == KEY_X:
if plugin:
plugin.set_axis_x(event.pressed)
@ -41,6 +38,29 @@ func _unhandled_key_input(event : InputEventKey) -> void:
if plugin:
plugin.set_axis_z(event.pressed)
func set_edit_mode_translate() -> void:
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Translate.pressed = true
func set_edit_mode_rotate() -> void:
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Rotate.pressed = true
func set_edit_mode_scale() -> void:
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Scale.pressed = true
func on_edit_mode_translate_toggled(on : bool) -> void:
if on:
if plugin:
plugin.set_translate(on)
func on_edit_mode_rotate_toggled(on : bool) -> void:
if on:
if plugin:
plugin.set_rotate(on)
func on_edit_mode_scale_toggled(on : bool) -> void:
if on:
if plugin:
plugin.set_scale(on)
func _on_Extrude_pressed():
pass # Replace with function body.

View File

@ -281,6 +281,9 @@ margin_bottom = 100.0
rect_min_size = Vector2( 100, 100 )
script = ExtResource( 3 )
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Translate" to="." method="on_edit_mode_translate_toggled"]
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Rotate" to="." method="on_edit_mode_rotate_toggled"]
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Scale" to="." method="on_edit_mode_scale_toggled"]
[connection signal="pressed" from="VBoxContainer/Operations/Operations/Extrude" to="." method="_on_Extrude_pressed"]
[connection signal="pressed" from="VBoxContainer/Operations/Operations/UnwrapButton" to="." method="_on_UnwrapButton_pressed"]
[connection signal="pressed" from="VBoxContainer/Add/Add/AddBox" to="." method="_on_AddBox_pressed"]