浏览代码

Better initialization in gradient node

/main
Peter Bay Bastian 7 年前
当前提交
2e843191
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 10
      MaterialGraphProject/Assets/NewNodes/Editor/Keep/GradientNode.cs

10
MaterialGraphProject/Assets/NewNodes/Editor/Keep/GradientNode.cs


[Title("Input/Gradient")]
public class GradientNode : AbstractMaterialNode, IGeneratesBodyCode
{
Gradient m_Gradient;
Gradient m_Gradient = new Gradient();
[SerializeField]
Vector4[] m_SerializableColorKeys = { new Vector4(1f, 1f, 1f, 0f), new Vector4(0f, 0f, 0f, 1f), };

AddSlot(new Vector1MaterialSlot(BOutputSlotId, k_BOutputSlotName, k_BOutputSlotName, SlotType.Output, 0));
AddSlot(new Vector1MaterialSlot(AOutputSlotId, k_AOutputSlotName, k_AOutputSlotName, SlotType.Output, 0));
RemoveSlotsNameNotMatching(new[] { TimeInputSlotId, RGBAOutputSlotId, ROutputSlotId, GOutputSlotId, BOutputSlotId, AOutputSlotId });
}
public override void OnAfterDeserialize()
{
base.OnAfterDeserialize();
m_SerializableAlphaKeys = null;
m_SerializableColorKeys = null;
m_Gradient.SetKeys(colorKeys, alphaKeys);
}

正在加载...
取消
保存