Added a select all button to mdr ed's sidebar, and implemented it.

This commit is contained in:
Relintai 2022-01-25 12:55:42 +01:00
parent c950762d77
commit 6f8525a44b
4 changed files with 48 additions and 13 deletions

View File

@ -232,3 +232,6 @@ func on_visual_indicator_seam_toggled(on : bool):
func on_visual_indicator_handle_toggled(on : bool):
_plugin.visual_indicator_handle_set(on)
func _on_select_all_pressed():
_plugin.select_all()

View File

@ -202,7 +202,7 @@ scroll_horizontal_enabled = false
[node name="VBoxContainer2" type="VBoxContainer" parent="VBoxContainer/ScrollContainer"]
margin_right = 998.0
margin_bottom = 610.0
margin_bottom = 666.0
size_flags_horizontal = 3
[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
@ -301,10 +301,24 @@ toggle_mode = true
pressed = true
text = "H"
[node name="VertexOps" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 48.0
margin_right = 998.0
margin_bottom = 152.0
margin_bottom = 52.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Select All" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 56.0
margin_right = 998.0
margin_bottom = 76.0
text = "Select All"
[node name="VertexOps" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 80.0
margin_right = 998.0
margin_bottom = 184.0
[node name="OperationsLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps"]
margin_right = 998.0
@ -466,14 +480,14 @@ margin_bottom = 20.0
text = "Delete"
[node name="HSeparator4" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 156.0
margin_top = 188.0
margin_right = 998.0
margin_bottom = 160.0
margin_bottom = 192.0
[node name="Operations" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 164.0
margin_top = 196.0
margin_right = 998.0
margin_bottom = 528.0
margin_bottom = 560.0
[node name="OperationsLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations"]
margin_right = 998.0
@ -567,14 +581,14 @@ margin_bottom = 346.0
text = "Unwrap"
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 532.0
margin_top = 564.0
margin_right = 998.0
margin_bottom = 536.0
margin_bottom = 568.0
[node name="Add" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 540.0
margin_top = 572.0
margin_right = 998.0
margin_bottom = 626.0
margin_bottom = 658.0
[node name="AddLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Add"]
margin_right = 998.0
@ -608,9 +622,9 @@ size_flags_horizontal = 3
text = "Quad"
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 630.0
margin_top = 662.0
margin_right = 998.0
margin_bottom = 634.0
margin_bottom = 666.0
[node name="Popups" type="Control" parent="."]
margin_left = 7.0
@ -660,6 +674,7 @@ size_flags_vertical = 3
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5/Outline" to="." method="on_visual_indicator_outline_toggled"]
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5/Seam" to="." method="on_visual_indicator_seam_toggled"]
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5/Handle" to="." method="on_visual_indicator_handle_toggled"]
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/Select All" to="." method="_on_select_all_pressed"]
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations/AddFace" to="." method="_oncreate_face_pressed"]
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations/Split" to="." method="_on_split_pressed"]
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps/Operations/HBoxContainer/ConnectToFirst" to="." method="_on_connect_to_first_selected_pressed"]

View File

@ -186,6 +186,18 @@ func apply() -> void:
enable_change_event()
func select_all() -> void:
print("asdasd")
if _selected_points.size() == _handle_points.size():
return
_selected_points.resize(_handle_points.size())
for i in range(_selected_points.size()):
_selected_points[i] = i
redraw()
func forward_spatial_gui_input(index, camera, event):
_last_known_camera_facing = camera.transform.basis.xform(Vector3(0, 0, -1))

View File

@ -256,3 +256,8 @@ func visual_indicator_seam_set(on : bool):
func visual_indicator_handle_set(on : bool):
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
current_mesh_data_instance.gizmo.visual_indicator_handle_set(on)
func select_all():
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
current_mesh_data_instance.gizmo.select_all()