Compare commits

...

2 commits

Author SHA1 Message Date
fdab9ca0a3
Add remove_all_slides() method 2024-05-14 00:43:21 +02:00
0dada10659
Fix reference 2024-05-14 00:42:18 +02:00
2 changed files with 11 additions and 1 deletions

View file

@ -20,6 +20,7 @@ class_name PresencodeCommunication
# CORE
var core: Core
@onready var logger: CoreLoggerInstance = core.logger.get_instance("src/classes/communication.gd")
@onready var sms: CoreBaseModule = core.sms
# Presencode infrastructure
var presenloader: Node
@ -29,10 +30,12 @@ var presenloader: Node
@onready var manifest: Dictionary = presenloader.manifest
var current_slide: int = -1
# +++ initialization +++
func _init(core_new: Core, presenloader_new: Node) -> void:
core = core_new
presenloader = presenloader_new
# +++ slide management +++
func switch_slide(new_slide: int) -> PresencodeTypes.PresencodeError:
var old_slide: int = current_slide
@ -61,5 +64,12 @@ func switch_slide(new_slide: int) -> PresencodeTypes.PresencodeError:
return PresencodeTypes.PresencodeError.OK
func remove_all_slides() -> void:
logger.verb("Removing all slides")
for scene in sms.get_scene_collection_list(CoreTypes.SceneType.MAIN):
sms.remove_scene(scene.name)
# +++ etc +++
func get_source_path(path: String) -> String:
return "<presentation root>/" + path

View file

@ -241,7 +241,7 @@ func inject_entrypoint() -> void:
# Update variables
entrypoint_node.core = core
entrypoint_node.logger = core.logger.get_instance(communication.get_source_path("src/" + manifest["entrypoint"]), entrypoint_node)
entrypoint_node.communication = communication
entrypoint_node.api = communication
# Add to SceneTree
get_tree().root.add_child(entrypoint_node)