Compare commits

...

6 commits

7 changed files with 71 additions and 37 deletions

@ -1 +1 @@
Subproject commit c885f654f4f555b98177f9949ffef9876ad86fb4
Subproject commit a03db0f4e1ba0f4171f9425e56a4731f9090ad16

View file

@ -42,38 +42,20 @@ import/blender/enabled=false
fullscreen={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":70,"unicode":102,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":70,"physical_keycode":70,"key_label":70,"unicode":102,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194342,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":4194342,"unicode":0,"echo":false,"script":null)
]
}
slide_backwards={
navigate_backwards={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":4194319,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":4194319,"unicode":0,"echo":false,"script":null)
]
}
slide_forwards={
navigate_forwards={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":4194321,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
content_scale_switch={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":71,"unicode":103,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":true,"meta_pressed":false,"pressed":false,"keycode":71,"physical_keycode":0,"key_label":0,"unicode":103,"echo":false,"script":null)
]
}
console={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":4194334,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194334,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
editor_switchres={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":4194335,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194335,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":0,"key_label":4194321,"unicode":0,"echo":false,"script":null)
]
}

View file

@ -28,7 +28,8 @@ var presenloader: Node
# Presentation data
var entrypoint: PresencodeEntrypoint
var manifest: Dictionary
var current_slide: int = -1
var current_slide: int = 0
var slide_switch_in_progress: bool = false
# +++ initialization +++
func _init(core_new: Core, presenloader_new: Node) -> void:
@ -37,19 +38,39 @@ func _init(core_new: Core, presenloader_new: Node) -> void:
sms = core.sms
presenloader = presenloader_new
func _process(_delta: float) -> void:
# Check for inputs
if Input.is_action_just_pressed("fullscreen"):
logger.diag("Toggling fullscreen mode")
match(DisplayServer.window_get_mode()):
DisplayServer.WindowMode.WINDOW_MODE_WINDOWED: DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_FULLSCREEN)
_: DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_WINDOWED)
if Input.is_action_just_pressed("navigate_forwards"):
switch_slide(current_slide + 1)
if Input.is_action_just_pressed("navigate_backwards"):
switch_slide(current_slide - 1)
func _update_variables() -> void:
logger.diag("Updating variables")
entrypoint = presenloader.entrypoint_node
manifest = presenloader.manifest
# +++ slide management +++
func switch_slide(new_slide: int) -> PresencodeTypes.PresencodeError:
if slide_switch_in_progress: return PresencodeTypes.PresencodeError.ALREADY_RUNNING
slide_switch_in_progress = true
var old_slide: int = current_slide
if new_slide < 0:
logger.error(core.misc.stringify_variables("Invalid slide %slide%", { "slide": new_slide }))
slide_switch_in_progress = false
return PresencodeTypes.PresencodeError.INVALID_SLIDE
if new_slide > manifest["slides"]:
logger.error(core.misc.stringify_variables("Invalid slide %slide%", { "slide": new_slide }))
slide_switch_in_progress = false
return PresencodeTypes.PresencodeError.INVALID_SLIDE
logger.info(core.misc.stringify_variables("Switching from slide %old% to %new%", { "old": old_slide, "new": new_slide }))
@ -61,13 +82,16 @@ func switch_slide(new_slide: int) -> PresencodeTypes.PresencodeError:
# Call switch_slide()
logger.verb("Switching slide")
await entrypoint.switch_slide(new_slide)
await entrypoint.switch_to_slide(new_slide)
# Play AFTER animation
if manifest["animations"]:
logger.verb("Starting AFTER animation")
await entrypoint.play_animation(PresencodeTypes.AnimationStage.AFTER, old_slide, new_slide)
current_slide = new_slide
slide_switch_in_progress = false
return PresencodeTypes.PresencodeError.OK
func remove_all_slides() -> void:

View file

@ -19,7 +19,8 @@ class_name PresencodeTypes
enum PresencodeError {
OK,
INVALID_SLIDE
INVALID_SLIDE,
ALREADY_RUNNING,
}
enum AnimationStage { BEFORE, AFTER }
@ -27,4 +28,5 @@ func presencodeerror_string(error: PresencodeError) -> String:
match(error):
PresencodeError.OK: return "OK"
PresencodeError.INVALID_SLIDE: return "Invalid Slide"
PresencodeError.ALREADY_RUNNING: return "Already running"
_: return "<invalid enum value>"

View file

@ -24,11 +24,10 @@ var logger: CoreLoggerInstance
# Preinitialization
func _init() -> void:
# Update configuration
core_config.hide_window_on_shutdown = false
#core_config.hide_window_on_shutdown = true
#core_config.automatic_shutdown = false
if OS.is_debug_build(): core_config.logger_level = CoreTypes.LoggerLevel.DIAG
else: core_config.logger_level = CoreTypes.LoggerLevel.INFO
core_config.logui_enabled = false
# Preinitialize CORE Framework
core = await Core.new(core_config)
@ -66,6 +65,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.""")
# Apply command line arguments
logger.verb("Reloading CORE Configuration (applying cmdline args)")
core_config.logger_level = args["logger_level"]
core_config.logui_enabled = args["display_logui"]
core.reload_configuration(core_config)
# Initialize internals
@ -110,8 +110,8 @@ func cleanup() -> void:
# Parses all arguments
func parse_cmdline() -> Dictionary:
logger.verb("Parsing command line arguments")
var args: Dictionary = { "shutdown": false, "load_presentation": false, "presentation_path": "", "logger_level": core_config.logger_level }
var processed: Dictionary = { "presentation": false, "logger_level": false }
var args: Dictionary = { "shutdown": false, "load_presentation": false, "presentation_path": "", "logger_level": core_config.logger_level, "display_logui": core_config.logui_enabled }
var processed: Dictionary = { "presentation": false, "logger_level": false, "display_logui": false }
for arg in OS.get_cmdline_user_args():
logger.diag(core.misc.stringify_variables("Parsing cmdline argument %arg%", { "arg": arg }))
@ -132,6 +132,7 @@ Usage (development setup): /path/to/godot.binary -d -v --path . ++ <further argu
Further arguments:
--logger-level=<DIAG|VERB|INFO|WARN|ERROR> Sets the logger level, defaults to DIAG in debug
                                              builds and INFO in release builds.
--display-logui Displays CORE's Log UI. May break stuff!
/path/to/presentation.pcar Path to the presentation Presencode should open.
                                              If not supplied, a user interface will appear.
+++ PRESENCODE HELP +++""")
@ -159,6 +160,15 @@ Further arguments:
"WARN": args["logger_level"] = CoreTypes.LoggerLevel.WARN
"ERROR": args["logger_level"] = CoreTypes.LoggerLevel.ERROR
_: logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Can't match logger level %got%, possible are: %expected%", { "arg": arg, "got": arg.replace("--logger-level=", ""), "expected": [ "DIAG", "VERB", "INFO", "WARN", "ERROR" ] }))
elif arg.contains("--display-logui"):
# Ensure this argument is not overridden
if processed["display_logui"]:
logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Already set", { "arg": arg }))
continue
processed["display_logui"] = true
# Update 'args'
args["display_logui"] = true
else:
if arg.begins_with("--"): logger.error(core.misc.stringify_variables("Unable to parse argument %arg%: Option not recognized", { "arg": arg }))
else:

View file

@ -37,6 +37,9 @@ var diraccess: DirAccess = null
func _ready() -> void:
# Register cleanup hook
core.register_cleanup_hook(func() -> void: queue_free())
# Add 'communication' as a child
add_child(communication)
func load_presentation(load_path: String) -> String:
logger.info(core.misc.stringify_variables("Loading presentation located at %path%", { "path": load_path }))
@ -90,6 +93,9 @@ func load_presentation(load_path: String) -> String:
# Inject entrypoint
inject_entrypoint()
# Update 'communication''s variables
communication._update_variables()
return ""
func check_required_files() -> String:
@ -233,10 +239,10 @@ func inject_entrypoint() -> void:
entrypoint_node.api = communication
# Add to SceneTree
get_tree().root.add_child(entrypoint_node)
get_tree().root.add_child.call_deferred(entrypoint_node)
# Execute initialize()
await entrypoint_node.initialize()
entrypoint_node.initialize.call_deferred()
# +++ etc +++
func write_temporary_file(bytes: PackedByteArray) -> void:

View file

@ -105,6 +105,16 @@ func load_high_quality_wallpaper() -> void:
)
thread_wallpaper.wait_to_finish()
# +++ processing +++
func _process(_delta: float) -> void:
# Check for inputs
if Input.is_action_just_pressed("fullscreen"):
logger.diag("Toggling fullscreen mode")
match(DisplayServer.window_get_mode()):
DisplayServer.WindowMode.WINDOW_MODE_WINDOWED: DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_FULLSCREEN)
_: DisplayServer.window_set_mode(DisplayServer.WindowMode.WINDOW_MODE_WINDOWED)
# +++ unload & cleanup +++
func unload() -> void:
logger.info("Unloading user interface")