浏览代码

Fix float serialization in Constant Node to not be affected by system locale (was comma as decimal separator causing shader errors)

/main
Peter Bay Bastian 7 年前
当前提交
a2bafb38
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 3
      com.unity.shadergraph/Editor/Data/Nodes/Input/Basic/ConstantNode.cs
  2. 11
      com.unity.shadergraph/Editor/Drawing/PreviewManager.cs

3
com.unity.shadergraph/Editor/Data/Nodes/Input/Basic/ConstantNode.cs


using System.Collections.Generic;
using System.Globalization;
using UnityEditor.ShaderGraph.Drawing.Controls;
using UnityEngine;
using UnityEditor.Graphing;

public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode)
{
visitor.AddShaderChunk(precision + " " + GetVariableNameForNode() + " = " + m_constantList[constant] + ";", true);
visitor.AddShaderChunk(precision + " " + GetVariableNameForNode() + " = " + m_constantList[constant].ToString(CultureInfo.InvariantCulture) + ";", true);
}
public override string GetVariableNameForSlot(int slotId)

11
com.unity.shadergraph/Editor/Drawing/PreviewManager.cs


try
{
node = results.sourceMap.FindNode(error.line);
message.AppendLine("Shader compilation error in {3} at line {1} (on {2}):\n{0}", error.message, error.line, error.platform, node != null ? string.Format("node {0} ({1})", node.name, node.guid) : "graph");
message.AppendLine(error.messageDetails);
message.AppendNewLine();
catch (Exception e)
catch
Debug.LogException(e);
continue;
message.AppendLine("Shader compilation error in {3} at line {1} (on {2}):\n{0}", error.message, error.line, error.platform, "graph");
message.AppendLine("{0} in {3} at line {1} (on {2})", error.message, error.line, error.platform, node != null ? string.Format("node {0} ({1})", node.name, node.guid) : "graph");
message.AppendLine(error.messageDetails);
message.AppendNewLine();
}
Debug.LogWarning(message.ToString());
ShaderUtil.ClearShaderErrors(m_UberShader);

正在加载...
取消
保存