From 719708fb101054cdf21e3a4da1acb6420ab80649 Mon Sep 17 00:00:00 2001 From: Matthew Paul Date: Wed, 26 Aug 2020 05:45:32 -0400 Subject: [PATCH] Add transparent checker to export dialog and animation cels (#318) * Add checker to export dialog * Add checker to CelButton --- src/UI/Dialogs/ExportDialog.gd | 7 +++++-- src/UI/Dialogs/ExportDialog.tscn | 22 +++++++++++++++++++--- src/UI/Timeline/CelButton.gd | 4 ++++ src/UI/Timeline/CelButton.tscn | 12 +++++++++--- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/UI/Dialogs/ExportDialog.gd b/src/UI/Dialogs/ExportDialog.gd index 96ea1a245..472845cdf 100644 --- a/src/UI/Dialogs/ExportDialog.gd +++ b/src/UI/Dialogs/ExportDialog.gd @@ -15,7 +15,7 @@ onready var export_progress_popup = $Popups/ExportProgressBar onready var export_progress_bar = $Popups/ExportProgressBar/MarginContainer/ProgressBar onready var animation_options_multiple_animations_directories = $VBoxContainer/AnimationOptions/MultipleAnimationsDirectories -onready var previews = $VBoxContainer/PreviewScroll/Previews +onready var previews = $VBoxContainer/PreviewPanel/PreviewScroll/Previews onready var frame_timer = $FrameTimer onready var frame_options = $VBoxContainer/FrameOptions @@ -260,6 +260,9 @@ func _on_ExportDialog_about_to_show() -> void: Export.file_exists_alert = tr("File %s already exists. Overwrite?") # Update translation + # Set the size of the preview checker + var checker = $VBoxContainer/PreviewPanel/TransparentChecker + checker.rect_size = checker.get_parent().rect_size func _on_Tabs_tab_clicked(tab : int) -> void: Export.current_tab = tab @@ -364,7 +367,7 @@ func _on_FileExistsAlert_custom_action(action : String) -> void: var pingpong_direction = Export.AnimationDirection.FORWARD func _on_FrameTimer_timeout() -> void: - $VBoxContainer/PreviewScroll/Previews/PreviewContainer/Preview.texture = animated_preview_frames[animated_preview_current_frame] + $VBoxContainer/PreviewPanel/PreviewScroll/Previews/PreviewContainer/Preview.texture = animated_preview_frames[animated_preview_current_frame] match Export.direction: Export.AnimationDirection.FORWARD: diff --git a/src/UI/Dialogs/ExportDialog.tscn b/src/UI/Dialogs/ExportDialog.tscn index d3e2b9d07..04a7685bb 100644 --- a/src/UI/Dialogs/ExportDialog.tscn +++ b/src/UI/Dialogs/ExportDialog.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] [ext_resource path="res://src/UI/Dialogs/ExportDialog.gd" type="Script" id=1] +[ext_resource path="res://src/UI/TransparentChecker.tscn" type="PackedScene" id=2] [node name="ExportDialog" type="AcceptDialog"] margin_right = 532.0 @@ -41,14 +42,29 @@ margin_right = 516.0 margin_bottom = 50.0 text = "Preview:" -[node name="PreviewScroll" type="ScrollContainer" parent="VBoxContainer"] +[node name="PreviewPanel" type="Panel" parent="VBoxContainer"] margin_top = 54.0 margin_right = 516.0 margin_bottom = 278.0 size_flags_horizontal = 3 size_flags_vertical = 3 -[node name="Previews" type="GridContainer" parent="VBoxContainer/PreviewScroll"] +[node name="TransparentChecker" parent="VBoxContainer/PreviewPanel" instance=ExtResource( 2 )] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = 0.0 +margin_bottom = 0.0 + +[node name="PreviewScroll" type="ScrollContainer" parent="VBoxContainer/PreviewPanel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Previews" type="GridContainer" parent="VBoxContainer/PreviewPanel/PreviewScroll"] margin_right = 516.0 margin_bottom = 224.0 size_flags_horizontal = 3 diff --git a/src/UI/Timeline/CelButton.gd b/src/UI/Timeline/CelButton.gd index 3659747f2..9f35551e5 100644 --- a/src/UI/Timeline/CelButton.gd +++ b/src/UI/Timeline/CelButton.gd @@ -17,6 +17,10 @@ func _ready() -> void: popup_menu.set_item_text(4, "Link Cel") popup_menu.set_item_metadata(4, "Link Cel") + # Reset the checkers size because it assumes you want the same size as the canvas + var checker = $CelTexture/TransparentChecker + checker.rect_size = checker.get_parent().rect_size + func _on_CelButton_pressed() -> void: if Input.is_action_just_released("left_mouse"): diff --git a/src/UI/Timeline/CelButton.tscn b/src/UI/Timeline/CelButton.tscn index d647d257a..54c1c7607 100644 --- a/src/UI/Timeline/CelButton.tscn +++ b/src/UI/Timeline/CelButton.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] [ext_resource path="res://src/UI/Timeline/CelButton.gd" type="Script" id=1] - - +[ext_resource path="res://src/UI/TransparentChecker.tscn" type="PackedScene" id=2] [node name="CelButton" type="Button"] margin_top = 18.0 @@ -33,6 +32,13 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="TransparentChecker" parent="CelTexture" instance=ExtResource( 2 )] +show_behind_parent = true +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = 0.0 +margin_bottom = 0.0 + [node name="PopupMenu" type="PopupMenu" parent="."] margin_right = 20.0 margin_bottom = 20.0