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:
parent
482dbecd13
commit
1d9b9fda1e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")),
|
||||
|
|
Loading…
Reference in a new issue