First commit 🎉
This commit is contained in:
commit
43ea213f9b
728 changed files with 37080 additions and 0 deletions
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://idhocibii42k"
|
||||
path="res://.godot/imported/bg.png-6dcbcf5b25ba42e2bc7afa216489dc53.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/popochiu/engine/objects/transition_layer/images/bg.png"
|
||||
dest_files=["res://.godot/imported/bg.png-6dcbcf5b25ba42e2bc7afa216489dc53.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
|
|
@ -0,0 +1,120 @@
|
|||
class_name PopochiuTransitionLayer
|
||||
extends Control
|
||||
## Used to play different transition animations when moving between rooms, skipping a cutscene,
|
||||
## and so on.
|
||||
|
||||
signal transition_finished(transition_name: String)
|
||||
|
||||
## Available transition types.
|
||||
enum {
|
||||
## Fades in and out.
|
||||
FADE_IN_OUT,
|
||||
## Fades in.
|
||||
FADE_IN,
|
||||
## Fades out.
|
||||
FADE_OUT,
|
||||
## Passes down and up.
|
||||
PASS_DOWN_IN_OUT,
|
||||
## Passes down.
|
||||
PASS_DOWN_IN,
|
||||
## Passes up.
|
||||
PASS_DOWN_OUT,
|
||||
}
|
||||
|
||||
|
||||
#region Godot ######################################################################################
|
||||
func _ready() -> void:
|
||||
# Connect to childrens' signals
|
||||
$AnimationPlayer.animation_finished.connect(_transition_finished)
|
||||
$Curtain.modulate = PopochiuUtils.e.settings.fade_color
|
||||
|
||||
# Make sure the transition layer is ready
|
||||
# if it has to be visible in the first room
|
||||
if PopochiuUtils.e.settings.show_tl_in_first_room and Engine.get_process_frames() == 0:
|
||||
$Curtain.show()
|
||||
_show()
|
||||
else:
|
||||
$AnimationPlayer.play("RESET")
|
||||
await get_tree().process_frame
|
||||
|
||||
_hide()
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public #####################################################################################
|
||||
## Plays a transition with the animation identified by [param type] and that lasts [param duration]
|
||||
## (in seconds). The transition can be one of the following:
|
||||
## [enum PopochiuTransitionLayer.FADE_IN_OUT], [enum PopochiuTransitionLayer.FADE_IN],
|
||||
## [enum PopochiuTransitionLayer.FADE_OUT], [enum PopochiuTransitionLayer.PASS_DOWN_IN_OUT],
|
||||
## [enum PopochiuTransitionLayer.PASS_DOWN_IN], [enum PopochiuTransitionLayer.PASS_DOWN_OUT].
|
||||
func play_transition(type := FADE_IN, duration := 1.0) -> void:
|
||||
_show()
|
||||
|
||||
# ---- Play RESET in order to fix #168 ---------------------------------------------------------
|
||||
$AnimationPlayer.play("RESET")
|
||||
await get_tree().process_frame
|
||||
# --------------------------------------------------------- Play RESET in order to fix #168 ----
|
||||
|
||||
$AnimationPlayer.speed_scale = 1.0 / duration
|
||||
|
||||
match type:
|
||||
FADE_IN_OUT:
|
||||
$AnimationPlayer.play("fade")
|
||||
await $AnimationPlayer.animation_finished
|
||||
$AnimationPlayer.play_backwards("fade")
|
||||
await $AnimationPlayer.animation_finished
|
||||
_hide()
|
||||
FADE_IN:
|
||||
$AnimationPlayer.play("fade")
|
||||
FADE_OUT:
|
||||
$AnimationPlayer.play_backwards("fade")
|
||||
await $AnimationPlayer.animation_finished
|
||||
_hide()
|
||||
PASS_DOWN_IN_OUT:
|
||||
$AnimationPlayer.play("pass")
|
||||
await $AnimationPlayer.animation_finished
|
||||
$AnimationPlayer.play_backwards("pass")
|
||||
await $AnimationPlayer.animation_finished
|
||||
_hide()
|
||||
PASS_DOWN_IN:
|
||||
$AnimationPlayer.play("pass")
|
||||
PASS_DOWN_OUT:
|
||||
$AnimationPlayer.play_backwards("pass")
|
||||
await $AnimationPlayer.animation_finished
|
||||
_hide()
|
||||
|
||||
|
||||
## Shows the curtain without playing any transition.
|
||||
func show_curtain() -> void:
|
||||
$Curtain.modulate = PopochiuUtils.e.settings.fade_color
|
||||
$Curtain.show()
|
||||
_show()
|
||||
|
||||
|
||||
## Hides the transition layer.
|
||||
func hide_curtain() -> void:
|
||||
_hide()
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private ####################################################################################
|
||||
func _transition_finished(anim_name := "") -> void:
|
||||
if anim_name == "RESET":
|
||||
return
|
||||
|
||||
transition_finished.emit(anim_name)
|
||||
|
||||
|
||||
func _show() -> void:
|
||||
show()
|
||||
PopochiuUtils.g.hide_interface()
|
||||
|
||||
|
||||
func _hide() -> void:
|
||||
hide()
|
||||
PopochiuUtils.g.show_interface()
|
||||
|
||||
|
||||
#endregion
|
|
@ -0,0 +1 @@
|
|||
uid://ci5qyrur1eg5w
|
|
@ -0,0 +1,139 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://b1pvo43ed3eey"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/popochiu/engine/objects/transition_layer/transition_layer.gd" id="1"]
|
||||
|
||||
[sub_resource type="Animation" id="5"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Curtain:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Curtain:modulate:a")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Curtain:scale:y")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [1.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="1"]
|
||||
resource_name = "fade"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Curtain:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Curtain:modulate:a")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 1.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="3"]
|
||||
resource_name = "pass"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Curtain:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [true, true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Curtain:scale:y")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 1.0]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Curtain:modulate:a")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [1.0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_vskw8"]
|
||||
_data = {
|
||||
"RESET": SubResource("5"),
|
||||
"fade": SubResource("1"),
|
||||
"pass": SubResource("3")
|
||||
}
|
||||
|
||||
[node name="TransitionLayer" 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")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_vskw8")
|
||||
}
|
||||
|
||||
[node name="Curtain" type="ColorRect" parent="."]
|
||||
visible = false
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
Loading…
Add table
Add a link
Reference in a new issue