rj-action-library/Runtime/Rendering/TextureAttributes/SetTextureAttributeChannel.cs

43 lines
817 B
C#
Raw Normal View History

2025-10-24 11:38:51 +00:00
using Godot;
using Rokojori;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class SetTextureAttributeChannel:Action
{
[Export]
public TextureAttributes textureAttributes;
[Export]
public int index = 0;
[Export]
public float value = 1;
[Export]
public TextureAttributes.Channel channel = TextureAttributes.Channel.Red;
protected override void _OnTrigger()
{
var ta = textureAttributes;
if ( ta == null )
{
ta = Unique<TextureAttributes>.Get();
}
if ( ta == null )
{
this.LogInfo( "No attributes found..." );
return;
}
this.LogInfo( "Index", index, "Value:", value, "Channel:", channel );
ta.SetChannel( index, value, channel );
}
}
}