Change background and fix image viewport outline
This commit is contained in:
parent
9b1efc1513
commit
b6f6c3d27e
7 changed files with 67 additions and 11 deletions
|
@ -16,6 +16,14 @@ func _input(event):
|
|||
if self.drag && event is InputEventMouseMotion:
|
||||
self.global_position -= event.relative / self.zoom
|
||||
|
||||
var old_zoom = self.zoom
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if self.zoom != old_zoom:
|
||||
image_viewport_display.update_zoom_texture_filter(self.zoom)
|
||||
image_viewport_display.material.set_shader_parameter("zoom_level", self.zoom)
|
||||
old_zoom = self.zoom
|
||||
|
||||
func fit_image():
|
||||
if Filesystem.original_image != null:
|
||||
var image_size = Filesystem.original_image.get_size()
|
||||
|
@ -28,21 +36,15 @@ func fit_image():
|
|||
self.zoom = Vector2(zoomf, zoomf)
|
||||
self.global_position = Vector2(0, 0)
|
||||
|
||||
func update_vd_zoomlevel():
|
||||
image_viewport_display.update_zoom_texture_filter(self.zoom)
|
||||
image_viewport_display.material.set_shader_parameter("zoom_level", self.zoom)
|
||||
|
||||
func zoom_in():
|
||||
var old_mouse_pos = get_global_mouse_position()
|
||||
self.zoom *= 1.2
|
||||
self.global_position += old_mouse_pos - get_global_mouse_position()
|
||||
update_vd_zoomlevel()
|
||||
|
||||
func zoom_out():
|
||||
var old_mouse_pos = get_global_mouse_position()
|
||||
self.zoom *= 1/1.2
|
||||
self.global_position += old_mouse_pos - get_global_mouse_position()
|
||||
update_vd_zoomlevel()
|
||||
|
||||
func _on_fit_image_button_pressed():
|
||||
fit_image()
|
||||
|
|
|
@ -106,7 +106,6 @@ func update(overwrite_image_path: String = "") -> Array: # returns error message
|
|||
image_sprite.material = null
|
||||
if fit_image:
|
||||
camera.fit_image()
|
||||
camera.update_vd_zoomlevel()
|
||||
image_viewport_display.show()
|
||||
# done
|
||||
return errors
|
||||
|
|
BIN
src/assets/bg.png
Normal file
BIN
src/assets/bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 532 B |
34
src/assets/bg.png.import
Normal file
34
src/assets/bg.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d2nwchyd6huob"
|
||||
path="res://.godot/imported/bg.png-7c8713dd1fab321784216191fa747e53.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/assets/bg.png"
|
||||
dest_files=["res://.godot/imported/bg.png-7c8713dd1fab321784216191fa747e53.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
|
@ -1,10 +1,11 @@
|
|||
[gd_scene load_steps=12 format=3 uid="uid://bjah7k4bxo044"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://bjah7k4bxo044"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://5sbslwysin5a" path="res://src/Main.gd" id="1_64y3g"]
|
||||
[ext_resource type="Script" uid="uid://d106170kuigl3" path="res://src/ImageCompositor.gd" id="2_4ykh7"]
|
||||
[ext_resource type="Shader" uid="uid://ctk7jomfyx0fh" path="res://src/shader/ivd_outline.gdshader" id="3_0fllm"]
|
||||
[ext_resource type="Script" uid="uid://ctc4lhbdsoq7u" path="res://src/ImageViewportDisplay.gd" id="4_pbpx2"]
|
||||
[ext_resource type="Script" uid="uid://b6r8rigubdctk" path="res://src/Camera.gd" id="5_hkdq6"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2nwchyd6huob" path="res://src/assets/bg.png" id="6_kokaf"]
|
||||
[ext_resource type="Theme" uid="uid://cwqlns34rj3vx" path="res://src/theme.tres" id="6_rjp5f"]
|
||||
[ext_resource type="Script" uid="uid://bxgmf2ny7yuc8" path="res://src/MainUI.gd" id="7_5puhk"]
|
||||
[ext_resource type="Script" uid="uid://bh0gpu3i2p47f" path="res://src/VersionLabel.gd" id="8_kod8x"]
|
||||
|
@ -18,7 +19,6 @@ viewport_path = NodePath("Compositor")
|
|||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_6o860"]
|
||||
font_size = 12
|
||||
font_color = Color(1, 1, 1, 0.509804)
|
||||
shadow_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
|
@ -39,6 +39,27 @@ unique_name_in_owner = true
|
|||
offset = Vector2(0, -64)
|
||||
script = ExtResource("5_hkdq6")
|
||||
|
||||
[node name="CanvasLayerBg" type="CanvasLayer" parent="."]
|
||||
layer = -1
|
||||
|
||||
[node name="Control" type="Control" parent="CanvasLayerBg"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="CanvasLayerBg/Control"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("6_kokaf")
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="MainUI" type="Control" parent="CanvasLayer"]
|
||||
|
|
|
@ -11,6 +11,6 @@ void fragment() {
|
|||
UV.x > 1.0-t.x ||
|
||||
UV.y > 1.0-t.y
|
||||
) {
|
||||
COLOR = mix(COLOR, vec4(1.0), 0.5);
|
||||
COLOR = mix(COLOR, vec4(0.5), 0.5);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue