diff --git a/src/UI/PerspectiveEditor/PerspectiveEditor.gd b/src/UI/PerspectiveEditor/PerspectiveEditor.gd index f9ed1077d..8db7402d5 100644 --- a/src/UI/PerspectiveEditor/PerspectiveEditor.gd +++ b/src/UI/PerspectiveEditor/PerspectiveEditor.gd @@ -1,15 +1,18 @@ -extends Control +extends PanelContainer var axes: Node2D var do_pool := [] ## A pool that stores data of points removed by undo var delete_pool := [] ## A pool that containing deleted data and their index +## The vanishing point UI resource var vanishing_point_res := preload("res://src/UI/PerspectiveEditor/VanishingPoint.tscn") +## Option to show/hide tracker guides. (guides whose end points follow the mouse) var tracker_disabled := false @onready var vanishing_point_container = $"%VanishingPointContainer" func _ready() -> void: Global.project_switched.connect(_update_points) + $VBoxContainer/TrackerLines.button_pressed = !tracker_disabled func _on_AddPoint_pressed() -> void: @@ -23,8 +26,7 @@ func _on_AddPoint_pressed() -> void: func _on_TrackerLines_toggled(button_pressed: bool) -> void: - for point in vanishing_point_container.get_children(): - tracker_disabled = !button_pressed + tracker_disabled = !button_pressed func add_vanishing_point(is_redo := false) -> void: diff --git a/src/UI/PerspectiveEditor/PerspectiveEditor.tscn b/src/UI/PerspectiveEditor/PerspectiveEditor.tscn index 3612fc24e..0a2e65e66 100644 --- a/src/UI/PerspectiveEditor/PerspectiveEditor.tscn +++ b/src/UI/PerspectiveEditor/PerspectiveEditor.tscn @@ -2,9 +2,8 @@ [ext_resource type="Script" path="res://src/UI/PerspectiveEditor/PerspectiveEditor.gd" id="1"] -[node name="PerspectiveEditor" type="Control"] +[node name="PerspectiveEditor" type="PanelContainer"] custom_minimum_size = Vector2(270, 10) -layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 @@ -17,11 +16,7 @@ script = ExtResource("1") [node name="VBoxContainer" type="VBoxContainer" parent="."] self_modulate = Color(0.698039, 0.698039, 0.698039, 0.698039) clip_contents = true -layout_mode = 0 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_left = 4.0 -offset_right = -4.0 +layout_mode = 2 size_flags_vertical = 3 [node name="Header" type="HBoxContainer" parent="VBoxContainer"] diff --git a/src/UI/PerspectiveEditor/PerspectiveLine.gd b/src/UI/PerspectiveEditor/PerspectiveLine.gd index 7e55c022e..761c9b7e5 100644 --- a/src/UI/PerspectiveEditor/PerspectiveLine.gd +++ b/src/UI/PerspectiveEditor/PerspectiveLine.gd @@ -156,6 +156,3 @@ func _draw() -> void: # if we put width <= -1, then the arc line will automatically adjust itself to remain thin # in 0.x this behavior was achieved at width <= 1 draw_arc(point, CIRCLE_RAD * 2 / Global.camera.zoom.x, 0, 360, 360, default_color) - - if is_hidden: # Hidden line - return diff --git a/src/UI/PerspectiveEditor/VanishingPoint.gd b/src/UI/PerspectiveEditor/VanishingPoint.gd index b828b7c1a..51160df00 100644 --- a/src/UI/PerspectiveEditor/VanishingPoint.gd +++ b/src/UI/PerspectiveEditor/VanishingPoint.gd @@ -186,6 +186,9 @@ func add_line(loaded_line_data := {}, is_tracker := false) -> void: if is_tracker: # Settings for Tracker mode line.track_mouse = true tracker_line = line + # The tracker line is initially always hidden when a new point is added because + # mouse is outside of canvas during that time. + # This is not related to the disable tracker toggle in perspective editor tracker_line.hide_perspective_line() else: # Settings for Normal mode var line_button := preload("res://src/UI/PerspectiveEditor/LineButton.tscn").instantiate()