浏览代码

[shaderGraph]

*Use last shader string instead of hash.
/main
Tim Cooper 9 年前
当前提交
556a7777
共有 4 个文件被更改,包括 7 次插入7 次删除
  1. 2
      UnityProject/Assets/UnityShaderEditor/Editor/Source/AssetCallbacks/CreateShaderGraph.cs
  2. 2
      UnityProject/Assets/UnityShaderEditor/Editor/Source/AssetCallbacks/CreateShaderSubGraph.cs
  3. 2
      UnityProject/Assets/UnityShaderEditor/Editor/Source/MaterialGraph.cs
  4. 8
      UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/BaseMaterialNode.cs

2
UnityProject/Assets/UnityShaderEditor/Editor/Source/AssetCallbacks/CreateShaderGraph.cs


var graph = CreateInstance<MaterialGraph>();
graph.name = Path.GetFileName(pathName);
AssetDatabase.CreateAsset(graph, pathName);
graph.CreateSubAssets();
graph.AddSubAssetsToAsset();
}
}
}

2
UnityProject/Assets/UnityShaderEditor/Editor/Source/AssetCallbacks/CreateShaderSubGraph.cs


var graph = CreateInstance<MaterialSubGraph>();
graph.name = Path.GetFileName(pathName);
AssetDatabase.CreateAsset(graph, pathName);
graph.CreateSubAssets();
graph.AddSubAssetsToAsset();
}
}*/
}

2
UnityProject/Assets/UnityShaderEditor/Editor/Source/MaterialGraph.cs


// m_MaterialProperties.OnChangePreviewState -= OnChangePreviewState;
}
public void CreateSubAssets()
public void AddSubAssetsToAsset()
{
AssetDatabase.AddObjectToAsset(m_MaterialOptions, this);
AssetDatabase.AddObjectToAsset(m_PixelGraph, this);

8
UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/BaseMaterialNode.cs


}
[SerializeField]
private int m_LastShaderHash;
private string m_LastShader;
[SerializeField]
private Shader m_PreviewShader;

m_PreviewShader = ShaderUtil.CreateShaderAsset(resultShader);
m_PreviewShader.hideFlags = HideFlags.HideInHierarchy;
AssetDatabase.AddObjectToAsset(m_PreviewShader, this);
m_LastShaderHash = resultShader.GetHashCode();
m_LastShader = resultShader;
if (hash != m_LastShaderHash)
if (string.CompareOrdinal(resultShader, m_LastShader) != 0)
m_LastShaderHash = hash;
m_LastShader = resultShader;
}
}

正在加载...
取消
保存