rokojori_action_library/Runtime/UI/ShaderProperties/ShaderUINumber.cs

39 lines
778 B
C#
Raw Normal View History

2024-09-14 06:41:52 +00:00
using Godot;
using Rokojori;
2026-05-22 12:25:02 +00:00
using Rokojori.Extensions;
2024-09-14 06:41:52 +00:00
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
}
}