浏览代码

A Custom Node can now have no inputs or outputs

/main
bfogerty 8 年前
当前提交
a1811244
共有 1 个文件被更改,包括 16 次插入13 次删除
  1. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Logic/CustomCodeNode.cs

29
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Logic/CustomCodeNode.cs


protected override string GetFunctionName()
{
string guid = System.Guid.NewGuid().ToString();
guid = guid.Replace("-", "_");
return "unity_CustomCode_" + GetFunctionName(GetFunctionSignature()); // + "_" + guid;
return "unity_CustomCode_" + GetFunctionName(GetFunctionSignature());
}
public void GenerateNodeFunction(ShaderGenerator visitor, GenerationMode generationMode)

void UpdateInputSlots(List<FunctionArgument> inputArguments)
{
if (inputArguments == null || inputArguments.Count <= 0)
{
return;
}
int slotIndex = 0;
if (inputSlotIds.Count > 0)
{

foreach (ISlot inSlot in GetSlots<ISlot>())
{
slotIds.Add(inSlot.id);
}
if (inputArguments == null || inputArguments.Count <= 0)
{
return;
}
// TODO: This is a bit of a hack. We need to find a better way

void UpdateOutputSlots(List<FunctionArgument> outputArguments)
{
if (outputArguments == null || outputArguments.Count <= 0)
{
return;
}
int slotIndex = 0;
if (outputSlotIds.Count > 0)
{

}
outputSlotIds.Clear();
}
if (outputArguments == null || outputArguments.Count <= 0)
{
return;
}
for (slotIndex = 0; slotIndex < outputArguments.Count; ++slotIndex)

{
string trimmedArg = arg.Trim();
string[] components = trimmedArg.Split(new char[] {' '});
if (components == null || components.Length < 2)
{
continue;
}
if (string.Equals(components[0].ToLower(), "out"))
{
break;

正在加载...
取消
保存