浏览代码

Fix compilation error in ExportTextureMasterNode

/main
Florent Guinier 7 年前
当前提交
17d6c4b6
共有 2 个文件被更改,包括 27 次插入16 次删除
  1. 16
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/ExportTexture.template
  2. 27
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/ExportTextureMasterNode.cs

16
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Templates/ExportTexture.template


SubShader
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Tags { "Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="Opaque" }
Blend SrcAlpha OneMinusSrcAlpha
Blend One Zero
Pass
{

#include "UnityCG.cginc"
${ShaderPropertyUsages}
float2 uv : TEXCOORD0;
${ShaderInputs}
sampler2D ${ShaderTextureName};
float4 ${ShaderTextureName}_ST;
${ShaderFunctions}
o.uv = TRANSFORM_TEX(v.texcoord, ${ShaderTextureName});
${VertexShaderBody}
half4 col = tex2D(${ShaderTextureName}, IN.uv);
return col;
${PixelShaderBody}
}
ENDCG
}

27
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SurfaceModel/ExportTextureMasterNode.cs


public override string GetFullShader(GenerationMode mode, out List<PropertyGenerator.TextureInfo> configuredTextures)
{
/*
string templateLocation = ShaderGenerator.GetTemplatePath("2DPreview.template");
string templateLocation = ShaderGenerator.GetTemplatePath("ExportTexture.template");
if (!File.Exists(templateLocation))
{
configuredTextures = new List<PropertyGenerator.TextureInfo>();

//shaderBodyVisitor.AddShaderChunk("return " + ShaderGenerator.AdaptNodeOutputForPreview(this, GetOutputSlots<MaterialSlot>().First().id) + ";", true);
//shaderBodyVisitor.AddShaderChunk("return " + AdaptNodeInputForPreview(this, ColorSlotId) + ";", true);
shaderBodyVisitor.AddShaderChunk("return " + GetVariableNameForSlot(GetSlotReference(ColorSlotId).slotId) + ";", true);
//shaderBodyVisitor.AddShaderChunk("return " + GetVariableNameForSlot(GetSlotReference(ColorSlotId).slotId) + ";", true);
var inputSlot = GetInputSlots<MaterialSlot>().First();
var edges = owner.GetEdges(inputSlot.slotReference);
if (edges.Count() > 0)
{
var outputRef = edges.First().outputSlot;
var fromNode = owner.GetNodeFromGuid<AbstractMaterialNode>(outputRef.nodeGuid);
shaderBodyVisitor.AddShaderChunk("return " + fromNode.GetVariableNameForSlot(outputRef.slotId) + ";", true);
}
else
{
shaderBodyVisitor.AddShaderChunk("return float4(1.0, 1.0, 1.0, 1.0);", true);
}
ListPool<INode>.Release(activeNodeList);
template = template.Replace("${ShaderName}", shaderName);

configuredTextures = shaderPropertiesVisitor.GetConfiguredTexutres();
return Regex.Replace(template, @"\r\n|\n\r|\n|\r", Environment.NewLine);
*/
/*
string templateLocation = ShaderGenerator.GetTemplatePath("ExportTexture.template");
if (!File.Exists(templateLocation))

ListPool<INode>.Release(activeNodeList);
return Regex.Replace(template, @"\r\n|\n\r|\n|\r", Environment.NewLine);
*/
}
}
}
正在加载...
取消
保存