diff --git a/src/Classes/ShaderLoader.gd b/src/Classes/ShaderLoader.gd index 495bc5c46..a154ccfe8 100644 --- a/src/Classes/ShaderLoader.gd +++ b/src/Classes/ShaderLoader.gd @@ -252,6 +252,17 @@ static func create_ui_for_shader_uniforms( func(_gradient, _cc): value_changed.call(gradient_edit.texture, u_name) ) hbox.add_child(gradient_edit) + elif u_name.begins_with("curve_"): + var curve_edit := CurveEdit.new() + curve_edit.size_flags_horizontal = Control.SIZE_EXPAND_FILL + if params.has(u_name) and params[u_name] is CurveTexture: + curve_edit.curve = params[u_name].curve + else: + curve_edit.set_default_curve() + curve_edit.value_changed.connect( + func(curve: Curve): value_changed.call(CurveEdit.to_texture(curve), u_name) + ) + hbox.add_child(curve_edit) else: ## Simple texture var file_dialog := FileDialog.new() file_dialog.file_mode = FileDialog.FILE_MODE_OPEN_FILE diff --git a/src/UI/Nodes/CurveEditor/CurveEdit.gd b/src/UI/Nodes/CurveEditor/CurveEdit.gd index e7c4ef154..d3163dd40 100644 --- a/src/UI/Nodes/CurveEditor/CurveEdit.gd +++ b/src/UI/Nodes/CurveEditor/CurveEdit.gd @@ -154,6 +154,12 @@ static func to_texture(from_curve: Curve, width := 256) -> CurveTexture: return texture +func set_default_curve() -> void: + if not is_instance_valid(curve): + curve = Curve.new() + _on_presets_item_selected(0) + + func available_size() -> Vector2: if curve_editor.size.is_zero_approx(): return Vector2.ONE diff --git a/src/UI/Timeline/LayerEffects/LayerEffectsSettings.gd b/src/UI/Timeline/LayerEffects/LayerEffectsSettings.gd index 7aac6ca81..8e86da5d6 100644 --- a/src/UI/Timeline/LayerEffects/LayerEffectsSettings.gd +++ b/src/UI/Timeline/LayerEffects/LayerEffectsSettings.gd @@ -20,6 +20,7 @@ var effects: Array[LayerEffect] = [ "Adjust Brightness/Contrast", preload("res://src/Shaders/Effects/BrightnessContrast.gdshader") ), + LayerEffect.new("Color Curves", preload("res://src/Shaders/Effects/ColorCurves.gdshader")), LayerEffect.new("Palettize", preload("res://src/Shaders/Effects/Palettize.gdshader")), LayerEffect.new("Pixelize", preload("res://src/Shaders/Effects/Pixelize.gdshader")), LayerEffect.new("Posterize", preload("res://src/Shaders/Effects/Posterize.gdshader")),