Skip to content

Commit

Permalink
final fixes + new callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
jabsatz committed Mar 2, 2023
1 parent 47293ae commit b0cbb90
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 71 deletions.
12 changes: 8 additions & 4 deletions addons/scene_manager/SceneManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ var is_transitioning := false
@onready var _tree := get_tree()
@onready var _root := _tree.get_root()
@onready var _current_scene := _tree.current_scene
@onready var _animation_player := $AnimationPlayer
@onready var _shader_blend_rect := $CanvasLayer/ColorRect
@onready var _animation_player : AnimationPlayer = $AnimationPlayer
@onready var _shader_blend_rect : ColorRect = $CanvasLayer/ColorRect

var default_options := {
"speed": 2,
Expand All @@ -25,6 +25,8 @@ var default_options := {
"skip_fade_in": false,
"on_tree_enter": func(scene): null,
"on_ready": func(scene): null,
"on_fade_out": func(): null,
"on_fade_in": func(): null,
}
# extra_options = {
# "pattern_enter": DEFAULT_IMAGE,
Expand Down Expand Up @@ -135,7 +137,7 @@ func _replace_scene(path: String, options: Dictionary) -> void:
func fade_out(setted_options: Dictionary= {}) -> void:
var options = _get_final_options(setted_options)
is_transitioning = true
_animation_player.playback_speed = options["speed"]
_animation_player.speed_scale = options["speed"]

_shader_blend_rect.material.set_shader_parameter(
"dissolve_texture", options["pattern_enter"]
Expand All @@ -149,10 +151,11 @@ func fade_out(setted_options: Dictionary= {}) -> void:

await _animation_player.animation_finished
fade_complete.emit()
options["on_fade_out"].call()

func fade_in(setted_options: Dictionary = {}) -> void:
var options = _get_final_options(setted_options)
_animation_player.playback_speed = options["speed"]
_animation_player.speed_scale = options["speed"]
_shader_blend_rect.material.set_shader_parameter(
"dissolve_texture", options["pattern_leave"]
)
Expand All @@ -166,3 +169,4 @@ func fade_in(setted_options: Dictionary = {}) -> void:
await _animation_player.animation_finished
is_transitioning = false
transition_finished.emit()
options["on_fade_in"].call()
2 changes: 1 addition & 1 deletion addons/scene_manager/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="Scene Manager"
description="Scene Manager"
author="GlassBrick"
version="alpha-gd4-1"
version="1.0.0"
script="SceneManagerPlugin.gd"
16 changes: 9 additions & 7 deletions addons/scene_manager/shader_patterns/circle.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bpskbib6w4gdp"
path="res://.godot/imported/circle.png-49deb66a2171d4476d4de5b40b7c62d8.ctex"
path.s3tc="res://.godot/imported/circle.png-49deb66a2171d4476d4de5b40b7c62d8.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}

[deps]

source_file="res://addons/scene_manager/shader_patterns/circle.png"
dest_files=["res://.godot/imported/circle.png-49deb66a2171d4476d4de5b40b7c62d8.ctex"]
dest_files=["res://.godot/imported/circle.png-49deb66a2171d4476d4de5b40b7c62d8.s3tc.ctex"]

[params]

compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
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
detect_3d/compress_to=0
16 changes: 9 additions & 7 deletions addons/scene_manager/shader_patterns/curtains.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://nglientb4rxo"
path="res://.godot/imported/curtains.png-f5a25cbc897d336641cfbab203b5832e.ctex"
path.s3tc="res://.godot/imported/curtains.png-f5a25cbc897d336641cfbab203b5832e.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}

[deps]

source_file="res://addons/scene_manager/shader_patterns/curtains.png"
dest_files=["res://.godot/imported/curtains.png-f5a25cbc897d336641cfbab203b5832e.ctex"]
dest_files=["res://.godot/imported/curtains.png-f5a25cbc897d336641cfbab203b5832e.s3tc.ctex"]

[params]

compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
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
detect_3d/compress_to=0
16 changes: 9 additions & 7 deletions addons/scene_manager/shader_patterns/diagonal.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cgmfhc32g6va6"
path="res://.godot/imported/diagonal.png-fda70de082e7ad6bc449e3580ab09c7f.ctex"
path.s3tc="res://.godot/imported/diagonal.png-fda70de082e7ad6bc449e3580ab09c7f.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}

[deps]

source_file="res://addons/scene_manager/shader_patterns/diagonal.png"
dest_files=["res://.godot/imported/diagonal.png-fda70de082e7ad6bc449e3580ab09c7f.ctex"]
dest_files=["res://.godot/imported/diagonal.png-fda70de082e7ad6bc449e3580ab09c7f.s3tc.ctex"]

[params]

compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
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
detect_3d/compress_to=0
16 changes: 9 additions & 7 deletions addons/scene_manager/shader_patterns/horizontal.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://7ypismovx1sv"
path="res://.godot/imported/horizontal.png-350a31fe557936e31f870194c26cef69.ctex"
path.s3tc="res://.godot/imported/horizontal.png-350a31fe557936e31f870194c26cef69.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}

[deps]

source_file="res://addons/scene_manager/shader_patterns/horizontal.png"
dest_files=["res://.godot/imported/horizontal.png-350a31fe557936e31f870194c26cef69.ctex"]
dest_files=["res://.godot/imported/horizontal.png-350a31fe557936e31f870194c26cef69.s3tc.ctex"]

[params]

compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
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
detect_3d/compress_to=0
16 changes: 9 additions & 7 deletions addons/scene_manager/shader_patterns/radial.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dpipc6av3p107"
path="res://.godot/imported/radial.png-45b81257cf212bc197b861ea33052002.ctex"
path.s3tc="res://.godot/imported/radial.png-45b81257cf212bc197b861ea33052002.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}

[deps]

source_file="res://addons/scene_manager/shader_patterns/radial.png"
dest_files=["res://.godot/imported/radial.png-45b81257cf212bc197b861ea33052002.ctex"]
dest_files=["res://.godot/imported/radial.png-45b81257cf212bc197b861ea33052002.s3tc.ctex"]

[params]

compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
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
detect_3d/compress_to=0
16 changes: 9 additions & 7 deletions addons/scene_manager/shader_patterns/scribbles.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bgcid7fyjtd30"
path="res://.godot/imported/scribbles.png-430a0f7331a442eb053961f8e9bb82f0.ctex"
path.s3tc="res://.godot/imported/scribbles.png-430a0f7331a442eb053961f8e9bb82f0.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}

[deps]

source_file="res://addons/scene_manager/shader_patterns/scribbles.png"
dest_files=["res://.godot/imported/scribbles.png-430a0f7331a442eb053961f8e9bb82f0.ctex"]
dest_files=["res://.godot/imported/scribbles.png-430a0f7331a442eb053961f8e9bb82f0.s3tc.ctex"]

[params]

compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
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
detect_3d/compress_to=0
8 changes: 4 additions & 4 deletions addons/scene_manager/shader_patterns/squares.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@ importer="texture"
type="CompressedTexture2D"
uid="uid://b45fitoojqhxe"
path.s3tc="res://.godot/imported/squares.png-a8c8144d665aa3e0d712474304ad6e6f.s3tc.ctex"
path.etc2="res://.godot/imported/squares.png-a8c8144d665aa3e0d712474304ad6e6f.etc2.ctex"
metadata={
"imported_formats": ["s3tc", "etc2"],
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}

[deps]

source_file="res://addons/scene_manager/shader_patterns/squares.png"
dest_files=["res://.godot/imported/squares.png-a8c8144d665aa3e0d712474304ad6e6f.s3tc.ctex", "res://.godot/imported/squares.png-a8c8144d665aa3e0d712474304ad6e6f.etc2.ctex"]
dest_files=["res://.godot/imported/squares.png-a8c8144d665aa3e0d712474304ad6e6f.s3tc.ctex"]

[params]

compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
Expand All @@ -31,5 +30,6 @@ 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=0
16 changes: 9 additions & 7 deletions addons/scene_manager/shader_patterns/vertical.png.import
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cwci7g18k0mgh"
path="res://.godot/imported/vertical.png-5d237b9ea3cdd66e653ef032da0bd507.ctex"
path.s3tc="res://.godot/imported/vertical.png-5d237b9ea3cdd66e653ef032da0bd507.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}

[deps]

source_file="res://addons/scene_manager/shader_patterns/vertical.png"
dest_files=["res://.godot/imported/vertical.png-5d237b9ea3cdd66e653ef032da0bd507.ctex"]
dest_files=["res://.godot/imported/vertical.png-5d237b9ea3cdd66e653ef032da0bd507.s3tc.ctex"]

[params]

compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
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
detect_3d/compress_to=0
4 changes: 3 additions & 1 deletion demo/test.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
[ext_resource type="Script" path="res://demo/test.gd" id="1"]

[node name="Level1" type="Node"]
script = ExtResource( "1" )
script = ExtResource("1")

[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="ColorRect" type="ColorRect" parent="CanvasLayer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
color = Color(0.298039, 0.14902, 0.14902, 1)

[node name="Button" type="Button" parent="CanvasLayer/ColorRect" groups=["scene_manager_entity_nodes"]]
layout_mode = 0
anchor_left = 0.4
anchor_top = 0.4
anchor_right = 0.6
Expand Down
Loading

0 comments on commit b0cbb90

Please sign in to comment.