winter-tales/Utilities/PostProcessingHack.cs

56 lines
1.0 KiB
C#
Raw Normal View History

2025-11-28 14:27:39 +00:00
using Godot;
using Rokojori;
using System.Collections.Generic;
using System.Threading.Tasks;
[Tool, GlobalClass]
public partial class PostProcessingHack : Action
{
[Export]
public WorldEnvironment environment;
protected override void _OnTrigger()
{
2025-12-21 18:58:19 +00:00
ApplyHack();
}
2025-11-28 14:27:39 +00:00
2025-12-21 18:58:19 +00:00
void ApplyHack()
{
2025-11-28 14:27:39 +00:00
var godotArray = new Godot.Collections.Array<CompositorEffect>();
2025-12-21 18:58:19 +00:00
var compositorEffects = environment.Compositor.CompositorEffects;
2025-11-28 14:27:39 +00:00
2025-12-21 18:58:19 +00:00
for ( int i = 0; i < compositorEffects.Count; i++ )
2025-11-28 14:27:39 +00:00
{
godotArray.Add( (CompositorEffect) compositorEffects[ i ].Duplicate() );
}
environment.Compositor.CompositorEffects = godotArray;
}
2025-12-21 18:58:19 +00:00
#if TOOLS
int retriggerFramesCount = 60 * 5;
int framesCounter = 0;
public override void _Process( double delta )
{
if ( ! Engine.IsEditorHint() )
{
return;
}
framesCounter --;
if ( framesCounter > 0 )
{
return;
}
framesCounter = retriggerFramesCount;
// RJLog.Log( "Applying Post Processing Hack" );
ApplyHack();
}
#endif
2025-11-28 14:27:39 +00:00
}