Loading images with noise distortion.
This commit is contained in:
19
run/main.gd
Normal file
19
run/main.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
extends Control
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
%LoadImageButton.pressed.connect(show_image_load_dialog)
|
||||
%LoadImageDialog.file_selected.connect(load_image)
|
||||
|
||||
func show_image_load_dialog():
|
||||
%LoadImageDialog.visible = true
|
||||
|
||||
func load_image(path: String) -> bool:
|
||||
var image = Image.load_from_file(path)
|
||||
if image == null:
|
||||
return false
|
||||
|
||||
var tex = ImageTexture.create_from_image(image)
|
||||
%PreviewImage.texture = tex
|
||||
%LoadImageButton.text = path.get_file()
|
||||
return true
|
||||
1
run/main.gd.uid
Normal file
1
run/main.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://g3xgdtvbtg2f
|
||||
136
run/main.tscn
Normal file
136
run/main.tscn
Normal file
@@ -0,0 +1,136 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b8c8qe2xi5m24"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dldw5nkqr0djl" path="res://icon.svg" id="1_4u770"]
|
||||
[ext_resource type="Script" uid="uid://g3xgdtvbtg2f" path="res://run/main.gd" id="1_t8dga"]
|
||||
[ext_resource type="Material" uid="uid://wr6g6bhw2fyj" path="res://content/mat_imagine.tres" id="2_vt7r5"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_t8dga"]
|
||||
bg_color = Color(0.1003897, 0.10924364, 0.113670714, 1)
|
||||
|
||||
[node name="Main" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_t8dga")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="LoadImageDialog" type="FileDialog" parent="."]
|
||||
unique_name_in_owner = true
|
||||
oversampling_override = 1.0
|
||||
title = "Open a File"
|
||||
dialog_hide_on_ok = true
|
||||
file_mode = 0
|
||||
access = 2
|
||||
filters = PackedStringArray("*.png")
|
||||
use_native_dialog = true
|
||||
hidden_files_toggle_enabled = false
|
||||
file_filter_toggle_enabled = false
|
||||
file_sort_options_enabled = false
|
||||
folder_creation_enabled = false
|
||||
favorites_enabled = false
|
||||
|
||||
[node name="MainSplit" type="HBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="PreviewSide" type="MarginContainer" parent="MainSplit"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 3.0
|
||||
theme_override_constants/margin_left = 8
|
||||
theme_override_constants/margin_top = 8
|
||||
theme_override_constants/margin_right = 8
|
||||
theme_override_constants/margin_bottom = 8
|
||||
|
||||
[node name="PreviewWindow" type="AspectRatioContainer" parent="MainSplit/PreviewSide"]
|
||||
layout_mode = 2
|
||||
ratio = 1.7778
|
||||
|
||||
[node name="Panel" type="Panel" parent="MainSplit/PreviewSide/PreviewWindow"]
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_t8dga")
|
||||
|
||||
[node name="PreviewImage" type="TextureRect" parent="MainSplit/PreviewSide/PreviewWindow/Panel"]
|
||||
unique_name_in_owner = true
|
||||
material = ExtResource("2_vt7r5")
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("1_4u770")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="ControlSide" type="PanelContainer" parent="MainSplit"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MainSplit/ControlSide"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 4
|
||||
theme_override_constants/margin_top = 4
|
||||
theme_override_constants/margin_right = 4
|
||||
theme_override_constants/margin_bottom = 4
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MainSplit/ControlSide/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 50)
|
||||
layout_mode = 2
|
||||
text = "Imagine Composer"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="FileContainer" type="FoldableContainer" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
title = "File"
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="LoadImageButton" type="Button" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Load Image"
|
||||
|
||||
[node name="LoadFXButton" type="Button" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Load FX"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="SaveFXButton" type="Button" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Save FX"
|
||||
|
||||
[node name="SaveFXAsButton" type="Button" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer/FileContainer/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Save FX As"
|
||||
|
||||
[node name="FX Container" type="FoldableContainer" parent="MainSplit/ControlSide/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
title = "Effects"
|
||||
Reference in New Issue
Block a user