rj-action-library/Runtime/UI/ShaderProperties/ShaderUINumber.cs

38 lines
751 B
C#
Raw Normal View History

2024-09-14 06:41:52 +00:00
using Godot;
using Rokojori;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class ShaderUINumber : Resource
{
[Export]
public FloatPropertyName floatPropertyName;
[Export]
public UINumber number;
2025-06-19 17:22:25 +00:00
// [Export]
// public TransitionSettings transitionSettings;
2024-09-14 06:41:52 +00:00
public void UpdateMaterial( UIStylePropertyContainer container, Material material )
{
2025-06-19 17:22:25 +00:00
if ( floatPropertyName == null || number == null )
2024-09-14 06:41:52 +00:00
{
return;
}
2025-06-19 17:22:25 +00:00
var numberValue = UINumber.Compute( container as Control, number, 0f );
floatPropertyName.Set( material, numberValue );
2024-09-14 06:41:52 +00:00
}
2025-06-19 17:22:25 +00:00
public override string ToString()
{
return RJLog.GetInfo( floatPropertyName, number );
}
2024-09-14 06:41:52 +00:00
}
}