1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Add color curves layer effect

This commit is contained in:
Emmanouil Papadeas 2024-12-15 21:04:32 +02:00
parent 482dbecd13
commit 1d9b9fda1e
3 changed files with 18 additions and 0 deletions

View file

@ -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

View file

@ -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

View file

@ -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")),