Giter VIP home page Giter VIP logo

scene_manager's Introduction

Scene Manager

A tool to manage transition between different scenes.
Scene Manager v1.X.X and v2.X.X is compatible with Godot 3.
Scene Manager v3.X.X is compatible with Godot 4.

Note: Scene Manager v2.X.X and v1.X.X has heavily less features.

Features

Recently Added:

  • Pause and Resume functions added
  • Reactive button added which makes the Scene Manager UI reactive to changes on File System of godot and refreshes the Scene Manager UI automatically every time an update happens on files in res:// location
  • Auto Save button added which saves automatically every time a new change found in Scene Manager UI + If Reactive is enabled too, after that mechanism, save gets called automatically so that there would be no need to use the save button at all

All:

  • A fully responsive tool menu structure to manage and categorize your scene
  • Save button that saves all scenes in a dictionary
  • Refresh button that refreshes the tool with latest saved status of the scenes
  • List duplication check for keys
  • Smooth transition between scenes
  • Ignore folder feature in UI ignores all scenes inside that specific folder that you added in the ignore list
  • Categorization for scenes
  • Ignore folder section can hide optionally
  • Change to previous scenes is possible
  • Fully customizable transitions
  • Customizable way of entering the first scene of the game
  • Reset Scene Manager function to assume the current scene as the first ever seen scene (to ignore previous scenes and don't go back to them by changing scene to the previous scene)
  • Arrangeable scene categories(they will reset to alphabetic order after refresh or save button pressed)
  • Fade in and fade out with different desired patterns
  • You can create instance of a scene just by calling the scene with a key
  • Transition is so much customizable
  • SceneManager tool will ignore scenes inside folders with .gdignore file beside them
  • Loading scenes interactive is possible. (Loading scene code example added)
  • Ability to limit how much deep scene manager is allowed to record previous scenes which affects in changing scene to back(previous scene) functionality
  • Ability to hide scenes in a list (Just Godot4)
  • Ignoring a specific scene in ignores list section is possible (Just Godot4)
  • sublist in lists of scene manager UI is now possible (Just Godot4)
  • no_effect_change_scene function added (Just Godot4)
  • Node can be added to change_scene and no_effect_change_scene functions (Just Godot4)
  • Possibility to specify path scenes.db via Project/Settings (Just Godot4)
  • 5 new signals added:
    • scene_changed
    • fade_in_started
    • fade_out_started
    • fade_in_finished
    • fade_out_finished
  • Added a feature to navigate to the scene path in filesystem on godot when clicked on scene address in Scene Manager tool
  • Added a feature to open a desired scene from Scene Manager tab
  • Users now can have some time to load their scene in the background with the new changing scene functionality

How To Use?

  1. Copy and paste scene_manager folder which is inside addons folder. (don't change the scene_manager folder name)
  2. From editor toolbar, choose Project > Project Settings... then in Plugins tab, activate scene_manager plugin.
  3. Use Scene Manager tab on right side of the screen(on default godot theme view) to manage your scenes.
  4. After you are done with managing your scenes, always save your changes so that your changes have effect inside your actual game.

Note: After activating Scene Manager tool, you have access to SceneManager script globally from anywhere in your scripts and you can use it to change scenes and ... (for more information, read SceneManager section) Note: This tool saves your scenes data inside res://addons/scene_manager/scenes.gd file, if you want to have your latest changes and avoid redefining your scene keys, do not remove it, do not change it or modify it in anyway.

Tool View

Note: All demo pictures and gifs are from Godot4 UI. This is the tool that you will see on your right side of the godot editor after activating scene_manager plugin. By Add Category button under scenes categories you can create new categories to manage your scenes.

Double key checker

If editing of a scene key causes at least two keys of another scene match, both of them will get red color and you have to fix the duplication, otherwise the plugin does not work properly as you expect it to work.

Ignore Folder

Every folder that is added inside this section will be ignored and scenes inside them will not get included inside scenes categories section(the section above this section).

Scene Menu

Every scene has a button beside them which will open up a menu to configure settings of that specific scene.

Hide (Just Godot4)

From menu of every scene, you can visible or hide scenes and see just hidden or visible scenes in lists by clicking on eye icon at the top of list categories.

SubList (Just Godot4)

As it is visible on previous pictures, it is possible to add sublists in lists and categorize different scenes in different sublists.

All you have to do is drag scenes by their buttons on the left and drop them on other sublists.

Demo

Just a simple demo to show some abilities of this addon:

Demo Description

  1. Scene <number>: this button calls change_scene function and goes to next scene.
  2. Reset: after pressing this button, you don't go back to the previous seen scenes by pressing back button but if you do, you actually restart your scene.
  3. Reload: reloads the current scene.
  4. Back: goes back to previous scene. (or restarts if there is no previous scene)
  5. Nothing: just shows a transition but actually does nothing.
  6. Exit: after fading out of the screen, quits the game.

Demo Code

Note: You can use SceneManager node in your game after you activated scene_manager plugin.

Simple Example Without any Loading Screen

extends Button

@export var scene: String
@export var fade_out_speed: float = 1.0
@export var fade_in_speed: float = 1.0
@export var fade_out_pattern: String = "fade"
@export var fade_in_pattern: String = "fade"
@export var fade_out_smoothness = 0.1 # (float, 0, 1)
@export var fade_in_smoothness = 0.1 # (float, 0, 1)
@export var fade_out_inverted: bool = false
@export var fade_in_inverted: bool = false
@export var color: Color = Color(0, 0, 0)
@export var timeout: float = 0.0
@export var clickable: bool = false
@export var add_to_back: bool = true

@onready var fade_out_options = SceneManager.create_options(fade_out_speed, fade_out_pattern, fade_out_smoothness, fade_out_inverted)
@onready var fade_in_options = SceneManager.create_options(fade_in_speed, fade_in_pattern, fade_in_smoothness, fade_in_inverted)
@onready var general_options = SceneManager.create_general_options(color, timeout, clickable, add_to_back)

func _ready() -> void:
 var fade_in_first_scene_options = SceneManager.create_options(1, "fade")
 var first_scene_general_options = SceneManager.create_general_options(Color(0, 0, 0), 1, false)
 SceneManager.show_first_scene(fade_in_first_scene_options, first_scene_general_options)
 # code breaks if scene is not recognizable
 SceneManager.validate_scene(scene)
 # code breaks if pattern is not recognizable
 SceneManager.validate_pattern(fade_out_pattern)
 SceneManager.validate_pattern(fade_in_pattern)

func _on_button_button_up():
 SceneManager.change_scene(scene, fade_out_options, fade_in_options, general_options)

func _on_reset_button_up():
 SceneManager.reset_scene_manager()

func _on_loading_scene_button_up():
 SceneManager.set_recorded_scene(scene)
 SceneManager.change_scene("loading", fade_out_options, fade_in_options, general_options)

func _on_loading_scene_initialization_button_up():
 SceneManager.set_recorded_scene(scene)
 SceneManager.change_scene("loading_with_initialization", fade_out_options, fade_in_options, general_options)

func _on_pause_and_resume_button_up():
 await SceneManager.pause(fade_out_options, general_options)
 await get_tree().create_timer(3).timeout
 await SceneManager.resume(fade_in_options, general_options)

Simple Example With Loading Screen

extends Control

# Nodes
@onready var progress: ProgressBar = find_child("Progress")
@onready var loading: AnimatedSprite2D = find_child("Loading")
@onready var next: Button = find_child("Next")

func _ready():
 SceneManager.load_percent_changed.connect(percent_changed)
 SceneManager.load_finished.connect(loading_finished)
 SceneManager.load_scene_interactive(SceneManager.get_recorded_scene())

func percent_changed(number: int) -> void:
 progress.value = number

func loading_finished() -> void:
 loading.visible = false
 next.visible = true

func _on_next_button_up():
 var fade_out_options = SceneManager.create_options(1.0, "scribbles", 0.2, true)
 var fade_in_options = SceneManager.create_options(1.0, "crooked_tiles", 0.2, true)
 var general_options = SceneManager.create_general_options(Color(0, 0, 0), 0, false, true)
 SceneManager.change_scene_to_loaded_scene(fade_out_options, fade_in_options, general_options)

More Complex Example With Loading Screen for Scenarios That Scenes Need Some Time in Background

First Part

Note: This example is for someone who needs to generate a world in the background and then show the scene to the user or someone who generally needs to load some data in the background and then show the new scene to the user/player.

extends Control

# Nodes
@onready var progress: ProgressBar = find_child("Progress")
@onready var loading: AnimatedSprite2D = find_child("Loading")
@onready var next: Button = find_child("Next")
@onready var label: Label = find_child("Label")

var gap = 30

func _ready():
 SceneManager.load_percent_changed.connect(percent_changed)
 SceneManager.load_finished.connect(loading_finished)
 SceneManager.load_scene_interactive(SceneManager.get_recorded_scene())

func percent_changed(number: int) -> void:
 # the last `gap%` is for the loaded scene itself to load its own data or initialize or world generate or ...
 progress.value = max(number - gap, 0)
 if progress.value >= 90:
  label.text = "World Generation . . ."

func loading_finished() -> void:
 # All loading processes are finished now
 if progress.value == 100:
  loading.visible = false
  next.visible = true
  label.text = ""
 # Loading finishes and world initialization or world generation or whatever you wanna call it will start
 elif progress.value == 70:
  SceneManager.add_loaded_scene_to_scene_tree()
  gap = 0
  label.text = "Scene Initialization . . ."

func _on_next_button_up():
 var fade_out_options = SceneManager.create_options(1.0, "scribbles", 0.2, true)
 var fade_in_options = SceneManager.create_options(1.0, "crooked_tiles", 0.2, true)
 var general_options = SceneManager.create_general_options(Color(0, 0, 0), 0, false, true)
 SceneManager.change_scene_to_existing_scene_in_scene_tree(fade_out_options, fade_in_options, general_options)

Second Part

Assume this part is in the new scene which needs some time in the background:

Note: This part emits the signal of load_percent_changed of SceneManager to inform the loading screen to change the percentage to inform user that something is happening. Note: After the loading process is finished, load_finished will be called to inform the loading screen which everything is ready to change to the new scene.

extends Control

var t = Timer.new()
var count = 0

func _ready():
 self.add_child(t)
 t.timeout.connect(_on_timeout)
 t.start(1)

func _on_timeout():
 count += 1
 if count == 1:
  SceneManager.load_percent_changed.emit(80 + randi_range(0, 9))
 elif count == 2:
  SceneManager.load_percent_changed.emit(90 + randi_range(0, 9))
 if count == 3:
  SceneManager.load_percent_changed.emit(100)
  SceneManager.load_finished.emit()
  t.timeout.disconnect(_on_timeout)
 t.start(count + 1)

SceneManager

Signals

  1. load_finished => signal fires when interactively loading a scene finishes
  2. load_percent_changed(value: int) => signal fires when interactively loading a scene progress percentage updates
  3. scene_changed => signal fires when scene changes
  4. fade_in_started => signal fires when fade in starts
  5. fade_out_started => signal fires when fade out starts
  6. fade_in_finished => signal fires when fade in finishes
  7. fade_out_finished => signal fires when fade out finishes

Methods

This is the node you use inside your game code and it has these functions:

  1. validate_scene(key: String) -> void:
    • Checks and validates passed key in scenes keys. (breaks game if key doesn't exist in scenes keys)
  2. validate_pattern(key: String) -> void:
    • Checks and validates passed key in patterns keys. (breaks game if key doesn't exist in patterns keys)
  3. safe_validate_scene(key: String) -> bool:
    • Safely validates the scene key and does not break the game.
  4. safe_validate_pattern(key: String) -> bool:
    • Safely validates the pattern key and does not break the game.
  5. change_scene(scene: String or PackedScene or Node, fade_out_options: Options, fade_in_options: Options, general_options: GeneralOptions) -> void:
    • Changes scene if scene is valid, otherwise nothing happens.
    • fade_out_options and fade_in_options are some configurations you can put in the function to customize your fade_in to the scene or fade_out of the current scene and you can create Options objects by calling create_options function.
    • general_options are common configurations that effect transition in both fade_in and fade_out transitions and you can create GeneralOptions by calling create_general_options functions.
    • Note: back as value of scene variable, causes going back to previous scene.
    • Note: null, ignore or an empty string as value of scene variable, causes nothing but just showing scene transition and does not change scenes at all.
    • Note: refresh, reload or restart as value of scene variable, causes refreshing the current scene.
    • Note: exit or quit as value of scene variable, causes exiting out of the game.
    • Note: Any String value as scene variable which starts with an _ will be ignored.
  6. no_effect_change_scene(scene: String or PackedScene or Node, hold_timeout: float = 0.0, add_to_back: bool = true) -> void:
    • Changes scene if scene is valid without effects, otherwise nothing happens.
    • hold_timeout is the timeout before changing to the scene.
    • add_to_back determines if we can go back to this scene or not.
    • Note: This method is for advanced users to actually apply their own effects and just change scenes with scene manager.
  7. create_options(fade_speed: float = 1, fade_pattern: String = "fade", smoothness: float = 0.1, inverted: bool = false) -> Options:
    • Creates Options object for change_scene function.
    • fade_speed = speed of fading out of the scene or fading into the scene in seconds.
    • fade_pattern = name of a shader pattern which is in addons/scene_manager/shader_patterns folder for fading out or fading into the scene. (if you use fade or an empty string, it causes a simple fade screen transition)
    • smoothness = defines roughness of pattern's edges. (this value is between 0-1 and more near to 1, softer edges and more near to 0, harder edges)
    • inverted = inverts the pattern.
  8. create_general_options(color: Color = Color(0, 0, 0), timeout: float = 0, clickable: bool = true, add_to_back: bool = true) -> GeneralOptions:
    • color = color for the whole transition.
    • timeout = between this scene and next scene, there would be a gap which can take much longer that usual(default is 0) by your choice by changing this option.
    • clickable = makes the scene behind the transition visuals clickable or not.
    • add_to_back = if true, you can go back to current scene after changing scene to next scene by going to "back" scene which means previous scene.
  9. show_first_scene(fade_in_options: Options, general_options: GeneralOptions) -> void:
    • Call this method inside _ready function of a node with a script which that node is inside the first scene that game jumps into it and this causes to have a smooth transition into the first game scene.
    • This function works just once at the beginning of the first game scene. After that, if you call this function again, nothing happens.
    • fade_in_options = creates it by calling create_options function.
    • general_options = creates it by calling create_general_options function.
  10. reset_scene_manager() -> void:
    • Sets current active scene as a starting point so that we can't go back to previous scenes with changing scene to back scene.
  11. create_scene_instance(key: String) -> Node:
    • Returns scene instance of passed scene key (blocking)
  12. set_back_limit(input: int) -> void:
    • Limits how much deep scene manager is allowed to record previous scenes which affects in changing scene to back(previous scene) functionality.
    • Allowed input values:
      1. input = -1 => unlimited (default)
      2. input = 0 => we can not go back to any previous scenes
      3. input > 0 => we can go back to input or less previous scenes
  13. get_scene(key: String) -> PackedScene:
    • Returns PackedScene of passed scene key (blocking)
  14. load_scene_interactive(key: String) -> void:
    • Loads scene interactive.
    • Note: Connect to load_percent_changed(value: int) and load_finished signals to listen to updates on your scene loading status.
  15. get_loaded_scene() -> PackedScene:
    • Returns loaded scene.
    • Note: If scene is not loaded, blocks and waits until scene is ready. (acts blocking in code and may freeze your game, make sure scene is ready to get)
  16. change_scene_to_loaded_scene(fade_out_options: Options, fade_in_options: Options, general_options: GeneralOptions) -> void:
    • Changes scene to interactively loaded scene.
    • Checkout function number 5 (change_scene) to understand what fade_out_options, fade_in_options and general_options are.
  17. get_previous_scene() -> String:
    • Returns previous scene. (the scene before current scene)
  18. get_previous_scene_at(index: int) -> String:
    • Returns a specific previous scene at an exact index position
  19. pop_previous_scene() -> String:
    • Returns previous scene and removes it from list of previous scenes.
  20. previous_scenes_length() -> int:
    • Returns how many scenes there are in list of previous scenes.
  21. set_recorded_scene(key: String) -> void:
    • Records a scene key to be used for loading scenes to know where to go after getting loaded into loading scene or just for next scene to know where to go next.
  22. get_recorded_scene() -> String:
    • Returns recorded scene by set_recorded_scene function.
  23. add_loaded_scene_to_scene_tree() -> void:
    • Imports loaded scene into the scene tree but doesn't change the current scene
    • Maily used when your new loaded scene has a loading phase when added to scene tree
    • So to use this, first has to call load_scene_interactive to load your scene and then have to listen on load_finished signal and after the signal emits, you call this function and this function adds the loaded scene to the scene tree but exactly behind the current scene so that you still can not see the new scene
  24. change_scene_to_existing_scene_in_scene_tree(fade_out_options: Options, fade_in_options: Options, general_options: GeneralOptions) -> void:
    • When you added the loaded scene to the scene tree by add_loaded_scene_to_scene_tree function, you call this function after you are sure that the added scene to scene tree is completely ready and functional to change the active scene
  25. pause(fade_out_options: Options, general_options: GeneralOptions) -> void:
    • Just executes the fade out animation.
    • Use it with resume function when you need to do something but do not want the player to see it.
  26. resume(fade_in_options: Options, general_options: GeneralOptions) -> void:
    • Just executes the fade in animation.
    • Use it with pause function when you need to do something but do not want the player to see it.

scene_manager's People

Contributors

jelmerberghs avatar maktoobgar avatar mashedd avatar nickhatboecker avatar palkiaa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

scene_manager's Issues

Warnings on load, invalid UIDs - using text paths instead

Hi, unsure what's the problem, but I have a bunch of warnings on load

image

Copy Pasta
Godot Engine v4.2.2.stable.official (c) 2007-present Juan Linietsky, Ariel Manzur & Godot Contributors.
--- Debug adapter server started ---
--- GDScript language server started on port 6005 ---
Add Autoload
  scene/resources/resource_format_text.cpp:448 - res://addons/scene_manager/menu.tscn:3 - ext_resource, invalid UID: uid://cnhtsuf78gsy7 - using text path instead: res://addons/scene_manager/icons/GuiChecked.svg
  scene/resources/resource_format_text.cpp:448 - res://addons/scene_manager/menu.tscn:5 - ext_resource, invalid UID: uid://bt1mtu3gbmwqc - using text path instead: res://addons/scene_manager/icons/FileDialog.svg
  scene/resources/resource_format_text.cpp:448 - res://addons/scene_manager/ignore_item.tscn:3 - ext_resource, invalid UID: uid://dw322nmqpqwfq - using text path instead: res://addons/scene_manager/icons/ImportFail.svg
  scene/resources/resource_format_text.cpp:448 - res://addons/scene_manager/scene_item.tscn:4 - ext_resource, invalid UID: uid://brxxaey30q7uk - using text path instead: res://addons/scene_manager/icons/GuiTabMenuHl.svg
  scene/resources/resource_format_text.cpp:448 - res://addons/scene_manager/scene_item.tscn:6 - ext_resource, invalid UID: uid://b4xi5nvjb3rhr - using text path instead: res://addons/scene_manager/icons/PlayOverlay.png
  scene/resources/resource_format_text.cpp:448 - res://addons/scene_manager/sub_section.tscn:4 - ext_resource, invalid UID: uid://dsgnkxtiko66g - using text path instead: res://addons/scene_manager/icons/GuiOptionArrowRight.png
  scene/resources/resource_format_text.cpp:448 - res://addons/scene_manager/sub_section.tscn:6 - ext_resource, invalid UID: uid://dw322nmqpqwfq - using text path instead: res://addons/scene_manager/icons/ImportFail.svg
  scene/resources/resource_format_text.cpp:448 - res://addons/scene_manager/scene_list.tscn:4 - ext_resource, invalid UID: uid://dw322nmqpqwfq - using text path instead: res://addons/scene_manager/icons/ImportFail.svg
  scene/resources/resource_format_text.cpp:448 - res://addons/scene_manager/scene_list.tscn:5 - ext_resource, invalid UID: uid://d250i5cu8lgbd - using text path instead: res://addons/scene_manager/icons/eye_open.png
Add Autoload
Add Autoload
Following a PhysicsBody2D node will likely result in jitter - on lower physics ticks in particular.
Once Godot 4.3 is released, will strongly recommend upgrading to that as it has built-in support for 2D Physics Interpolation.
Until then, try following the guide on the documentation site for better results.
This tip can be disabled from within Project Settings / Phantom Camera / Tips / Show Jitter Tips

Exported Transitions Not working.

So if you export the game with the default code the transitions will not work, as the files within the shader_patterns folder have all had a ".import" file type added.

Here's the code to work around this, but it does require the adding of a build feature called "standalone" to the export.
Line 30: scene_manager.gd

if not OS.has_feature("standalone"):
if file_folder.get_extension() == "png":
_patterns[file_folder.replace("."+file_folder.get_extension(), "")] = load(root_path + file_folder)
else:
if file_folder.get_extension() == "import":
_patterns[file_folder.replace("."+file_folder.get_extension(), "").replace(".png", "")] = load(root_path + file_folder.replace("."+file_folder.get_extension(), ""))

Not sure if this helps any, but I hope it does.

[Bug] Possible threadlock when using load_scene_interactive()

The load_scene_interactive() method of the SceneManager is hardcorded to use use_sub_threads = true when calling ResourceLoader.load_threaded_request(). In the newest versions of Godot there seems to be a bug that can cause a threadlock in the resource loader that will result in infinite loading of the scene without any error.

This is likely cause by use of the preload() function shortly prior to or at the same time as ResourceLoader.load_threaded_request() with use_sub_threads = true.

See the following two GitHub issues:
godotengine/godot#85255
godotengine/godot#84012

It would be cool to add a warning somewhere in the scene manager documentation about it until its fixed and maybe give the option to set use_sub_threads = false when calling load_scene_interactive().

Thank you very much, this plugin is awesome!

Deprecated parameter names in scene_manager.gdshader

scene_manager: master branch (3.4.1)
Godot: v4.0.rc6.official [0cd148313]
OS: Windows 10

After starting a simple demo app after pressing F5 I get a lot of warnings:

_set: This material (containing shader with path: 'res://addons/scene_manager/scene_manager.gdshader') uses an old deprecated parameter names. Consider re-saving this resource (or scene which contains it) in order for it to continue working in future versions.

Help with usage

Hey, there. Do you have a more detailed explanation of how to use this addon somewhere? Or a youtube video? I've installed it and assigned some of my scenes as Character, Menu, and created a new Category "Districts" for my maps. But I'm trying to assign a Subcategory. I've created one called Pois, but I can't add anything to it or use it at all.

Error "loaded scene is not defined" although scene is in ignore list

I added "res://addons" to Ignores list. But when I try to run a scene from there, scene manager crashes with:
"Scene Manager Error: loaded scene is not defined in scene manager tool, to fix this, on Scene Manager UI panel, just once click on refresh and then save buttons."

Obviously clicking refresh and save won't help, because the scenes are ignored.

I think ignored paths should be checked at this point:
https://github.com/maktoobgar/scene_manager/blob/main/addons/scene_manager/scene_manager.gd#L48

Crashing on Scene changes in build, but going into build and hitting Save fixes it?

So, I made a game jam game over the last week, and in the build when transitioning from a game level to another game level, or to a death screen, but it does not occur when transitioning from the main menu to the level scene, or vice versa, but when transitioning to the death scene. I went back in and hit save on the Scene Manager and it resolved this, even though no scene changes were made. Not sure what is going on, but I uploaded to github BEFORE hitting save, so theoretically if you download the source, and hit export, and export it to windows it SHOULD break when you die in game.

I know this is not exactly an issue, per say, it could be if I didn't resolve it, but I wanted to let you know so you could resolve it if you are able.

Repo:
https://github.com/Bonkahe/WildJam53-Pattern-Blue

Be advised; I built it with Godot 4 Beta 11-mono, entirely unsure if it will occur in other versions.

If you want to go ahead and hit resolved on this, and just use it as a source of info, that's perfect.
Thank you for the addon regardless, it's excellent and does exactly what I need it to do.

[Feature request] add a loading screen behavior configuration

Hi, first of all, thanks for this amazing addon, helps me a lot !

As you mentionned in your code examples, it's not that hard to add a loading screen, change_scene to your loading screen scene, then inside the loading screen, call change_scene again.

The issue with this is if the second scene is taking some time to load (like a procedurally generated world for instance), in which case you'll have the following:

  • Start scene
  • Transition to loading screen
  • Loading screen
  • Transition to black screen
  • Stays in black screen until scene is ready
  • Transition to target scene
  • Target scene is now current scene

I'm pretty new to Godot so I might be missing something obvious here but it looks like having the Loading screen add a given scene to the tree to then check when it's ready before triggering transition isn't possible, and that would be amazing as it'd allow for more detailed loading screen, showing data from the scene that's currently being set up.

Canvas Layer issue

Currently, the canvas in the SceneManager has a layer index of 1. If a game uses a any canvas with the same index or greater, the fade animations will play below the user interface.

If possible, it would be nice to be able to set the layer of the SceneManager.

Anyway, thanks for your work. This is the most complete scene manager I've ever used!

Custom file for saved data

Hi!

It would be useful to have a possibility to set the path for the res://addons/scene_manager/scenes.gd file.

The file has to be stored in the git, however with fixed path it requires the who addon to be stored.

I've faced with that issue on my own. I'm using gd-plug to manage dependencies, so my whole addons/ folder is added to .gitignore, meaning the file is not tracked.

There are a lot of tools which requieres data storage, so I have a dedicated folder for that.

A quick workaround is to manually modify path in the files plugin.gd and manager.gd

Loading scenes crashing in Godot 4.3

I'm attempting to utilize the loading or loading with initialization setups, and both are always falling into the "Scene Manager Error: for some reason, loading failed, I don't know why condition. The demo project has the same issue.

I tested the demo project in 4.2 and both loading setups work, so it seems like something in 4.3 has changed and is affecting the way loading is currently written.

consideration for stack size for newer versions after 2.0.1

hello, I have been using scene manager 2.0.1 for Godot 3.x game that will make it to android game market as a puzzle. I have read all the work that you have put into this, I must say I was amazed by this addon. (it is the best tool out there in godot plugin market)

one thing I realized is, the stack size keeps growing unless I reset the scene, in later versions of 2.0.1, have you considered adding a stack cleaning/pruning default limit? like 50-100 default and after that many transitions, the stack does remove on the [0] element like a buffer size.

VSCode crash on _ready() but fine if run from Godot

Great addon. Thank you for taking the time to develop it and make it available to all.

For some reason (my fault no doubt), I can use the addon without an issue within Godot, that is, I can run some test project and it works as expected. Specifically, this means that the first _ready() to be called is in the script of the main scene, e.g., Start.gd

However, when I run the same code from VSCode the first _ready() to be called is in this addon's script scene_manager.gd which leads to a crash. If the addon is removed, the test project runs as expected.

The crash (in case it matters) is in _get_scene_key_by_value(...) because the path returned by get_tree().current_scene.scene_file_path in _set_current_scene() is a full Windows path, e.g., C:\TestProject\Start.tscn instead of the type of paths the scenes dictionary contains, e.g., res://Start.tscn

Please let me know if you need more information.

Thanks again.

Fade out, do something, fade in

Hi there,

is the following possible?

  1. fade out
  2. do something game related. For example hide/show some Nodes...
  3. fade back in

So it's like change_scene() with null or ignore but split into two calls.

If not, would it be possible to implement?
Thanks in advance ๐Ÿ™

Change scene could free other nodes

Do i understand this line of code correctly:
Remove the last node in the root of the tree, being the instanced scene by the scene manager.

root.get_child(root.get_child_count() - 1).free()

If i add my own nodes to the end of the tree(for example some data node to persist between scene change), it could free my own node instead of the scene node.

I'm wondering why you dont simply call free on the 'current_scene'.

Im not sure if i'm understanding the code correctly, i'd love to learn why it was implemented this way.

Enhancement: C#

So right now I am currently creating a button and then using a Group call to execute a transition, I don't currently have any option to call the transition directly from C#.
I have no real idea how to implement this, but I would love to not have to work around it in this manner.
There is this of course: https://docs.godotengine.org/en/stable/tutorials/scripting/cross_language_scripting.html Perhaps a simple C# wrapper that takes C# method calls and converts them to GDscript?

Of note, I'm not sure how to make this just an enhancement, the only option I seem to have is to make issues, I apologize.

Callback methods?

Not really issue, but have no other way to ask questions.

Is there currently any way to initiate a callback after a transition has finished, or about to finish? Or a signal that is emitted after a transition has finished? There's a few scenarios I'm looking to trigger after a transition has finished and it would be useful if this was something built-in (if it's not already) rather than trying to work around it. Apologies in advance if this is already possible and I'm just overlooking it.

Endless loading and Godot not responding after fixing ignored scenes

After #23 was solved (thank you so much for this!), I downloaded the current main branch. I opened my project and got a lot of errors and the scene manager window was empty. I just closed it and reopened it again. Now the errors were gone and the window displayed my scenes.

But I get a loading cursor and MacOS reports the app as "not responding". So I cannot work on the project.
I restored the previous version of scene manager I used (3.8.0) and it immediately works again.

Unfortunately no error message is displayed, so I don't know what could cause the problem.

Add open scene shortcut button

Would be nice to have a shortcut button next to each of the scene buttons (or even something like ctrl + click) to open that scene in the editor, instead of going through the project to find it again to look at it.

show_first_scene(): Scene is briefly visible

My first scene configured is "StartMenu".
Inside of this scene I have a node "GameStart". This node has a Script "GameStart.gd" with the following contents:

extends Node


## This is no real script.
## It is only used to fade in first game scene.
func _ready() -> void:
    var fadeIn = SceneManager.create_options(10, "fade", 0.1, false)
    var options = SceneManager.create_general_options("black", 0.0, false, true)
    SceneManager.show_first_scene(fadeIn, options)

When I click on Play the StartMenu scene is visible for like half a seconds and then it smoothly fades in.
I this the desired behavior or am I doing something wrong? I thought the first scene should not be visible before fading in.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.