mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Implement the ability to edit a tag by clicking on it from the timeline
Editing tags now is faster! Just click on it from the timeline to bring out the edit dialog.
This commit is contained in:
parent
02f85ade06
commit
c6e9b1621d
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=16 format=3 uid="uid://dbylw5k04ulp8"]
|
[gd_scene load_steps=17 format=3 uid="uid://dbylw5k04ulp8"]
|
||||||
|
|
||||||
[ext_resource type="Theme" uid="uid://cngbvfpwjoimv" path="res://assets/themes/dark/theme.tres" id="1"]
|
[ext_resource type="Theme" uid="uid://cngbvfpwjoimv" path="res://assets/themes/dark/theme.tres" id="1"]
|
||||||
[ext_resource type="Script" path="res://src/Main.gd" id="2"]
|
[ext_resource type="Script" path="res://src/Main.gd" id="2"]
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://b3aeqj2k58wdk" path="res://src/UI/Dialogs/OpenSprite.tscn" id="12"]
|
[ext_resource type="PackedScene" uid="uid://b3aeqj2k58wdk" path="res://src/UI/Dialogs/OpenSprite.tscn" id="12"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d3dt1gdlf7hox" path="res://src/UI/Timeline/LayerProperties.tscn" id="13_4dhva"]
|
[ext_resource type="PackedScene" uid="uid://d3dt1gdlf7hox" path="res://src/UI/Timeline/LayerProperties.tscn" id="13_4dhva"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c0nuukjakmai2" path="res://src/UI/Dialogs/TileModeOffsetsDialog.tscn" id="14"]
|
[ext_resource type="PackedScene" uid="uid://c0nuukjakmai2" path="res://src/UI/Dialogs/TileModeOffsetsDialog.tscn" id="14"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c6fyrnyt3663o" path="res://src/UI/Timeline/TagProperties.tscn" id="14_fw6cf"]
|
||||||
[ext_resource type="Script" path="res://src/HandleExtensions.gd" id="15_v0k2h"]
|
[ext_resource type="Script" path="res://src/HandleExtensions.gd" id="15_v0k2h"]
|
||||||
[ext_resource type="PackedScene" uid="uid://clbjfkdupw52l" path="res://src/UI/Timeline/CelProperties.tscn" id="17_ucs64"]
|
[ext_resource type="PackedScene" uid="uid://clbjfkdupw52l" path="res://src/UI/Timeline/CelProperties.tscn" id="17_ucs64"]
|
||||||
[ext_resource type="PackedScene" uid="uid://clgu8wb5o6oup" path="res://src/UI/Dialogs/ExportDialog.tscn" id="39"]
|
[ext_resource type="PackedScene" uid="uid://clgu8wb5o6oup" path="res://src/UI/Dialogs/ExportDialog.tscn" id="39"]
|
||||||
|
@ -87,6 +88,8 @@ dialog_autowrap = true
|
||||||
|
|
||||||
[node name="LayerProperties" parent="Dialogs" instance=ExtResource("13_4dhva")]
|
[node name="LayerProperties" parent="Dialogs" instance=ExtResource("13_4dhva")]
|
||||||
|
|
||||||
|
[node name="TagProperties" parent="Dialogs" instance=ExtResource("14_fw6cf")]
|
||||||
|
|
||||||
[node name="TileModeOffsetsDialog" parent="Dialogs" instance=ExtResource("14")]
|
[node name="TileModeOffsetsDialog" parent="Dialogs" instance=ExtResource("14")]
|
||||||
|
|
||||||
[node name="Extensions" type="Control" parent="."]
|
[node name="Extensions" type="Control" parent="."]
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
extends VBoxContainer
|
extends VBoxContainer
|
||||||
|
|
||||||
var tag: AnimationTag
|
var tag: AnimationTag
|
||||||
|
@onready var options_dialog := Global.control.find_child("TagProperties") as ConfirmationDialog
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if not is_instance_valid(tag):
|
if not is_instance_valid(tag):
|
||||||
return
|
return
|
||||||
$Label.text = tag.name
|
$Button.text = tag.name
|
||||||
|
$Button.modulate = tag.color
|
||||||
$Line2D.default_color = tag.color
|
$Line2D.default_color = tag.color
|
||||||
$Label.modulate = tag.color
|
|
||||||
update_position_and_size()
|
update_position_and_size()
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,3 +19,8 @@ func update_position_and_size() -> void:
|
||||||
size.x = custom_minimum_size.x
|
size.x = custom_minimum_size.x
|
||||||
$Line2D.points[2] = Vector2(custom_minimum_size.x, 0)
|
$Line2D.points[2] = Vector2(custom_minimum_size.x, 0)
|
||||||
$Line2D.points[3] = Vector2(custom_minimum_size.x, 32)
|
$Line2D.points[3] = Vector2(custom_minimum_size.x, 32)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_button_pressed() -> void:
|
||||||
|
var tag_id = Global.current_project.animation_tags.find(tag)
|
||||||
|
options_dialog.show_dialog(Rect2i(), tag_id, true)
|
||||||
|
|
|
@ -15,8 +15,12 @@ joint_mode = 2
|
||||||
begin_cap_mode = 2
|
begin_cap_mode = 2
|
||||||
end_cap_mode = 2
|
end_cap_mode = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
[node name="Button" type="Button" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
mouse_default_cursor_shape = 2
|
||||||
text = "Idle"
|
text = "Idle"
|
||||||
|
flat = true
|
||||||
|
|
||||||
|
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
||||||
|
|
|
@ -1,10 +1,21 @@
|
||||||
extends AcceptDialog
|
extends AcceptDialog
|
||||||
|
|
||||||
var tag_vboxes := []
|
var tag_vboxes := []
|
||||||
|
var called_tag_properties := false ## True when tag properties has been shown by this dialog
|
||||||
|
|
||||||
@onready var main_vbox_cont: VBoxContainer = $VBoxContainer/ScrollContainer/VBoxTagContainer
|
@onready var main_vbox_cont: VBoxContainer = $VBoxContainer/ScrollContainer/VBoxTagContainer
|
||||||
@onready var add_tag_button: Button = $VBoxContainer/ScrollContainer/VBoxTagContainer/AddTag
|
@onready var add_tag_button: Button = $VBoxContainer/ScrollContainer/VBoxTagContainer/AddTag
|
||||||
@onready var options_dialog := $TagOptions as ConfirmationDialog
|
@onready var options_dialog := Global.control.find_child("TagProperties") as ConfirmationDialog
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
options_dialog.visibility_changed.connect(_on_tag_options_visibility_changed)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_tag_options_visibility_changed() -> void:
|
||||||
|
if called_tag_properties:
|
||||||
|
called_tag_properties = false
|
||||||
|
popup_centered.call_deferred()
|
||||||
|
|
||||||
|
|
||||||
func _on_FrameTagDialog_about_to_show() -> void:
|
func _on_FrameTagDialog_about_to_show() -> void:
|
||||||
|
@ -65,6 +76,7 @@ func _on_AddTag_pressed() -> void:
|
||||||
frames.append(cel[0])
|
frames.append(cel[0])
|
||||||
frames.sort()
|
frames.sort()
|
||||||
options_dialog.show_dialog(dialog_position, current_tag_id, false, frames)
|
options_dialog.show_dialog(dialog_position, current_tag_id, false, frames)
|
||||||
|
called_tag_properties = true
|
||||||
|
|
||||||
|
|
||||||
func _on_EditButton_pressed(_tag_id: int, edit_button: Button) -> void:
|
func _on_EditButton_pressed(_tag_id: int, edit_button: Button) -> void:
|
||||||
|
@ -72,10 +84,7 @@ func _on_EditButton_pressed(_tag_id: int, edit_button: Button) -> void:
|
||||||
var y_pos := edit_button.global_position.y + 2 * edit_button.size.y
|
var y_pos := edit_button.global_position.y + 2 * edit_button.size.y
|
||||||
var dialog_position := Rect2i(position + Vector2i(x_pos, y_pos), options_dialog.size)
|
var dialog_position := Rect2i(position + Vector2i(x_pos, y_pos), options_dialog.size)
|
||||||
options_dialog.show_dialog(dialog_position, _tag_id, true)
|
options_dialog.show_dialog(dialog_position, _tag_id, true)
|
||||||
|
called_tag_properties = true
|
||||||
|
|
||||||
func _on_tag_options_visibility_changed() -> void:
|
|
||||||
_on_FrameTagDialog_about_to_show.call_deferred()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_PlayOnlyTags_toggled(button_pressed: bool) -> void:
|
func _on_PlayOnlyTags_toggled(button_pressed: bool) -> void:
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://c6je8lgr850wf"]
|
[gd_scene load_steps=3 format=3 uid="uid://c6je8lgr850wf"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/UI/Timeline/FrameTagDialog.gd" id="1"]
|
[ext_resource type="Script" path="res://src/UI/Timeline/FrameTagDialog.gd" id="1"]
|
||||||
[ext_resource type="Texture2D" uid="uid://d1urikaf1lxwl" path="res://assets/graphics/timeline/new_frame.png" id="2"]
|
[ext_resource type="Texture2D" uid="uid://d1urikaf1lxwl" path="res://assets/graphics/timeline/new_frame.png" id="2"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c6fyrnyt3663o" path="res://src/UI/Timeline/TagOptions.tscn" id="3_hw52m"]
|
|
||||||
|
|
||||||
[node name="FrameTagDialog" type="AcceptDialog"]
|
[node name="FrameTagDialog" type="AcceptDialog"]
|
||||||
title = "Frame Tag Properties"
|
title = "Frame Tag Properties"
|
||||||
|
@ -63,10 +62,7 @@ mouse_default_cursor_shape = 2
|
||||||
button_pressed = true
|
button_pressed = true
|
||||||
text = "Animation plays only on frames of the same tag"
|
text = "Animation plays only on frames of the same tag"
|
||||||
|
|
||||||
[node name="TagOptions" parent="." instance=ExtResource("3_hw52m")]
|
|
||||||
|
|
||||||
[connection signal="about_to_popup" from="." to="." method="_on_FrameTagDialog_about_to_show"]
|
[connection signal="about_to_popup" from="." to="." method="_on_FrameTagDialog_about_to_show"]
|
||||||
[connection signal="visibility_changed" from="." to="." method="_on_FrameTagDialog_visibility_changed"]
|
[connection signal="visibility_changed" from="." to="." method="_on_FrameTagDialog_visibility_changed"]
|
||||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxTagContainer/AddTag" to="." method="_on_AddTag_pressed"]
|
[connection signal="pressed" from="VBoxContainer/ScrollContainer/VBoxTagContainer/AddTag" to="." method="_on_AddTag_pressed"]
|
||||||
[connection signal="toggled" from="VBoxContainer/PlayOnlyTags" to="." method="_on_PlayOnlyTags_toggled"]
|
[connection signal="toggled" from="VBoxContainer/PlayOnlyTags" to="." method="_on_PlayOnlyTags_toggled"]
|
||||||
[connection signal="visibility_changed" from="TagOptions" to="." method="_on_tag_options_visibility_changed"]
|
|
||||||
|
|
|
@ -31,7 +31,10 @@ func show_dialog(
|
||||||
color_picker_button.color = Color(randf(), randf(), randf())
|
color_picker_button.color = Color(randf(), randf(), randf())
|
||||||
user_data_text_edit.text = ""
|
user_data_text_edit.text = ""
|
||||||
delete_tag_button.visible = false
|
delete_tag_button.visible = false
|
||||||
popup(popup_rect)
|
if popup_rect == Rect2i():
|
||||||
|
popup_centered()
|
||||||
|
else:
|
||||||
|
popup(popup_rect)
|
||||||
|
|
||||||
|
|
||||||
func _on_confirmed() -> void:
|
func _on_confirmed() -> void:
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=2 format=3 uid="uid://c6fyrnyt3663o"]
|
[gd_scene load_steps=2 format=3 uid="uid://c6fyrnyt3663o"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/UI/Timeline/TagOptions.gd" id="1_wbmaq"]
|
[ext_resource type="Script" path="res://src/UI/Timeline/TagProperties.gd" id="1_wbmaq"]
|
||||||
|
|
||||||
[node name="TagOptions" type="ConfirmationDialog"]
|
[node name="TagProperties" type="ConfirmationDialog"]
|
||||||
|
title = "Tag properties"
|
||||||
size = Vector2i(303, 240)
|
size = Vector2i(303, 240)
|
||||||
exclusive = false
|
exclusive = false
|
||||||
popup_window = true
|
popup_window = true
|
Loading…
Reference in a new issue