Add toggles for visual indicators to mdr ed's sidebar.

This commit is contained in:
Relintai 2022-01-23 22:26:08 +01:00
parent e54a90af07
commit 1d9d5fba7c
4 changed files with 101 additions and 12 deletions

View File

@ -223,3 +223,12 @@ func on_pivot_mdi_origin_toggled(on : bool):
func on_pivot_world_origin_toggled(on : bool):
if on:
_plugin.set_pivot_world_origin()
func on_visual_indicator_outline_toggled(on : bool):
_plugin.visual_indicator_outline_set(on)
func on_visual_indicator_seam_toggled(on : bool):
_plugin.visual_indicator_seam_set(on)
func on_visual_indicator_handle_toggled(on : bool):
_plugin.visual_indicator_handle_set(on)

View File

@ -253,10 +253,58 @@ toggle_mode = true
group = ExtResource( 7 )
text = "w"
[node name="VertexOps" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
[node name="HBoxContainer5" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 24.0
margin_right = 998.0
margin_bottom = 128.0
margin_bottom = 44.0
[node name="Label4" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5"]
margin_right = 8.0
margin_bottom = 20.0
hint_tooltip = "Visual indicators"
mouse_filter = 0
size_flags_vertical = 7
text = "V"
align = 1
valign = 1
[node name="Outline" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5"]
margin_left = 12.0
margin_right = 338.0
margin_bottom = 20.0
rect_min_size = Vector2( 25, 20 )
hint_tooltip = "Outline"
size_flags_horizontal = 3
toggle_mode = true
pressed = true
text = "O"
[node name="Seam" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5"]
margin_left = 342.0
margin_right = 668.0
margin_bottom = 20.0
rect_min_size = Vector2( 25, 20 )
hint_tooltip = "Seam"
size_flags_horizontal = 3
toggle_mode = true
pressed = true
text = "S"
[node name="Handle" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer5"]
margin_left = 672.0
margin_right = 998.0
margin_bottom = 20.0
rect_min_size = Vector2( 25, 20 )
hint_tooltip = "Handle"
size_flags_horizontal = 3
toggle_mode = true
pressed = true
text = "H"
[node name="VertexOps" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 48.0
margin_right = 998.0
margin_bottom = 152.0
[node name="OperationsLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/VertexOps"]
margin_right = 998.0
@ -418,14 +466,14 @@ margin_bottom = 20.0
text = "Delete"
[node name="HSeparator4" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 132.0
margin_top = 156.0
margin_right = 998.0
margin_bottom = 136.0
margin_bottom = 160.0
[node name="Operations" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 140.0
margin_top = 164.0
margin_right = 998.0
margin_bottom = 504.0
margin_bottom = 528.0
[node name="OperationsLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Operations"]
margin_right = 998.0
@ -519,14 +567,14 @@ margin_bottom = 346.0
text = "Unwrap"
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 508.0
margin_top = 532.0
margin_right = 998.0
margin_bottom = 512.0
margin_bottom = 536.0
[node name="Add" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 516.0
margin_top = 540.0
margin_right = 998.0
margin_bottom = 602.0
margin_bottom = 626.0
[node name="AddLabel" type="Label" parent="VBoxContainer/ScrollContainer/VBoxContainer2/Add"]
margin_right = 998.0
@ -560,9 +608,9 @@ size_flags_horizontal = 3
text = "Quad"
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/ScrollContainer/VBoxContainer2"]
margin_top = 606.0
margin_top = 630.0
margin_right = 998.0
margin_bottom = 610.0
margin_bottom = 634.0
[node name="Popups" type="Control" parent="."]
margin_left = 7.0
@ -609,6 +657,9 @@ size_flags_vertical = 3
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer4/Average" to="." method="on_pivot_average_toggled"]
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer4/MDIOrigin" to="." method="on_pivot_mdi_origin_toggled"]
[connection signal="toggled" from="VBoxContainer/ScrollContainer/VBoxContainer2/HBoxContainer4/WorldOrigin" to="." method="on_pivot_world_origin_toggled"]
[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/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

@ -36,6 +36,11 @@ var edit_mode : int = EditMode.EDIT_MODE_TRANSLATE
var pivot_type : int = PivotTypes.PIVOT_TYPE_AVERAGED
var axis_constraint : int = AxisConstraint.X | AxisConstraint.Y | AxisConstraint.Z
var selection_mode : int = SelectionMode.SELECTION_MODE_VERTEX
var visual_indicator_outline : bool = true
var visual_indicator_seam : bool= true
var visual_indicator_handle : bool = true
var previous_point : Vector2
var is_dragging : bool = false
var _last_known_camera_facing : Vector3 = Vector3(0, 0, -1)
@ -1239,3 +1244,16 @@ func transfer_state_from(other) -> void:
pivot_type = other.pivot_type
axis_constraint = other.axis_constraint
selection_mode = other.selection_mode
visual_indicator_outline = other.visual_indicator_outline
visual_indicator_seam = other.visual_indicator_seam
visual_indicator_handle = other.visual_indicator_handle
func visual_indicator_outline_set(on : bool):
visual_indicator_outline = on
func visual_indicator_seam_set(on : bool):
visual_indicator_seam = on
func visual_indicator_handle_set(on : bool):
visual_indicator_handle = on

View File

@ -245,3 +245,14 @@ func set_pivot_world_origin():
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
current_mesh_data_instance.gizmo.set_pivot_world_origin()
func visual_indicator_outline_set(on : bool):
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
current_mesh_data_instance.gizmo.visual_indicator_outline_set(on)
func visual_indicator_seam_set(on : bool):
if current_mesh_data_instance && current_mesh_data_instance.gizmo:
current_mesh_data_instance.gizmo.visual_indicator_seam_set(on)
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)