您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
34 行
1.1 KiB
34 行
1.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEditor.Graphing;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
[Serializable]
|
|
public class LayerWeightsOutputNode : AbstractMaterialNode, IOnAssetEnabled
|
|
{
|
|
public LayerWeightsOutputNode()
|
|
{
|
|
name = "LayerWeights";
|
|
}
|
|
|
|
public override bool allowedInRemapGraph { get { return false; } }
|
|
public override bool allowedInSubGraph { get { return false; } }
|
|
|
|
public void OnEnable()
|
|
{
|
|
var layeredGraph = owner as LayeredShaderGraph;
|
|
if (layeredGraph == null)
|
|
return;
|
|
|
|
var goodSlots = new List<int>();
|
|
foreach (var layer in layeredGraph.layers)
|
|
{
|
|
AddSlot(new Vector1MaterialSlot(layer.guid.GetHashCode(), LayeredShaderGraph.LayerToFunctionName(layer.guid), LayeredShaderGraph.LayerToFunctionName(layer.guid), SlotType.Input,0));
|
|
goodSlots.Add(layer.guid.GetHashCode());
|
|
}
|
|
|
|
RemoveSlotsNameNotMatching(goodSlots);
|
|
}
|
|
}
|
|
}
|