浏览代码

Merge pull request #1458 from Unity-Technologies/sg/fix-subgraph-properties

Fix texture and boolean property types in subgraphs
/main
GitHub 6 年前
当前提交
7d8789d6
共有 3 个文件被更改,包括 8 次插入4 次删除
  1. 1
      com.unity.shadergraph/CHANGELOG.md
  2. 9
      com.unity.shadergraph/Editor/Data/Nodes/Utility/SubGraphNode.cs
  3. 2
      com.unity.shadergraph/Editor/Importers/ShaderGraphImporter.cs

1
com.unity.shadergraph/CHANGELOG.md


- Your system locale can no longer cause incorrect commands due to full stops being converted to commas.
- Deserialization of subgraphs now works correctly.
- Sub graphs are now suffixed with (sub), so you can tell them apart from other nodes.
- Boolean and Texture type properties now function correctly in sub-graphs.
- The preview of a node does not obstruct the selection outliner anymore.
- The Dielectric Specular node no longer resets its control values.
- HD PBR subshader no longer duplicates surface description code into vertex shader.

9
com.unity.shadergraph/Editor/Data/Nodes/Utility/SubGraphNode.cs


if (prop is TextureShaderProperty)
arguments.Add(string.Format("TEXTURE2D_PARAM({0}, sampler{0})", GetSlotValue(inSlotId, generationMode)));
if (prop is Texture2DArrayShaderProperty)
arguments.Add(string.Format("TEXTURE2D_PARAM({0}, sampler{0})", GetSlotValue(inSlotId, generationMode)));
if (prop is Texture3DShaderProperty)
else if (prop is Texture2DArrayShaderProperty)
arguments.Add(string.Format("TEXTURE2D_ARRAY_PARAM({0}, sampler{0})", GetSlotValue(inSlotId, generationMode)));
else if (prop is Texture3DShaderProperty)
arguments.Add(string.Format("TEXTURE3D_PARAM({0}, sampler{0})", GetSlotValue(inSlotId, generationMode)));
else if (prop is CubemapShaderProperty)
arguments.Add(string.Format("TEXTURECUBE_PARAM({0}, sampler{0})", GetSlotValue(inSlotId, generationMode)));

break;
case PropertyType.Vector4:
slotType = SlotValueType.Vector4;
break;
case PropertyType.Boolean:
slotType = SlotValueType.Boolean;
break;
case PropertyType.Matrix2:
slotType = SlotValueType.Matrix2;

2
com.unity.shadergraph/Editor/Importers/ShaderGraphImporter.cs


namespace UnityEditor.ShaderGraph
{
[ScriptedImporter(15, ShaderGraphExtension)]
[ScriptedImporter(16, ShaderGraphExtension)]
public class ShaderGraphImporter : ScriptedImporter
{
public const string ShaderGraphExtension = "shadergraph";

正在加载...
取消
保存