1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 01:29:49 +00:00

Compare commits

...

7 commits

Author SHA1 Message Date
Emmanouil Papadeas 5c58562d6b Fix theme color preview spacing in the Preferences 2024-02-11 19:12:09 +02:00
Emmanouil Papadeas 85b255032f Keep the aspect ratio correctly in the image effect dialog previews 2024-02-11 18:44:22 +02:00
Emmanouil Papadeas 2b4d85ac3e Fix PointCollapseContainer's TextureRect being rotated incorrectly 2024-02-11 18:21:35 +02:00
Emmanouil Papadeas 0e4c9bad20 Remove CollapsibleContainer.tscn, only keep it as a script/node type 2024-02-11 18:20:46 +02:00
Emmanouil Papadeas 8d8a147142 Lazy load the window opacity dialog 2024-02-11 16:20:04 +02:00
Emmanouil Papadeas be7427fd9c Fix memory leak when previewing layouts in the ManageLayouts dialog 2024-02-11 16:02:15 +02:00
Emmanouil Papadeas c4a4bd4602 Implement lazy loading for some dialogs to make the initial loading of Pixelorama faster
Only load dialogs when they are needed and not at the start of the program. Right now only the new image, about, manage layouts and image effects dialogs are being loaded on demand, but more dialogs can be handled this way in future commits.
2024-02-11 16:01:59 +02:00
17 changed files with 156 additions and 258 deletions

View file

@ -9,6 +9,7 @@ var affect: int = SELECTED_CELS
var selected_cels := Image.create(1, 1, false, Image.FORMAT_RGBA8) var selected_cels := Image.create(1, 1, false, Image.FORMAT_RGBA8)
var current_frame := Image.create(1, 1, false, Image.FORMAT_RGBA8) var current_frame := Image.create(1, 1, false, Image.FORMAT_RGBA8)
var preview_image := Image.new() var preview_image := Image.new()
var aspect_ratio_container: AspectRatioContainer
var preview: TextureRect var preview: TextureRect
var selection_checkbox: CheckBox var selection_checkbox: CheckBox
var affect_option_button: OptionButton var affect_option_button: OptionButton
@ -38,7 +39,7 @@ func _about_to_popup() -> void:
Global.canvas.selection.transform_content_confirm() Global.canvas.selection.transform_content_confirm()
prepare_animator(Global.current_project) prepare_animator(Global.current_project)
set_and_update_preview_image(Global.current_project.current_frame) set_and_update_preview_image(Global.current_project.current_frame)
update_transparent_background_size() aspect_ratio_container.ratio = float(preview_image.get_width()) / preview_image.get_height()
# prepares "animate_panel.frames" according to affect # prepares "animate_panel.frames" according to affect
@ -131,6 +132,7 @@ func commit_action(_cel: Image, _project := Global.current_project) -> void:
func set_nodes() -> void: func set_nodes() -> void:
aspect_ratio_container = $VBoxContainer/AspectRatioContainer
preview = $VBoxContainer/AspectRatioContainer/Preview preview = $VBoxContainer/AspectRatioContainer/Preview
selection_checkbox = $VBoxContainer/OptionsContainer/SelectionCheckBox selection_checkbox = $VBoxContainer/OptionsContainer/SelectionCheckBox
affect_option_button = $VBoxContainer/OptionsContainer/AffectOptionButton affect_option_button = $VBoxContainer/OptionsContainer/AffectOptionButton
@ -214,22 +216,6 @@ func update_preview() -> void:
preview.texture = ImageTexture.create_from_image(preview_image) preview.texture = ImageTexture.create_from_image(preview_image)
func update_transparent_background_size() -> void:
if !preview:
return
var image_size_y := preview.size.y
var image_size_x := preview.size.x
if preview_image.get_size().x > preview_image.get_size().y:
var scale_ratio := preview_image.get_size().x / image_size_x
image_size_y = preview_image.get_size().y / scale_ratio
else:
var scale_ratio := preview_image.get_size().y / image_size_y
image_size_x = preview_image.get_size().x / scale_ratio
preview.get_node("TransparentChecker").size.x = image_size_x
preview.get_node("TransparentChecker").size.y = image_size_y
func _visibility_changed() -> void: func _visibility_changed() -> void:
if visible: if visible:
return return

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=3 uid="uid://dbylw5k04ulp8"] [gd_scene load_steps=16 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"]
@ -6,19 +6,14 @@
[ext_resource type="PackedScene" uid="uid://c8dsi6ggkqa7a" path="res://src/UI/UI.tscn" id="4"] [ext_resource type="PackedScene" uid="uid://c8dsi6ggkqa7a" path="res://src/UI/UI.tscn" id="4"]
[ext_resource type="PackedScene" uid="uid://d1jyt8wleg8ft" path="res://src/UI/Buttons/PatternsPopup.tscn" id="5"] [ext_resource type="PackedScene" uid="uid://d1jyt8wleg8ft" path="res://src/UI/Buttons/PatternsPopup.tscn" id="5"]
[ext_resource type="PackedScene" uid="uid://c5x85ysdouh4t" path="res://src/UI/Buttons/BrushesPopup.tscn" id="6"] [ext_resource type="PackedScene" uid="uid://c5x85ysdouh4t" path="res://src/UI/Buttons/BrushesPopup.tscn" id="6"]
[ext_resource type="PackedScene" uid="uid://cfihuvhy4ocx7" path="res://src/UI/Dialogs/ImageEffects/ImageEffects.tscn" id="7"]
[ext_resource type="PackedScene" uid="uid://cltlo2whtiejd" path="res://src/UI/Dialogs/SaveSpriteHTML5.tscn" id="8"] [ext_resource type="PackedScene" uid="uid://cltlo2whtiejd" path="res://src/UI/Dialogs/SaveSpriteHTML5.tscn" id="8"]
[ext_resource type="PackedScene" uid="uid://bs3dnnvnxyp68" path="res://src/UI/Timeline/FrameProperties.tscn" id="9"] [ext_resource type="PackedScene" uid="uid://bs3dnnvnxyp68" path="res://src/UI/Timeline/FrameProperties.tscn" id="9"]
[ext_resource type="PackedScene" uid="uid://bcdt0pa7rojy5" path="res://src/UI/Dialogs/WindowOpacityDialog.tscn" id="10"]
[ext_resource type="PackedScene" uid="uid://d4euwo633u33b" path="res://src/UI/Dialogs/SaveSprite.tscn" id="11"] [ext_resource type="PackedScene" uid="uid://d4euwo633u33b" path="res://src/UI/Dialogs/SaveSprite.tscn" id="11"]
[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://d1phd84dk4t5e" path="res://src/UI/Dialogs/ManageLayouts.tscn" id="13"]
[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://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://bnpb1aip3wdvw" path="res://src/UI/Dialogs/SplashDialog.tscn" id="27"] [ext_resource type="PackedScene" uid="uid://bnpb1aip3wdvw" path="res://src/UI/Dialogs/SplashDialog.tscn" id="27"]
[ext_resource type="PackedScene" uid="uid://btjf3lj873q1t" path="res://src/UI/Dialogs/CreateNewImage.tscn" id="28"]
[ext_resource type="PackedScene" uid="uid://b3hkjj3s6pe4x" path="res://src/Preferences/PreferencesDialog.tscn" id="32"] [ext_resource type="PackedScene" uid="uid://b3hkjj3s6pe4x" path="res://src/Preferences/PreferencesDialog.tscn" id="32"]
[ext_resource type="PackedScene" uid="uid://w1v6plnv6ppt" path="res://src/UI/Dialogs/AboutDialog.tscn" id="34"]
[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"]
[node name="Control" type="Control"] [node name="Control" type="Control"]
@ -47,16 +42,12 @@ layout_mode = 2
anchors_preset = 0 anchors_preset = 0
mouse_filter = 2 mouse_filter = 2
[node name="ImageEffects" parent="Dialogs" instance=ExtResource("7")]
[node name="BrushesPopup" parent="Dialogs" instance=ExtResource("6")] [node name="BrushesPopup" parent="Dialogs" instance=ExtResource("6")]
[node name="PatternsPopup" parent="Dialogs" instance=ExtResource("5")] [node name="PatternsPopup" parent="Dialogs" instance=ExtResource("5")]
[node name="SplashDialog" parent="Dialogs" instance=ExtResource("27")] [node name="SplashDialog" parent="Dialogs" instance=ExtResource("27")]
[node name="CreateNewImage" parent="Dialogs" instance=ExtResource("28")]
[node name="OpenSprite" parent="Dialogs" instance=ExtResource("12")] [node name="OpenSprite" parent="Dialogs" instance=ExtResource("12")]
[node name="SaveSprite" parent="Dialogs" instance=ExtResource("11")] [node name="SaveSprite" parent="Dialogs" instance=ExtResource("11")]
@ -67,11 +58,6 @@ mouse_filter = 2
[node name="PreferencesDialog" parent="Dialogs" instance=ExtResource("32")] [node name="PreferencesDialog" parent="Dialogs" instance=ExtResource("32")]
[node name="ManageLayouts" parent="Dialogs" instance=ExtResource("13")]
[node name="AboutDialog" parent="Dialogs" instance=ExtResource("34")]
position = Vector2i(0, 24)
[node name="UnsavedCanvasDialog" type="ConfirmationDialog" parent="Dialogs"] [node name="UnsavedCanvasDialog" type="ConfirmationDialog" parent="Dialogs"]
title = "Unsaved Image" title = "Unsaved Image"
exclusive = false exclusive = false
@ -104,8 +90,6 @@ dialog_autowrap = true
[node name="FrameProperties" parent="Dialogs" instance=ExtResource("9")] [node name="FrameProperties" parent="Dialogs" instance=ExtResource("9")]
[node name="WindowOpacityDialog" parent="Dialogs" instance=ExtResource("10")]
[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="."]
@ -118,7 +102,6 @@ visible = false
visible = false visible = false
[connection signal="visibility_changed" from="Dialogs/SplashDialog" to="." method="_can_draw_true"] [connection signal="visibility_changed" from="Dialogs/SplashDialog" to="." method="_can_draw_true"]
[connection signal="visibility_changed" from="Dialogs/CreateNewImage" to="." method="_can_draw_true"]
[connection signal="files_selected" from="Dialogs/OpenSprite" to="." method="_on_OpenSprite_files_selected"] [connection signal="files_selected" from="Dialogs/OpenSprite" to="." method="_on_OpenSprite_files_selected"]
[connection signal="visibility_changed" from="Dialogs/OpenSprite" to="." method="_on_open_sprite_visibility_changed"] [connection signal="visibility_changed" from="Dialogs/OpenSprite" to="." method="_on_open_sprite_visibility_changed"]
[connection signal="file_selected" from="Dialogs/SaveSprite" to="." method="_on_SaveSprite_file_selected"] [connection signal="file_selected" from="Dialogs/SaveSprite" to="." method="_on_SaveSprite_file_selected"]

View file

@ -14,7 +14,7 @@ var theme_button_group := ButtonGroup.new()
] ]
@onready var buttons_container: BoxContainer = $ThemeButtons @onready var buttons_container: BoxContainer = $ThemeButtons
@onready var colors_container: BoxContainer = $ThemeColorsSpacer/ThemeColors @onready var colors_container: BoxContainer = $ThemeColors
@onready var theme_color_preview_scene := preload("res://src/Preferences/ThemeColorPreview.tscn") @onready var theme_color_preview_scene := preload("res://src/Preferences/ThemeColorPreview.tscn")
@ -62,8 +62,8 @@ func add_theme(theme: Theme) -> void:
func remove_theme(theme: Theme) -> void: func remove_theme(theme: Theme) -> void:
var index := themes.find(theme) var index := themes.find(theme)
var theme_button = buttons_container.get_child(index) var theme_button := buttons_container.get_child(index)
var color_previews = colors_container.get_child(index) var color_previews := colors_container.get_child(index)
buttons_container.remove_child(theme_button) buttons_container.remove_child(theme_button)
theme_button.queue_free() theme_button.queue_free()
colors_container.remove_child(color_previews) colors_container.remove_child(color_previews)

View file

@ -256,16 +256,10 @@ script = ExtResource("5")
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="ThemeColorsSpacer" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/Themes"] [node name="ThemeColors" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/Themes"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme_override_constants/separation = 16
[node name="Control" type="Control" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/Themes/ThemeColorsSpacer"]
layout_mode = 2
[node name="ThemeColors" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/Themes/ThemeColorsSpacer"]
layout_mode = 2
theme_override_constants/separation = 12
[node name="ButtonHeader" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface"] [node name="ButtonHeader" type="HBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface"]
layout_mode = 2 layout_mode = 2

View file

@ -6,7 +6,7 @@
[ext_resource type="Script" path="res://src/UI/CanvasPreviewContainer/CanvasPreviewContainer.gd" id="4"] [ext_resource type="Script" path="res://src/UI/CanvasPreviewContainer/CanvasPreviewContainer.gd" id="4"]
[ext_resource type="PackedScene" uid="uid://c546tskdu53j1" path="res://src/UI/Canvas/CanvasPreview.tscn" id="5"] [ext_resource type="PackedScene" uid="uid://c546tskdu53j1" path="res://src/UI/Canvas/CanvasPreview.tscn" id="5"]
[ext_resource type="Texture2D" uid="uid://c7smxwfa8826j" path="res://assets/graphics/timeline/play.png" id="6"] [ext_resource type="Texture2D" uid="uid://c7smxwfa8826j" path="res://assets/graphics/timeline/play.png" id="6"]
[ext_resource type="PackedScene" uid="uid://cii2hpylme60s" path="res://src/UI/Nodes/CollapsibleContainer.tscn" id="7"] [ext_resource type="Script" path="res://src/UI/Nodes/CollapsibleContainer.gd" id="7_o7sn3"]
[ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="8"] [ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="8"]
[sub_resource type="ShaderMaterial" id="1"] [sub_resource type="ShaderMaterial" id="1"]
@ -131,9 +131,11 @@ popup/item_0/id = 0
popup/item_1/text = "Current frame as spritesheet" popup/item_1/text = "Current frame as spritesheet"
popup/item_1/id = 1 popup/item_1/id = 1
[node name="Options" parent="VBox/Animation/VBoxContainer" instance=ExtResource("7")] [node name="Options" type="VBoxContainer" parent="VBox/Animation/VBoxContainer"]
visible = false visible = false
layout_mode = 2 layout_mode = 2
theme_type_variation = &"CollapsibleContainer"
script = ExtResource("7_o7sn3")
text = "Spritesheet options" text = "Spritesheet options"
[node name="GridContainer" type="GridContainer" parent="VBox/Animation/VBoxContainer/Options"] [node name="GridContainer" type="GridContainer" parent="VBox/Animation/VBoxContainer/Options"]

View file

@ -219,3 +219,8 @@ func switch_width_height() -> void:
width_value.value_changed.connect(_on_SizeValue_value_changed) width_value.value_changed.connect(_on_SizeValue_value_changed)
height_value.value_changed.connect(_on_SizeValue_value_changed) height_value.value_changed.connect(_on_SizeValue_value_changed)
func _on_visibility_changed() -> void:
if not visible:
Global.dialog_open(false)

View file

@ -218,6 +218,7 @@ color = Color(0, 0, 0, 0)
[connection signal="about_to_popup" from="." to="." method="_on_CreateNewImage_about_to_show"] [connection signal="about_to_popup" from="." to="." method="_on_CreateNewImage_about_to_show"]
[connection signal="confirmed" from="." to="." method="_on_CreateNewImage_confirmed"] [connection signal="confirmed" from="." to="." method="_on_CreateNewImage_confirmed"]
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
[connection signal="item_selected" from="VBoxContainer/VBoxContainer/Templates/TemplatesContainer/TemplatesOptions" to="." method="_on_TemplatesOptions_item_selected"] [connection signal="item_selected" from="VBoxContainer/VBoxContainer/Templates/TemplatesContainer/TemplatesOptions" to="." method="_on_TemplatesOptions_item_selected"]
[connection signal="value_changed" from="VBoxContainer/VBoxContainer/Templates/SizeContainer/VBoxContainer/WidthContainer/WidthValue" to="." method="_on_SizeValue_value_changed"] [connection signal="value_changed" from="VBoxContainer/VBoxContainer/Templates/SizeContainer/VBoxContainer/WidthContainer/WidthValue" to="." method="_on_SizeValue_value_changed"]
[connection signal="value_changed" from="VBoxContainer/VBoxContainer/Templates/SizeContainer/VBoxContainer/HeightContainer/HeightValue" to="." method="_on_SizeValue_value_changed"] [connection signal="value_changed" from="VBoxContainer/VBoxContainer/Templates/SizeContainer/VBoxContainer/HeightContainer/HeightValue" to="." method="_on_SizeValue_value_changed"]

View file

@ -1,49 +0,0 @@
[gd_scene load_steps=15 format=3 uid="uid://cfihuvhy4ocx7"]
[ext_resource type="PackedScene" uid="uid://c7hnynip21y6u" path="res://src/UI/Dialogs/ImageEffects/FlipImageDialog.tscn" id="1"]
[ext_resource type="PackedScene" uid="uid://bl1t33abu7kl8" path="res://src/UI/Dialogs/ImageEffects/InvertColorsDialog.tscn" id="2"]
[ext_resource type="PackedScene" uid="uid://5gqka7tkg17k" path="res://src/UI/Dialogs/ImageEffects/DesaturateDialog.tscn" id="3"]
[ext_resource type="PackedScene" uid="uid://duse1w3q7whmm" path="res://src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn" id="4"]
[ext_resource type="PackedScene" uid="uid://cjd5sjemyea4a" path="res://src/UI/Dialogs/ImageEffects/GradientMapDialog.tscn" id="5"]
[ext_resource type="PackedScene" uid="uid://cnryslyvxv4ye" path="res://src/UI/Dialogs/ImageEffects/Posterize.tscn" id="6"]
[ext_resource type="PackedScene" uid="uid://q355qqjvuajs" path="res://src/UI/Dialogs/ImageEffects/OffsetImage.tscn" id="7"]
[ext_resource type="PackedScene" uid="uid://birggxam3fjnb" path="res://src/UI/Dialogs/ImageEffects/ResizeCanvas.tscn" id="8"]
[ext_resource type="PackedScene" uid="uid://bvr6j8sohxob3" path="res://src/UI/Dialogs/ImageEffects/RotateImage.tscn" id="9"]
[ext_resource type="PackedScene" uid="uid://bkr47ocij684y" path="res://src/UI/Dialogs/ImageEffects/ShaderEffect.tscn" id="10"]
[ext_resource type="PackedScene" uid="uid://oq036vr10yvk" path="res://src/UI/Dialogs/ImageEffects/HSVDialog.tscn" id="11"]
[ext_resource type="PackedScene" uid="uid://u0y5xogg636e" path="res://src/UI/Dialogs/ImageEffects/GradientDialog.tscn" id="12"]
[ext_resource type="PackedScene" uid="uid://ci2qpf6t3dyyr" path="res://src/UI/Dialogs/ImageEffects/OutlineDialog.tscn" id="13"]
[ext_resource type="PackedScene" uid="uid://omm7xmtf5kbj" path="res://src/UI/Dialogs/ImageEffects/ScaleImage.tscn" id="14"]
[node name="ImageEffects" type="Control"]
layout_mode = 3
anchors_preset = 0
mouse_filter = 2
[node name="OffsetImage" parent="." instance=ExtResource("7")]
[node name="ScaleImage" parent="." instance=ExtResource("14")]
[node name="ResizeCanvas" parent="." instance=ExtResource("8")]
[node name="RotateImage" parent="." instance=ExtResource("9")]
[node name="FlipImageDialog" parent="." instance=ExtResource("1")]
[node name="InvertColorsDialog" parent="." instance=ExtResource("2")]
[node name="DesaturateDialog" parent="." instance=ExtResource("3")]
[node name="OutlineDialog" parent="." instance=ExtResource("13")]
[node name="DropShadowDialog" parent="." instance=ExtResource("4")]
[node name="HSVDialog" parent="." instance=ExtResource("11")]
[node name="GradientDialog" parent="." instance=ExtResource("12")]
[node name="GradientMapDialog" parent="." instance=ExtResource("5")]
[node name="Posterize" parent="." instance=ExtResource("6")]
[node name="ShaderEffect" parent="." instance=ExtResource("10")]

View file

@ -10,6 +10,7 @@ var image := Image.create(1, 1, false, Image.FORMAT_RGBA8)
@onready var height_spinbox: SpinBox = $VBoxContainer/OptionsContainer/HeightValue @onready var height_spinbox: SpinBox = $VBoxContainer/OptionsContainer/HeightValue
@onready var x_spinbox: SpinBox = $VBoxContainer/OptionsContainer/XSpinBox @onready var x_spinbox: SpinBox = $VBoxContainer/OptionsContainer/XSpinBox
@onready var y_spinbox: SpinBox = $VBoxContainer/OptionsContainer/YSpinBox @onready var y_spinbox: SpinBox = $VBoxContainer/OptionsContainer/YSpinBox
@onready var aspect_ratio_container: AspectRatioContainer = $VBoxContainer/AspectRatioContainer
@onready var preview_rect: TextureRect = $VBoxContainer/AspectRatioContainer/Preview @onready var preview_rect: TextureRect = $VBoxContainer/AspectRatioContainer/Preview
@ -82,21 +83,7 @@ func update_preview() -> void:
image, Rect2i(Vector2i.ZERO, Global.current_project.size), Vector2i(offset_x, offset_y) image, Rect2i(Vector2i.ZERO, Global.current_project.size), Vector2i(offset_x, offset_y)
) )
preview_rect.texture = ImageTexture.create_from_image(preview_image) preview_rect.texture = ImageTexture.create_from_image(preview_image)
update_transparent_background_size(preview_image) aspect_ratio_container.ratio = float(preview_image.get_width()) / preview_image.get_height()
func update_transparent_background_size(preview_image: Image) -> void:
var image_size_y := preview_rect.size.y
var image_size_x := preview_rect.size.x
if preview_image.get_size().x > preview_image.get_size().y:
var scale_ratio := preview_image.get_size().x / image_size_x
image_size_y = preview_image.get_size().y / scale_ratio
else:
var scale_ratio := preview_image.get_size().y / image_size_y
image_size_x = preview_image.get_size().x / scale_ratio
preview_rect.get_node("TransparentChecker").size.x = image_size_x
preview_rect.get_node("TransparentChecker").size.y = image_size_y
func _on_visibility_changed() -> void: func _on_visibility_changed() -> void:

View file

@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://src/UI/Dialogs/ImportPreviewDialog.gd" id="1_r16hn"] [ext_resource type="Script" path="res://src/UI/Dialogs/ImportPreviewDialog.gd" id="1_r16hn"]
[ext_resource type="Script" path="res://src/UI/Dialogs/HelperScripts/RowColumnLines.gd" id="2_yokw4"] [ext_resource type="Script" path="res://src/UI/Dialogs/HelperScripts/RowColumnLines.gd" id="2_yokw4"]
[ext_resource type="Script" path="res://src/UI/Dialogs/HelperScripts/SmartSlicePreview.gd" id="3_aeccv"] [ext_resource type="Script" path="res://src/UI/Dialogs/HelperScripts/SmartSlicePreview.gd" id="3_aeccv"]
[ext_resource type="PackedScene" uid="uid://cii2hpylme60s" path="res://src/UI/Nodes/CollapsibleContainer.tscn" id="4_6ispq"] [ext_resource type="Script" path="res://src/UI/Nodes/CollapsibleContainer.gd" id="4_7dy5o"]
[ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="4_nmo33"] [ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="4_nmo33"]
[node name="ImportPreviewDialog" type="ConfirmationDialog"] [node name="ImportPreviewDialog" type="ConfirmationDialog"]
@ -91,8 +91,10 @@ layout_mode = 2
size_flags_vertical = 0 size_flags_vertical = 0
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
[node name="ImportOptionsContainer" parent="VBoxContainer" instance=ExtResource("4_6ispq")] [node name="ImportOptionsContainer" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_type_variation = &"CollapsibleContainer"
script = ExtResource("4_7dy5o")
text = "Import Options" text = "Import Options"
[node name="ImportOptions" type="VBoxContainer" parent="VBoxContainer/ImportOptionsContainer"] [node name="ImportOptions" type="VBoxContainer" parent="VBoxContainer/ImportOptionsContainer"]

View file

@ -127,6 +127,7 @@ func _on_DeleteConfirmation_confirmed() -> void:
func refresh_preview() -> void: func refresh_preview() -> void:
for tab in mimic_ui.get_tabs(): for tab in mimic_ui.get_tabs():
mimic_ui.remove_child(tab) mimic_ui.remove_child(tab)
tab.queue_free()
for item in Global.control.main_ui.get_tabs(): for item in Global.control.main_ui.get_tabs():
var box := TextEdit.new() var box := TextEdit.new()
box.name = item.name box.name = item.name

View file

@ -13,11 +13,8 @@ func _ready() -> void:
func _on_WindowOpacityDialog_about_to_show() -> void: func _on_WindowOpacityDialog_about_to_show() -> void:
get_tree().root.transparent = true get_tree().root.transparent = true
get_tree().root.transparent_bg = true get_tree().root.transparent_bg = true
slider.editable = !( slider.editable = not is_fullscreen()
(get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN) fullscreen_warning.visible = not slider.editable
or (get_window().mode == Window.MODE_FULLSCREEN)
)
fullscreen_warning.visible = !slider.editable
func _recalculate_opacity() -> void: func _recalculate_opacity() -> void:
@ -25,13 +22,9 @@ func _recalculate_opacity() -> void:
func set_window_opacity(value: float) -> void: func set_window_opacity(value: float) -> void:
if ( if is_fullscreen():
(get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN)
or (get_window().mode == Window.MODE_FULLSCREEN)
):
value = 100.0 value = 100.0
slider.value = value slider.value = value
value = value / 100.0 value = value / 100.0
# Find the TabContainer that has the Main Canvas panel # Find the TabContainer that has the Main Canvas panel
for container: Control in Global.control.main_ui._panel_container.get_children(): for container: Control in Global.control.main_ui._panel_container.get_children():
@ -44,3 +37,10 @@ func set_window_opacity(value: float) -> void:
func _on_visibility_changed() -> void: func _on_visibility_changed() -> void:
Global.dialog_open(false) Global.dialog_open(false)
func is_fullscreen() -> bool:
return (
(get_parent().get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN)
or (get_parent().get_window().mode == Window.MODE_FULLSCREEN)
)

View file

@ -1,9 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://cii2hpylme60s"]
[ext_resource type="Script" path="res://src/UI/Nodes/CollapsibleContainer.gd" id="2"]
[node name="CollapsibleContainer" type="VBoxContainer"]
offset_right = 40.0
offset_bottom = 20.0
theme_type_variation = &"CollapsibleContainer"
script = ExtResource("2")

View file

@ -10,6 +10,8 @@ anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_right = -1013.0 offset_right = -1013.0
offset_bottom = -510.0 offset_bottom = -510.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1") script = ExtResource("1")
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
@ -45,9 +47,6 @@ text = "Tracker Lines"
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"] [node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
layout_mode = 2 layout_mode = 2
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer"]
layout_mode = 2
[node name="Content" type="ScrollContainer" parent="VBoxContainer"] [node name="Content" type="ScrollContainer" parent="VBoxContainer"]
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3

View file

@ -27,7 +27,7 @@ func _set_visible(press: bool) -> void:
if press: if press:
$TextureRect.rotation = 0 $TextureRect.rotation = 0
else: else:
$TextureRect.rotation = -90 $TextureRect.rotation = -PI / 2
content.visible = press content.visible = press

View file

@ -1,169 +1,137 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=6 format=3 uid="uid://calecly82t1aw"]
[ext_resource path="res://src/UI/Nodes/ValueSlider.tscn" type="PackedScene" id=1] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="1"]
[ext_resource path="res://src/UI/PerspectiveEditor/VanishingPoint.gd" type="Script" id=2] [ext_resource type="Script" path="res://src/UI/PerspectiveEditor/VanishingPoint.gd" id="2"]
[ext_resource path="res://src/UI/Nodes/CollapsibleContainer.tscn" type="PackedScene" id=3] [ext_resource type="Texture2D" uid="uid://ct8wn8m6x4m54" path="res://assets/graphics/misc/value_arrow.svg" id="4"]
[ext_resource path="res://assets/graphics/misc/value_arrow.svg" type="Texture2D" id=4] [ext_resource type="Script" path="res://src/UI/PerspectiveEditor/PointCollapseContainer.gd" id="5"]
[ext_resource path="res://src/UI/PerspectiveEditor/PointCollapseContainer.gd" type="Script" id=5] [ext_resource type="Script" path="res://src/UI/Nodes/CollapsibleContainer.gd" id="5_xveuc"]
[node name="VanishingPoint" type="VBoxContainer" groups=["Entry"]] [node name="VanishingPoint" type="VBoxContainer" groups=["Entry"]]
offset_right = 261.0 offset_right = 261.0
offset_bottom = 145.0 offset_bottom = 145.0
script = ExtResource( 2 ) script = ExtResource("2")
[node name="TitleContainer" type="HBoxContainer" parent="."] [node name="TitleContainer" type="HBoxContainer" parent="."]
offset_right = 261.0 layout_mode = 2
offset_bottom = 20.0
[node name="PointCollapseContainer" type="Button" parent="TitleContainer"] [node name="PointCollapseContainer" type="Button" parent="TitleContainer"]
unique_name_in_owner = true unique_name_in_owner = true
offset_right = 207.0 layout_mode = 2
offset_bottom = 20.0
mouse_default_cursor_shape = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme_type_variation = "CollapsibleCheckBox" mouse_default_cursor_shape = 2
theme_type_variation = &"CollapsibleCheckBox"
toggle_mode = true toggle_mode = true
script = ExtResource( 5 ) script = ExtResource("5")
[node name="TextureRect" type="TextureRect" parent="TitleContainer/PointCollapseContainer" groups=["UIButtons"]] [node name="TextureRect" type="TextureRect" parent="TitleContainer/PointCollapseContainer" groups=["UIButtons"]]
layout_mode = 0
anchor_top = 0.5 anchor_top = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = 2.0 offset_left = 2.0
offset_top = -6.0 offset_top = -6.0
offset_right = 14.0 offset_right = 14.0
offset_bottom = 6.0 offset_bottom = 6.0
rotation = -90.0 pivot_offset = Vector2(6, 6)
pivot_offset = Vector2( 6, 6 ) texture = ExtResource("4")
texture = ExtResource( 4 )
[node name="Label" type="Label" parent="TitleContainer/PointCollapseContainer"] [node name="Label" type="Label" parent="TitleContainer/PointCollapseContainer"]
layout_mode = 0
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = 14.0 offset_left = 14.0
theme_type_variation = &"HeaderSmall" theme_type_variation = &"HeaderSmall"
valign = 1
[node name="ColorPickerButton" type="ColorPickerButton" parent="TitleContainer"] [node name="ColorPickerButton" type="ColorPickerButton" parent="TitleContainer"]
unique_name_in_owner = true unique_name_in_owner = true
offset_left = 211.0 custom_minimum_size = Vector2(50, 0)
offset_right = 261.0 layout_mode = 2
offset_bottom = 20.0
custom_minimum_size = Vector2( 50, 0 )
[node name="Content" type="HBoxContainer" parent="."] [node name="Content" type="HBoxContainer" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
offset_top = 24.0 layout_mode = 2
offset_right = 261.0
offset_bottom = 130.0
[node name="Spacer" type="Control" parent="Content"] [node name="Spacer" type="Control" parent="Content"]
offset_right = 5.0 custom_minimum_size = Vector2(5, 0)
offset_bottom = 106.0 layout_mode = 2
custom_minimum_size = Vector2( 5, 0 )
[node name="BoundaryL" type="ColorRect" parent="Content"] [node name="BoundaryL" type="ColorRect" parent="Content"]
offset_left = 9.0 custom_minimum_size = Vector2(2, 0)
offset_right = 11.0 layout_mode = 2
offset_bottom = 106.0
custom_minimum_size = Vector2( 2, 0 )
[node name="VBoxContainer" type="VBoxContainer" parent="Content"] [node name="VBoxContainer" type="VBoxContainer" parent="Content"]
offset_left = 15.0 layout_mode = 2
offset_right = 255.0
offset_bottom = 106.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="PointInfo" type="HBoxContainer" parent="Content/VBoxContainer"] [node name="PointInfo" type="HBoxContainer" parent="Content/VBoxContainer"]
offset_right = 240.0 layout_mode = 2
offset_bottom = 52.0
[node name="Label" type="Label" parent="Content/VBoxContainer/PointInfo"] [node name="Label" type="Label" parent="Content/VBoxContainer/PointInfo"]
offset_right = 56.0 layout_mode = 2
offset_bottom = 52.0
size_flags_vertical = 5 size_flags_vertical = 5
text = "Position:" text = "Position:"
[node name="Position" type="VBoxContainer" parent="Content/VBoxContainer/PointInfo"] [node name="Position" type="VBoxContainer" parent="Content/VBoxContainer/PointInfo"]
offset_left = 60.0 layout_mode = 2
offset_right = 240.0
offset_bottom = 52.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="X" parent="Content/VBoxContainer/PointInfo/Position" instance=ExtResource( 1 )] [node name="X" parent="Content/VBoxContainer/PointInfo/Position" instance=ExtResource("1")]
unique_name_in_owner = true unique_name_in_owner = true
offset_right = 180.0 layout_mode = 2
step = 0.5 step = 0.5
allow_greater = true allow_greater = true
allow_lesser = true allow_lesser = true
prefix = "X :" prefix = "X :"
[node name="Y" parent="Content/VBoxContainer/PointInfo/Position" instance=ExtResource( 1 )] [node name="Y" parent="Content/VBoxContainer/PointInfo/Position" instance=ExtResource("1")]
unique_name_in_owner = true unique_name_in_owner = true
offset_top = 28.0 layout_mode = 2
offset_right = 180.0
offset_bottom = 52.0
step = 0.5 step = 0.5
allow_greater = true allow_greater = true
allow_lesser = true allow_lesser = true
prefix = "Y :" prefix = "Y :"
[node name="CollapsibleContainer" parent="Content/VBoxContainer" instance=ExtResource( 3 )] [node name="CollapsibleContainer" type="VBoxContainer" parent="Content/VBoxContainer"]
offset_top = 56.0 layout_mode = 2
offset_right = 240.0 theme_type_variation = &"CollapsibleContainer"
offset_bottom = 76.0 script = ExtResource("5_xveuc")
text = "Lines" text = "Lines"
[node name="HBoxContainer" type="HBoxContainer" parent="Content/VBoxContainer/CollapsibleContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="Content/VBoxContainer/CollapsibleContainer"]
visible = false visible = false
offset_top = 24.0 layout_mode = 2
offset_right = 261.0
offset_bottom = 44.0
[node name="Spacer" type="Control" parent="Content/VBoxContainer/CollapsibleContainer/HBoxContainer"] [node name="Spacer" type="Control" parent="Content/VBoxContainer/CollapsibleContainer/HBoxContainer"]
offset_right = 20.0 custom_minimum_size = Vector2(20, 0)
offset_bottom = 20.0 layout_mode = 2
custom_minimum_size = Vector2( 20, 0 )
[node name="VSeparator" type="VSeparator" parent="Content/VBoxContainer/CollapsibleContainer/HBoxContainer"] [node name="VSeparator" type="VSeparator" parent="Content/VBoxContainer/CollapsibleContainer/HBoxContainer"]
offset_right = 4.0 layout_mode = 2
offset_bottom = 40.0
[node name="LinesContainer" type="VBoxContainer" parent="Content/VBoxContainer/CollapsibleContainer/HBoxContainer"] [node name="LinesContainer" type="VBoxContainer" parent="Content/VBoxContainer/CollapsibleContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
offset_left = 24.0 layout_mode = 2
offset_right = 261.0
offset_bottom = 20.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
[node name="AddLine" type="Button" parent="Content/VBoxContainer/CollapsibleContainer/HBoxContainer/LinesContainer"] [node name="AddLine" type="Button" parent="Content/VBoxContainer/CollapsibleContainer/HBoxContainer/LinesContainer"]
offset_right = 237.0 layout_mode = 2
offset_bottom = 20.0
text = "Add Line" text = "Add Line"
[node name="Delete" type="Button" parent="Content/VBoxContainer"] [node name="Delete" type="Button" parent="Content/VBoxContainer"]
offset_top = 80.0 custom_minimum_size = Vector2(40, 0)
offset_right = 240.0 layout_mode = 2
offset_bottom = 100.0
custom_minimum_size = Vector2( 40, 0 )
text = "Delete Point" text = "Delete Point"
[node name="BoundaryB" type="ColorRect" parent="Content/VBoxContainer"] [node name="BoundaryB" type="ColorRect" parent="Content/VBoxContainer"]
offset_top = 104.0 custom_minimum_size = Vector2(0, 2)
offset_right = 240.0 layout_mode = 2
offset_bottom = 106.0
custom_minimum_size = Vector2( 0, 2 )
[node name="BoundaryR" type="ColorRect" parent="Content"] [node name="BoundaryR" type="ColorRect" parent="Content"]
offset_left = 259.0 custom_minimum_size = Vector2(2, 0)
offset_right = 261.0 layout_mode = 2
offset_bottom = 106.0
custom_minimum_size = Vector2( 2, 0 )
[node name="HSeparator" type="HSeparator" parent="."] [node name="HSeparator" type="HSeparator" parent="."]
offset_top = 134.0 layout_mode = 2
offset_right = 261.0
offset_bottom = 144.0
theme_override_constants/separation = 10 theme_override_constants/separation = 10
[connection signal="toggled" from="TitleContainer/PointCollapseContainer" to="TitleContainer/PointCollapseContainer" method="_on_Button_toggled"] [connection signal="toggled" from="TitleContainer/PointCollapseContainer" to="TitleContainer/PointCollapseContainer" method="_on_Button_toggled"]

View file

@ -13,6 +13,26 @@ var recent_projects := []
var selected_layout := 0 var selected_layout := 0
var zen_mode := false var zen_mode := false
# Dialogs
var new_image_dialog := Dialog.new("res://src/UI/Dialogs/CreateNewImage.tscn")
var offset_image_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/OffsetImage.tscn")
var scale_image_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/ScaleImage.tscn")
var resize_canvas_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/ResizeCanvas.tscn")
var mirror_image_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/FlipImageDialog.tscn")
var rotate_image_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/RotateImage.tscn")
var invert_colors_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/InvertColorsDialog.tscn")
var desaturate_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/DesaturateDialog.tscn")
var outline_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/OutlineDialog.tscn")
var drop_shadow_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn")
var hsv_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/HSVDialog.tscn")
var gradient_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/GradientDialog.tscn")
var gradient_map_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/GradientMapDialog.tscn")
var posterize_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/Posterize.tscn")
var shader_effect_dialog := Dialog.new("res://src/UI/Dialogs/ImageEffects/ShaderEffect.tscn")
var manage_layouts_dialog := Dialog.new("res://src/UI/Dialogs/ManageLayouts.tscn")
var window_opacity_dialog := Dialog.new("res://src/UI/Dialogs/WindowOpacityDialog.tscn")
var about_dialog := Dialog.new("res://src/UI/Dialogs/AboutDialog.tscn")
@onready var main_ui := Global.control.find_child("DockableContainer") as DockableContainer @onready var main_ui := Global.control.find_child("DockableContainer") as DockableContainer
@onready var ui_elements := main_ui.get_children() @onready var ui_elements := main_ui.get_children()
@onready var file_menu: PopupMenu = $MenuBar/File @onready var file_menu: PopupMenu = $MenuBar/File
@ -24,8 +44,6 @@ var zen_mode := false
@onready var help_menu: PopupMenu = $MenuBar/Help @onready var help_menu: PopupMenu = $MenuBar/Help
@onready var greyscale_vision: ColorRect = main_ui.find_child("GreyscaleVision") @onready var greyscale_vision: ColorRect = main_ui.find_child("GreyscaleVision")
@onready var new_image_dialog: ConfirmationDialog = Global.control.find_child("CreateNewImage")
@onready var window_opacity_dialog: AcceptDialog = Global.control.find_child("WindowOpacityDialog")
@onready var tile_mode_submenu := PopupMenu.new() @onready var tile_mode_submenu := PopupMenu.new()
@onready var snap_to_submenu := PopupMenu.new() @onready var snap_to_submenu := PopupMenu.new()
@onready var panels_submenu := PopupMenu.new() @onready var panels_submenu := PopupMenu.new()
@ -33,6 +51,30 @@ var zen_mode := false
@onready var recent_projects_submenu := PopupMenu.new() @onready var recent_projects_submenu := PopupMenu.new()
class Dialog:
## This class is used to help with lazy loading dialog scenes in order to
## reduce Pixelorama's initial loading time, by only loading each dialog
## scene when it's actually needed.
var scene_path := ""
var node: Window
func _init(_scene_path: String) -> void:
scene_path = _scene_path
func popup(dialog_size := Vector2i.ZERO) -> void:
if not is_instance_valid(node):
var scene := load(scene_path)
if not scene is PackedScene:
return
node = scene.instantiate()
if not is_instance_valid(node):
return
Global.control.get_node("Dialogs").add_child(node)
node.popup_centered(dialog_size)
var is_file_dialog := node is FileDialog
Global.dialog_open(true, is_file_dialog)
func _ready() -> void: func _ready() -> void:
_setup_file_menu() _setup_file_menu()
_setup_edit_menu() _setup_edit_menu()
@ -383,7 +425,7 @@ func _popup_dialog(dialog: Window, dialog_size := Vector2i.ZERO) -> void:
func file_menu_id_pressed(id: int) -> void: func file_menu_id_pressed(id: int) -> void:
match id: match id:
Global.FileMenu.NEW: Global.FileMenu.NEW:
_popup_dialog(new_image_dialog) new_image_dialog.popup()
Global.FileMenu.OPEN: Global.FileMenu.OPEN:
_open_project_file() _open_project_file()
Global.FileMenu.OPEN_LAST_PROJECT: Global.FileMenu.OPEN_LAST_PROJECT:
@ -466,7 +508,7 @@ func edit_menu_id_pressed(id: int) -> void:
func view_menu_id_pressed(id: int) -> void: func view_menu_id_pressed(id: int) -> void:
match id: match id:
Global.ViewMenu.TILE_MODE_OFFSETS: Global.ViewMenu.TILE_MODE_OFFSETS:
_popup_dialog(Global.control.get_node("Dialogs/TileModeOffsetsDialog")) _popup_dialog(Global.tile_mode_offset_dialog)
Global.ViewMenu.GREYSCALE_VIEW: Global.ViewMenu.GREYSCALE_VIEW:
_toggle_greyscale_view() _toggle_greyscale_view()
Global.ViewMenu.MIRROR_VIEW: Global.ViewMenu.MIRROR_VIEW:
@ -492,7 +534,7 @@ func view_menu_id_pressed(id: int) -> void:
func window_menu_id_pressed(id: int) -> void: func window_menu_id_pressed(id: int) -> void:
match id: match id:
Global.WindowMenu.WINDOW_OPACITY: Global.WindowMenu.WINDOW_OPACITY:
_popup_dialog(window_opacity_dialog) window_opacity_dialog.popup()
Global.WindowMenu.MOVABLE_PANELS: Global.WindowMenu.MOVABLE_PANELS:
main_ui.tabs_visible = !main_ui.tabs_visible main_ui.tabs_visible = !main_ui.tabs_visible
window_menu.set_item_checked(id, main_ui.tabs_visible) window_menu.set_item_checked(id, main_ui.tabs_visible)
@ -540,7 +582,7 @@ func _panels_submenu_id_pressed(id: int) -> void:
func _layouts_submenu_id_pressed(id: int) -> void: func _layouts_submenu_id_pressed(id: int) -> void:
if id == 0: if id == 0:
_popup_dialog(Global.control.get_node("Dialogs/ManageLayouts")) manage_layouts_dialog.popup()
else: else:
set_layout(id - 1) set_layout(id - 1)
@ -640,63 +682,49 @@ func _toggle_zen_mode() -> void:
func _toggle_fullscreen() -> void: func _toggle_fullscreen() -> void:
get_window().mode = ( var is_fullscreen := (
Window.MODE_EXCLUSIVE_FULLSCREEN
if (!(
(get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN)
or (get_window().mode == Window.MODE_FULLSCREEN)
))
else Window.MODE_WINDOWED
)
window_menu.set_item_checked(
Global.WindowMenu.FULLSCREEN_MODE,
(
(get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN)
or (get_window().mode == Window.MODE_FULLSCREEN)
)
)
if (
(get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN) (get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN)
or (get_window().mode == Window.MODE_FULLSCREEN) or (get_window().mode == Window.MODE_FULLSCREEN)
): # If window is fullscreen then reset transparency )
window_opacity_dialog.set_window_opacity(100.0) get_window().mode = Window.MODE_EXCLUSIVE_FULLSCREEN if !is_fullscreen else Window.MODE_WINDOWED
is_fullscreen = not is_fullscreen
window_menu.set_item_checked(Global.WindowMenu.FULLSCREEN_MODE, is_fullscreen)
func image_menu_id_pressed(id: int) -> void: func image_menu_id_pressed(id: int) -> void:
match id: match id:
Global.ImageMenu.SCALE_IMAGE: Global.ImageMenu.SCALE_IMAGE:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/ScaleImage")) scale_image_dialog.popup()
Global.ImageMenu.OFFSET_IMAGE: Global.ImageMenu.OFFSET_IMAGE:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/OffsetImage")) offset_image_dialog.popup()
Global.ImageMenu.CROP_TO_SELECTION: Global.ImageMenu.CROP_TO_SELECTION:
DrawingAlgos.crop_to_selection() DrawingAlgos.crop_to_selection()
Global.ImageMenu.CROP_TO_CONTENT: Global.ImageMenu.CROP_TO_CONTENT:
DrawingAlgos.crop_to_content() DrawingAlgos.crop_to_content()
Global.ImageMenu.RESIZE_CANVAS: Global.ImageMenu.RESIZE_CANVAS:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/ResizeCanvas")) resize_canvas_dialog.popup()
Global.ImageMenu.FLIP: Global.ImageMenu.FLIP:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/FlipImageDialog")) mirror_image_dialog.popup()
Global.ImageMenu.ROTATE: Global.ImageMenu.ROTATE:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/RotateImage")) rotate_image_dialog.popup()
Global.ImageMenu.INVERT_COLORS: Global.ImageMenu.INVERT_COLORS:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/InvertColorsDialog")) invert_colors_dialog.popup()
Global.ImageMenu.DESATURATION: Global.ImageMenu.DESATURATION:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/DesaturateDialog")) desaturate_dialog.popup()
Global.ImageMenu.OUTLINE: Global.ImageMenu.OUTLINE:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/OutlineDialog")) outline_dialog.popup()
Global.ImageMenu.DROP_SHADOW: Global.ImageMenu.DROP_SHADOW:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/DropShadowDialog")) drop_shadow_dialog.popup()
Global.ImageMenu.HSV: Global.ImageMenu.HSV:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/HSVDialog")) hsv_dialog.popup()
Global.ImageMenu.GRADIENT: Global.ImageMenu.GRADIENT:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/GradientDialog")) gradient_dialog.popup()
Global.ImageMenu.GRADIENT_MAP: Global.ImageMenu.GRADIENT_MAP:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/GradientMapDialog")) gradient_map_dialog.popup()
Global.ImageMenu.POSTERIZE: Global.ImageMenu.POSTERIZE:
_popup_dialog(Global.control.get_node("Dialogs/ImageEffects/Posterize")) posterize_dialog.popup()
# Global.ImageMenu.SHADER: #Global.ImageMenu.SHADER:
# _popup_dialog(Global.control.get_node("Dialogs/ImageEffects/ShaderEffect")) #shader_effect_dialog.popup()
_: _:
_handle_metadata(id, image_menu) _handle_metadata(id, image_menu)
@ -732,7 +760,7 @@ func help_menu_id_pressed(id: int) -> void:
Global.HelpMenu.CHANGELOG: Global.HelpMenu.CHANGELOG:
OS.shell_open(CHANGELOG_URL) OS.shell_open(CHANGELOG_URL)
Global.HelpMenu.ABOUT_PIXELORAMA: Global.HelpMenu.ABOUT_PIXELORAMA:
_popup_dialog(Global.control.get_node("Dialogs/AboutDialog")) about_dialog.popup()
Global.HelpMenu.SUPPORT_PIXELORAMA: Global.HelpMenu.SUPPORT_PIXELORAMA:
OS.shell_open(SUPPORT_URL) OS.shell_open(SUPPORT_URL)
_: _: