浏览代码

Enable process on focus only

DricomDragon 2 周之前
父节点
当前提交
1b2bbf3115
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      godot/addons/slide_show/projector/slide/Slide.gd

+ 11 - 0
godot/addons/slide_show/projector/slide/Slide.gd

@@ -7,6 +7,10 @@ signal finished
 
 @export var always_visible: bool = false
 
+@export_group("Processing management", "processing_")
+@export var processing_start_when_enabled := true ## Start processing when focused
+@export var processing_keep_when_disabled := false ## Enable to process at startup and keep processing after transitioning to another slide
+
 var action_finish := "ui_accept"
 var center_offset: Vector2
 
@@ -19,11 +23,18 @@ func _ready() -> void:
 func disable() -> void:
 	set_process_unhandled_key_input(false)
 
+	if processing_keep_when_disabled:
+		return
+	set_process(false)
+
 
 func enable() -> void:
 	set_visible(true)
 	set_process_unhandled_key_input(true)
 
+	if processing_start_when_enabled:
+		set_process(true)
+
 
 func get_center() -> Vector2:
 	return get_position() + center_offset