The ui will now reflect axis constaint state.

This commit is contained in:
Relintai 2021-12-31 08:08:02 +01:00
parent 81bfa4b6bd
commit 34f080e03e
2 changed files with 36 additions and 6 deletions

View File

@ -29,14 +29,41 @@ func _unhandled_key_input(event : InputEventKey) -> void:
#rotate #rotate
set_edit_mode_rotate() set_edit_mode_rotate()
elif event.scancode == KEY_X: elif event.scancode == KEY_X:
if plugin: set_axis_x(!get_axis_x())
plugin.set_axis_x(event.pressed)
elif event.scancode == KEY_Y: elif event.scancode == KEY_Y:
if plugin: set_axis_y(!get_axis_y())
plugin.set_axis_y(event.pressed)
elif event.scancode == KEY_Z: elif event.scancode == KEY_Z:
set_axis_z(!get_axis_z())
func get_axis_x() -> bool:
return $VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisX.pressed
func get_axis_y() -> bool:
return $VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisY.pressed
func get_axis_z() -> bool:
return $VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisZ.pressed
func set_axis_x(on : bool) -> void:
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisX.pressed = on
func set_axis_y(on : bool) -> void:
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisY.pressed = on
func set_axis_z(on : bool) -> void:
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisZ.pressed = on
func on_axis_x_toggled(on : bool) -> void:
if plugin: if plugin:
plugin.set_axis_z(event.pressed) plugin.set_axis_x(on)
func on_axis_y_toggled(on : bool) -> void:
if plugin:
plugin.set_axis_y(on)
func on_axis_z_toggled(on : bool) -> void:
if plugin:
plugin.set_axis_z(on)
func set_edit_mode_translate() -> void: func set_edit_mode_translate() -> void:
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Translate.pressed = true $VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Translate.pressed = true

View File

@ -284,6 +284,9 @@ 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/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/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="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer/Scale" to="." method="on_edit_mode_scale_toggled"]
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisX" to="." method="on_axis_x_toggled"]
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisY" to="." method="on_axis_y_toggled"]
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisZ" to="." method="on_axis_z_toggled"]
[connection signal="pressed" from="VBoxContainer/Operations/Operations/Extrude" to="." method="_on_Extrude_pressed"] [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/Operations/Operations/UnwrapButton" to="." method="_on_UnwrapButton_pressed"]
[connection signal="pressed" from="VBoxContainer/Add/Add/AddBox" to="." method="_on_AddBox_pressed"] [connection signal="pressed" from="VBoxContainer/Add/Add/AddBox" to="." method="_on_AddBox_pressed"]