From 6c7e64484108648b7a778746c3fe2acbb4097d8a Mon Sep 17 00:00:00 2001 From: Lou Bernardi Date: Tue, 30 Apr 2024 09:11:26 -0400 Subject: [PATCH 1/2] Make the update shaders function public (and adjust calls to follow change) and fixed chromatic abberation being by default visible --- .../post_processing/node/children/ChromaticAberration.tscn | 1 + addons/post_processing/node/post_process.gd | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/post_processing/node/children/ChromaticAberration.tscn b/addons/post_processing/node/children/ChromaticAberration.tscn index 8d66993..0491e51 100644 --- a/addons/post_processing/node/children/ChromaticAberration.tscn +++ b/addons/post_processing/node/children/ChromaticAberration.tscn @@ -7,6 +7,7 @@ shader = ExtResource("1_qxjen") shader_parameter/offset = 5.23 [node name="ChromaticAberration" type="CanvasLayer"] +visible = false layer = 102 [node name="data" type="ColorRect" parent="."] diff --git a/addons/post_processing/node/post_process.gd b/addons/post_processing/node/post_process.gd index 9972263..3512c46 100644 --- a/addons/post_processing/node/post_process.gd +++ b/addons/post_processing/node/post_process.gd @@ -4,7 +4,7 @@ extends CanvasLayer @export_category("Post Process") @export var configuration : PostProcessingConfiguration -func _update_shaders() -> void: +func update_shaders() -> void: if not configuration: return for child in get_children(): @@ -139,7 +139,7 @@ func _enter_tree(): _add_canvas_layer_children("res://addons/post_processing/node/children/ascii.tscn", "ASCII") _add_canvas_layer_children("res://addons/post_processing/node/children/CRT.tscn", "CRT") - _update_shaders() + update_shaders() func _add_canvas_layer_children(_path : String, _name: String) -> void: var child_instance = load(_path).instantiate() @@ -153,5 +153,5 @@ func _process(delta): return if Engine.is_editor_hint() or !Engine.is_editor_hint(): if configuration.reload == true: - _update_shaders() + update_shaders() configuration.reload = false From f9b384e82c072cd22412a49cd96796fb09ab6e4a Mon Sep 17 00:00:00 2001 From: Lou Bernardi Date: Tue, 30 Apr 2024 09:50:16 -0400 Subject: [PATCH 2/2] Add code to incorporate disabling dynamic changes (by default ON) --- addons/post_processing/node/post_process.gd | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/post_processing/node/post_process.gd b/addons/post_processing/node/post_process.gd index 3512c46..3d31863 100644 --- a/addons/post_processing/node/post_process.gd +++ b/addons/post_processing/node/post_process.gd @@ -3,6 +3,7 @@ extends CanvasLayer @export_category("Post Process") @export var configuration : PostProcessingConfiguration +@export var dynamically_update : bool = true func update_shaders() -> void: if not configuration: @@ -151,7 +152,10 @@ func _add_canvas_layer_children(_path : String, _name: String) -> void: func _process(delta): if not configuration: return - if Engine.is_editor_hint() or !Engine.is_editor_hint(): - if configuration.reload == true: - update_shaders() - configuration.reload = false + if Engine.is_editor_hint(): + return + if not dynamically_update: + return + if configuration.reload: + update_shaders() + configuration.reload = false