rokojori_action_library/Runtime/Cameras/Adjustments/AdjustmentsDesigner.cs

51 lines
830 B
C#

using Rokojori;
using Godot;
namespace Rokojori;
[GlobalClass,Tool]
public partial class AdjustmentsDesigner: Node
{
[Export]
public AdjustmentsStack stack = new AdjustmentsStack();
[Export]
public bool autoUpdate = false;
[Export]
public WorldEnvironment environment;
[ExportToolButton( "Update Adjustments" )]
public Callable updateAdjustmentsButton => Callable.From(
()=>
{
ProcessStack();
}
);
public override void _Process( double delta )
{
if ( ! Engine.IsEditorHint() )
{
return;
}
if ( ! autoUpdate )
{
return;
}
ProcessStack();
}
void ProcessStack()
{
stack.GenerateAdjustmentsTexture();
if ( environment != null )
{
environment.Environment.AdjustmentColorCorrection = stack.adjustmentsTexture;
}
}
}