mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Fixes to perspective editor (#1034)
* removed some redundant code (not sure how it got there), made tracker toggle obey the variable * Changed perspective editor from Control to PanelContainer to avoid some UI issues
This commit is contained in:
parent
b4384f4085
commit
e1649a064e
|
@ -1,15 +1,18 @@
|
||||||
extends Control
|
extends PanelContainer
|
||||||
|
|
||||||
var axes: Node2D
|
var axes: Node2D
|
||||||
var do_pool := [] ## A pool that stores data of points removed by undo
|
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
|
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")
|
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
|
var tracker_disabled := false
|
||||||
@onready var vanishing_point_container = $"%VanishingPointContainer"
|
@onready var vanishing_point_container = $"%VanishingPointContainer"
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
Global.project_switched.connect(_update_points)
|
Global.project_switched.connect(_update_points)
|
||||||
|
$VBoxContainer/TrackerLines.button_pressed = !tracker_disabled
|
||||||
|
|
||||||
|
|
||||||
func _on_AddPoint_pressed() -> void:
|
func _on_AddPoint_pressed() -> void:
|
||||||
|
@ -23,8 +26,7 @@ func _on_AddPoint_pressed() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_TrackerLines_toggled(button_pressed: bool) -> 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:
|
func add_vanishing_point(is_redo := false) -> void:
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/UI/PerspectiveEditor/PerspectiveEditor.gd" id="1"]
|
[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)
|
custom_minimum_size = Vector2(270, 10)
|
||||||
layout_mode = 3
|
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
@ -17,11 +16,7 @@ script = ExtResource("1")
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
self_modulate = Color(0.698039, 0.698039, 0.698039, 0.698039)
|
self_modulate = Color(0.698039, 0.698039, 0.698039, 0.698039)
|
||||||
clip_contents = true
|
clip_contents = true
|
||||||
layout_mode = 0
|
layout_mode = 2
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
offset_left = 4.0
|
|
||||||
offset_right = -4.0
|
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
|
||||||
[node name="Header" type="HBoxContainer" parent="VBoxContainer"]
|
[node name="Header" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
|
|
|
@ -156,6 +156,3 @@ func _draw() -> void:
|
||||||
# if we put width <= -1, then the arc line will automatically adjust itself to remain thin
|
# 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
|
# 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)
|
draw_arc(point, CIRCLE_RAD * 2 / Global.camera.zoom.x, 0, 360, 360, default_color)
|
||||||
|
|
||||||
if is_hidden: # Hidden line
|
|
||||||
return
|
|
||||||
|
|
|
@ -186,6 +186,9 @@ func add_line(loaded_line_data := {}, is_tracker := false) -> void:
|
||||||
if is_tracker: # Settings for Tracker mode
|
if is_tracker: # Settings for Tracker mode
|
||||||
line.track_mouse = true
|
line.track_mouse = true
|
||||||
tracker_line = line
|
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()
|
tracker_line.hide_perspective_line()
|
||||||
else: # Settings for Normal mode
|
else: # Settings for Normal mode
|
||||||
var line_button := preload("res://src/UI/PerspectiveEditor/LineButton.tscn").instantiate()
|
var line_button := preload("res://src/UI/PerspectiveEditor/LineButton.tscn").instantiate()
|
||||||
|
|
Loading…
Reference in a new issue