mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-21 13:16:49 +01:00
Implemented switching selection modes through the ui.
This commit is contained in:
parent
34f080e03e
commit
2067291890
@ -35,6 +35,32 @@ func _unhandled_key_input(event : InputEventKey) -> void:
|
||||
elif event.scancode == KEY_Z:
|
||||
set_axis_z(!get_axis_z())
|
||||
|
||||
#Edit modes
|
||||
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)
|
||||
|
||||
#axis locks
|
||||
func get_axis_x() -> bool:
|
||||
return $VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer2/AxisX.pressed
|
||||
|
||||
@ -65,29 +91,31 @@ func on_axis_z_toggled(on : bool) -> void:
|
||||
if plugin:
|
||||
plugin.set_axis_z(on)
|
||||
|
||||
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:
|
||||
#selection modes
|
||||
func on_selection_mode_vertex_toggled(on : bool) -> void:
|
||||
if on:
|
||||
if plugin:
|
||||
plugin.set_translate(on)
|
||||
plugin.set_selection_mode_vertex()
|
||||
|
||||
func on_edit_mode_rotate_toggled(on : bool) -> void:
|
||||
func on_selection_mode_edge_toggled(on : bool) -> void:
|
||||
if on:
|
||||
if plugin:
|
||||
plugin.set_rotate(on)
|
||||
plugin.set_selection_mode_edge()
|
||||
|
||||
func on_edit_mode_scale_toggled(on : bool) -> void:
|
||||
func on_selection_mode_face_toggled(on : bool) -> void:
|
||||
if on:
|
||||
if plugin:
|
||||
plugin.set_scale(on)
|
||||
plugin.set_selection_mode_face()
|
||||
|
||||
func set_selection_mode_vertex() -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Vertex.pressed = true
|
||||
|
||||
func set_selection_mode_edge() -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Edge.pressed = true
|
||||
|
||||
func set_selection_mode_face() -> void:
|
||||
$VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Face.pressed = true
|
||||
|
||||
|
||||
func _on_Extrude_pressed():
|
||||
pass # Replace with function body.
|
||||
|
@ -41,11 +41,11 @@ margin_right = 1010.0
|
||||
margin_bottom = 86.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/Actions/Actions"]
|
||||
margin_right = 12.0
|
||||
margin_right = 9.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Actions/Actions/VBoxContainer"]
|
||||
margin_right = 12.0
|
||||
margin_right = 9.0
|
||||
margin_bottom = 20.0
|
||||
hint_tooltip = "Edit Mode"
|
||||
mouse_filter = 0
|
||||
@ -56,7 +56,7 @@ valign = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="VBoxContainer/Actions/Actions/VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_right = 12.0
|
||||
margin_right = 9.0
|
||||
margin_bottom = 44.0
|
||||
hint_tooltip = "Active Axis"
|
||||
mouse_filter = 0
|
||||
@ -67,18 +67,18 @@ valign = 1
|
||||
|
||||
[node name="Label3" type="Label" parent="VBoxContainer/Actions/Actions/VBoxContainer"]
|
||||
margin_top = 48.0
|
||||
margin_right = 12.0
|
||||
margin_right = 9.0
|
||||
margin_bottom = 68.0
|
||||
hint_tooltip = "Selection Mode"
|
||||
mouse_filter = 0
|
||||
size_flags_vertical = 7
|
||||
text = "M"
|
||||
text = "S"
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="VBoxContainer/Actions/Actions"]
|
||||
margin_left = 16.0
|
||||
margin_right = 82.0
|
||||
margin_left = 13.0
|
||||
margin_right = 79.0
|
||||
margin_bottom = 68.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Actions/Actions/VBoxContainer2"]
|
||||
@ -287,6 +287,9 @@ script = ExtResource( 3 )
|
||||
[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="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Vertex" to="." method="on_selection_mode_vertex_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Edge" to="." method="on_selection_mode_edge_toggled"]
|
||||
[connection signal="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Face" to="." method="on_selection_mode_face_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"]
|
||||
|
@ -275,6 +275,33 @@ func set_axis_z(on : bool) -> void:
|
||||
if (axis_constraint & AxisConstraint.Z) != 0:
|
||||
axis_constraint ^= AxisConstraint.Z
|
||||
|
||||
func set_selection_mode_vertex() -> void:
|
||||
if selection_mode == SelectionMode.SELECTION_MODE_VERTEX:
|
||||
return
|
||||
|
||||
selection_mode = SelectionMode.SELECTION_MODE_VERTEX
|
||||
_selected_points.resize(0)
|
||||
recalculate_handle_points()
|
||||
redraw()
|
||||
|
||||
func set_selection_mode_edge() -> void:
|
||||
if selection_mode == SelectionMode.SELECTION_MODE_EDGE:
|
||||
return
|
||||
|
||||
selection_mode = SelectionMode.SELECTION_MODE_EDGE
|
||||
_selected_points.resize(0)
|
||||
recalculate_handle_points()
|
||||
redraw()
|
||||
|
||||
func set_selection_mode_face() -> void:
|
||||
if selection_mode == SelectionMode.SELECTION_MODE_FACE:
|
||||
return
|
||||
|
||||
selection_mode = SelectionMode.SELECTION_MODE_FACE
|
||||
_selected_points.resize(0)
|
||||
recalculate_handle_points()
|
||||
redraw()
|
||||
|
||||
func _notification(what):
|
||||
if what == NOTIFICATION_PREDELETE:
|
||||
if self != null && get_plugin():
|
||||
|
@ -114,6 +114,18 @@ func set_axis_z(on : bool) -> void:
|
||||
for g in active_gizmos:
|
||||
g.set_axis_z(on)
|
||||
|
||||
func set_selection_mode_vertex() -> void:
|
||||
for g in active_gizmos:
|
||||
g.set_selection_mode_vertex()
|
||||
|
||||
func set_selection_mode_edge() -> void:
|
||||
for g in active_gizmos:
|
||||
g.set_selection_mode_edge()
|
||||
|
||||
func set_selection_mode_face() -> void:
|
||||
for g in active_gizmos:
|
||||
g.set_selection_mode_face()
|
||||
|
||||
func get_mdr() -> MeshDataResource:
|
||||
if current_mesh_data_instance:
|
||||
return current_mesh_data_instance.mesh_data
|
||||
|
Loading…
Reference in New Issue
Block a user