2 Commit-ok 01d36fe0fb ... 4f4749b9e0

Szerző SHA1 Üzenet Dátum
  DricomDragon 4f4749b9e0 :wrench: Configure slides exporter 2 hónapja
  DricomDragon 8c28b4eadd Dump GodotSlideShowPlugin to v1.1.0 2 hónapja
2 módosított fájl, 33 hozzáadás és 5 törlés
  1. 28 5
      godot/addons/slide_show/projector/show/Show.gd
  2. 5 0
      godot/project.godot

+ 28 - 5
godot/addons/slide_show/projector/show/Show.gd

@@ -3,6 +3,8 @@ extends Node2D
 # Manage slide cycling
 
 
+signal end_reached
+
 const VOID_SLIDE_ID := -1
 
 @export_group("Slide management")
@@ -15,11 +17,17 @@ const VOID_SLIDE_ID := -1
 @export var action_previous_slide := "ui_left"
 @export var action_home_slide := "ui_cancel"
 
+@export_group("Export")
+@export var one_slide_per_frame := true
+@export var quit_after_last_slide := true
+
 var current_id := VOID_SLIDE_ID
 var current_slide: Slide
 
 @onready var focus: Focus = $"../Focus"
 @onready var slides: Array = get_children()
+@onready var movie_enabled: bool = OS.has_feature("movie")
+@onready var auto_next_slide: bool = movie_enabled and one_slide_per_frame
 
 
 func _ready() -> void:
@@ -31,9 +39,18 @@ func _ready() -> void:
 
 	_global_slide_setup()
 
+	if auto_next_slide:
+		end_reached.connect(get_tree().quit)
+		return
+
 	go_slowly_to_next_slide()
 
 
+func _process(_delta: float) -> void:
+	if auto_next_slide:
+		go_fast_to_next_slide()
+
+
 func go_slowly_to_next_slide() -> void:
 	next_slide(Focus.Transit.SMOOTH)
 
@@ -52,11 +69,20 @@ func next_slide(trans: Focus.Transit) -> void:
 
 func next_slide_at(next_id: int, trans: Focus.Transit) -> void:
 	_disable_current_slide()
+
 	current_id = next_id
 	current_slide = _focus_slide(current_id, trans)
+
+	if is_last_slide():
+		end_reached.emit()
+
 	_enable_current_slide()
 
 
+func is_last_slide() -> bool:
+	return current_id == slides.size() - 1
+
+
 func _focus_slide(id: int, trans: Focus.Transit) -> Slide:
 	var slide: Slide = slides[id]
 	focus.focus_on(slide.get_center(), slide.get_scale().x, trans)
@@ -106,13 +132,10 @@ func _enforce_children() -> void:
 func _next_id() -> int:
 	if current_id == VOID_SLIDE_ID:
 		return start_slide
-
-	var next_id: int = current_id + 1
-
-	if next_id >= slides.size():
+	elif is_last_slide():
 		return 0
 
-	return next_id
+	return current_id + 1
 
 
 func _previous_id() -> int:

+ 5 - 0
godot/project.godot

@@ -23,6 +23,11 @@ window/size/mode=3
 window/size/initial_position_type=2
 window/stretch/mode="canvas_items"
 
+[editor]
+
+movie_writer/movie_file="../dist/export/slide.png"
+movie_writer/fps=25
+
 [editor_plugins]
 
 enabled=PackedStringArray("res://addons/slide_show/plugin.cfg")