rokojori_action_library/Runtime/Shading/Materials/MaterialTransfer.cs

36 lines
728 B
C#
Raw Normal View History

2025-01-03 12:09:23 +00:00
using Godot;
using System.Reflection;
using System.Collections.Generic;
2026-05-22 12:25:02 +00:00
using Rokojori.Extensions;
2025-01-03 12:09:23 +00:00
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class MaterialTransfer:Resource
{
[Export]
public SubMaterialTransfer[] transfers = new SubMaterialTransfer[ 0 ];
2025-01-03 12:09:23 +00:00
public void Transfer( Material source, Material target )
{
2026-05-22 12:25:02 +00:00
ListExtensions.From( transfers ).ForEach(
2025-01-03 12:09:23 +00:00
( t )=>
{
if ( ! t.MatchesMaterial( source ) )
{
RJLog.Log( t.info, "not matching:", source );
return;
}
RJLog.Log( t.info, "from", source, "to", target );
t.Transfer( source, target );
}
);
}
}
}