From 7b0d382f575ec166ced9d90424144e049ccb87ba Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 14 Jan 2022 15:16:06 +0100 Subject: [PATCH] Split up the operations into a per vertex/edge/face panel and one that's permanent. --- .../mesh_data_resource_editor/MDIEd.tscn | 215 +++++++++++++----- .../utilities/mdred_mesh_utils.gd | 2 - 2 files changed, 162 insertions(+), 55 deletions(-) diff --git a/game/addons/mesh_data_resource_editor/MDIEd.tscn b/game/addons/mesh_data_resource_editor/MDIEd.tscn index cbd6f66e..f444f9bb 100644 --- a/game/addons/mesh_data_resource_editor/MDIEd.tscn +++ b/game/addons/mesh_data_resource_editor/MDIEd.tscn @@ -178,10 +178,138 @@ margin_top = 90.0 margin_right = 1010.0 margin_bottom = 94.0 -[node name="Operations" type="VBoxContainer" parent="VBoxContainer"] +[node name="VertexOps" type="VBoxContainer" parent="VBoxContainer"] margin_top = 98.0 margin_right = 1010.0 -margin_bottom = 328.0 +margin_bottom = 208.0 + +[node name="OperationsLabel" type="Label" parent="VBoxContainer/VertexOps"] +margin_right = 1010.0 +margin_bottom = 14.0 +text = "Vertex" +align = 1 +valign = 1 + +[node name="Operations" type="VBoxContainer" parent="VBoxContainer/VertexOps"] +margin_top = 18.0 +margin_right = 1010.0 +margin_bottom = 110.0 + +[node name="Merge" type="Button" parent="VBoxContainer/VertexOps/Operations"] +margin_right = 1010.0 +margin_bottom = 20.0 +text = "Merge" + +[node name="Split" type="Button" parent="VBoxContainer/VertexOps/Operations"] +margin_top = 24.0 +margin_right = 1010.0 +margin_bottom = 44.0 +text = "Split" + +[node name="Connect" type="Button" parent="VBoxContainer/VertexOps/Operations"] +margin_top = 48.0 +margin_right = 1010.0 +margin_bottom = 68.0 +text = "Connect" + +[node name="Disconnect" type="Button" parent="VBoxContainer/VertexOps/Operations"] +margin_top = 72.0 +margin_right = 1010.0 +margin_bottom = 92.0 +text = "Disconnect" + +[node name="EdgeOps" type="VBoxContainer" parent="VBoxContainer"] +visible = false +margin_top = 212.0 +margin_right = 1010.0 +margin_bottom = 346.0 + +[node name="OperationsLabel" type="Label" parent="VBoxContainer/EdgeOps"] +margin_right = 1010.0 +margin_bottom = 14.0 +text = "Edge" +align = 1 +valign = 1 + +[node name="Operations" type="VBoxContainer" parent="VBoxContainer/EdgeOps"] +margin_top = 18.0 +margin_right = 1010.0 +margin_bottom = 134.0 + +[node name="Extrude" type="Button" parent="VBoxContainer/EdgeOps/Operations"] +margin_right = 1010.0 +margin_bottom = 20.0 +text = "Extrude" + +[node name="Merge" type="Button" parent="VBoxContainer/EdgeOps/Operations"] +margin_top = 24.0 +margin_right = 1010.0 +margin_bottom = 44.0 +text = "Merge" + +[node name="Split" type="Button" parent="VBoxContainer/EdgeOps/Operations"] +margin_top = 48.0 +margin_right = 1010.0 +margin_bottom = 68.0 +text = "Split" + +[node name="Connect" type="Button" parent="VBoxContainer/EdgeOps/Operations"] +margin_top = 72.0 +margin_right = 1010.0 +margin_bottom = 92.0 +text = "Connect" + +[node name="Disconnect" type="Button" parent="VBoxContainer/EdgeOps/Operations"] +margin_top = 96.0 +margin_right = 1010.0 +margin_bottom = 116.0 +text = "Disconnect" + +[node name="FaceOps" type="VBoxContainer" parent="VBoxContainer"] +visible = false +margin_top = 350.0 +margin_right = 1010.0 +margin_bottom = 460.0 + +[node name="OperationsLabel" type="Label" parent="VBoxContainer/FaceOps"] +margin_right = 1010.0 +margin_bottom = 14.0 +text = "Operations" +align = 1 +valign = 1 + +[node name="Operations" type="VBoxContainer" parent="VBoxContainer/FaceOps"] +margin_top = 18.0 +margin_right = 1010.0 +margin_bottom = 110.0 + +[node name="Merge" type="Button" parent="VBoxContainer/FaceOps/Operations"] +margin_right = 1010.0 +margin_bottom = 20.0 +text = "Merge" + +[node name="Split" type="Button" parent="VBoxContainer/FaceOps/Operations"] +margin_top = 24.0 +margin_right = 1010.0 +margin_bottom = 44.0 +text = "Split" + +[node name="Connect" type="Button" parent="VBoxContainer/FaceOps/Operations"] +margin_top = 48.0 +margin_right = 1010.0 +margin_bottom = 68.0 +text = "Connect" + +[node name="Disconnect" type="Button" parent="VBoxContainer/FaceOps/Operations"] +margin_top = 72.0 +margin_right = 1010.0 +margin_bottom = 92.0 +text = "Disconnect" + +[node name="Operations" type="VBoxContainer" parent="VBoxContainer"] +margin_top = 212.0 +margin_right = 1010.0 +margin_bottom = 322.0 [node name="OperationsLabel" type="Label" parent="VBoxContainer/Operations"] margin_right = 1010.0 @@ -193,70 +321,40 @@ valign = 1 [node name="Operations" type="VBoxContainer" parent="VBoxContainer/Operations"] margin_top = 18.0 margin_right = 1010.0 -margin_bottom = 230.0 - -[node name="Extrude" type="Button" parent="VBoxContainer/Operations/Operations"] -margin_right = 1010.0 -margin_bottom = 20.0 -text = "Extrude" +margin_bottom = 110.0 [node name="UnwrapButton" type="Button" parent="VBoxContainer/Operations/Operations"] -margin_top = 24.0 margin_right = 1010.0 -margin_bottom = 44.0 +margin_bottom = 20.0 text = "UV Unwrap" [node name="GenNormals" type="Button" parent="VBoxContainer/Operations/Operations"] -margin_top = 48.0 +margin_top = 24.0 margin_right = 1010.0 -margin_bottom = 68.0 +margin_bottom = 44.0 text = "Gen Normals" [node name="GenTangents" type="Button" parent="VBoxContainer/Operations/Operations"] -margin_top = 72.0 +margin_top = 48.0 margin_right = 1010.0 -margin_bottom = 92.0 +margin_bottom = 68.0 text = "Gen Tangents" [node name="RemDoubles" type="Button" parent="VBoxContainer/Operations/Operations"] -margin_top = 96.0 +margin_top = 72.0 margin_right = 1010.0 -margin_bottom = 116.0 +margin_bottom = 92.0 text = "Rem Doubles" -[node name="Merge" type="Button" parent="VBoxContainer/Operations/Operations"] -margin_top = 120.0 -margin_right = 1010.0 -margin_bottom = 140.0 -text = "Merge" - -[node name="Split" type="Button" parent="VBoxContainer/Operations/Operations"] -margin_top = 144.0 -margin_right = 1010.0 -margin_bottom = 164.0 -text = "Split" - -[node name="Connect" type="Button" parent="VBoxContainer/Operations/Operations"] -margin_top = 168.0 -margin_right = 1010.0 -margin_bottom = 188.0 -text = "Connect" - -[node name="Disconnect" type="Button" parent="VBoxContainer/Operations/Operations"] -margin_top = 192.0 -margin_right = 1010.0 -margin_bottom = 212.0 -text = "Disconnect" - [node name="HSeparator3" type="HSeparator" parent="VBoxContainer"] -margin_top = 332.0 +margin_top = 326.0 margin_right = 1010.0 -margin_bottom = 336.0 +margin_bottom = 330.0 [node name="Add" type="VBoxContainer" parent="VBoxContainer"] -margin_top = 340.0 +margin_top = 334.0 margin_right = 1010.0 -margin_bottom = 426.0 +margin_bottom = 420.0 [node name="AddLabel" type="Label" parent="VBoxContainer/Add"] margin_right = 1010.0 @@ -288,12 +386,12 @@ margin_bottom = 68.0 text = "Quad" [node name="HSeparator2" type="HSeparator" parent="VBoxContainer"] -margin_top = 430.0 +margin_top = 424.0 margin_right = 1010.0 -margin_bottom = 434.0 +margin_bottom = 428.0 [node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer"] -margin_top = 438.0 +margin_top = 432.0 margin_right = 1010.0 margin_bottom = 586.0 size_flags_horizontal = 3 @@ -309,7 +407,7 @@ valign = 1 [node name="UVEditorScrollContainer" type="ScrollContainer" parent="VBoxContainer/VBoxContainer"] margin_top = 18.0 margin_right = 1010.0 -margin_bottom = 148.0 +margin_bottom = 154.0 size_flags_horizontal = 3 size_flags_vertical = 3 __meta__ = { @@ -329,14 +427,25 @@ script = ExtResource( 3 ) [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/Vertex" to="VBoxContainer/VertexOps" method="set_visible"] [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/Edge" to="VBoxContainer/EdgeOps" method="set_visible"] [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="toggled" from="VBoxContainer/Actions/Actions/VBoxContainer2/HBoxContainer3/Face" to="VBoxContainer/FaceOps" method="set_visible"] +[connection signal="pressed" from="VBoxContainer/VertexOps/Operations/Merge" to="." method="_on_merge_pressed"] +[connection signal="pressed" from="VBoxContainer/VertexOps/Operations/Split" to="." method="_on_split_pressed"] +[connection signal="pressed" from="VBoxContainer/VertexOps/Operations/Connect" to="." method="_on_connect_pressed"] +[connection signal="pressed" from="VBoxContainer/VertexOps/Operations/Disconnect" to="." method="_on_disconnect_pressed"] +[connection signal="pressed" from="VBoxContainer/EdgeOps/Operations/Extrude" to="." method="_on_Extrude_pressed"] +[connection signal="pressed" from="VBoxContainer/EdgeOps/Operations/Merge" to="." method="_on_merge_pressed"] +[connection signal="pressed" from="VBoxContainer/EdgeOps/Operations/Split" to="." method="_on_split_pressed"] +[connection signal="pressed" from="VBoxContainer/EdgeOps/Operations/Connect" to="." method="_on_connect_pressed"] +[connection signal="pressed" from="VBoxContainer/EdgeOps/Operations/Disconnect" to="." method="_on_disconnect_pressed"] +[connection signal="pressed" from="VBoxContainer/FaceOps/Operations/Merge" to="." method="_on_merge_pressed"] +[connection signal="pressed" from="VBoxContainer/FaceOps/Operations/Split" to="." method="_on_split_pressed"] +[connection signal="pressed" from="VBoxContainer/FaceOps/Operations/Connect" to="." method="_on_connect_pressed"] +[connection signal="pressed" from="VBoxContainer/FaceOps/Operations/Disconnect" to="." method="_on_disconnect_pressed"] [connection signal="pressed" from="VBoxContainer/Operations/Operations/UnwrapButton" to="." method="_on_UnwrapButton_pressed"] -[connection signal="pressed" from="VBoxContainer/Operations/Operations/Merge" to="." method="_on_merge_pressed"] -[connection signal="pressed" from="VBoxContainer/Operations/Operations/Split" to="." method="_on_split_pressed"] -[connection signal="pressed" from="VBoxContainer/Operations/Operations/Connect" to="." method="_on_connect_pressed"] -[connection signal="pressed" from="VBoxContainer/Operations/Operations/Disconnect" to="." method="_on_disconnect_pressed"] [connection signal="pressed" from="VBoxContainer/Add/Add/AddBox" to="." method="_on_AddBox_pressed"] [connection signal="pressed" from="VBoxContainer/Add/Add/AddTriangle" to="." method="_on_add_triangle_pressed"] [connection signal="pressed" from="VBoxContainer/Add/Add/AdQuad" to="." method="_on_add_quad_pressed"] diff --git a/game/addons/mesh_data_resource_editor/utilities/mdred_mesh_utils.gd b/game/addons/mesh_data_resource_editor/utilities/mdred_mesh_utils.gd index 137e59de..fc786d76 100644 --- a/game/addons/mesh_data_resource_editor/utilities/mdred_mesh_utils.gd +++ b/game/addons/mesh_data_resource_editor/utilities/mdred_mesh_utils.gd @@ -2,8 +2,6 @@ tool extends Object # There are probably better ways to do this -# It will be used for the extrude operation to be able to set triangle winding correctly -# Correctly means it should face the same way as the triangle it was extruded from static func should_flip_reflected_triangle(v0 : Vector3, v1 : Vector3, v2 : Vector3) -> bool: var reflected : Vector3 = reflect_vertex(v0, v1, v2)