浏览代码

Extracted common parts of MaterialGraphAsset, MaterialRemapAsset and MaterialSubGraphAsset into abstract class

/main
Peter Bay Bastian 8 年前
当前提交
0d1c4d7e
共有 5 个文件被更改,包括 51 次插入75 次删除
  1. 27
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/MaterialGraphAsset.cs
  2. 27
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Remapper/MaterialRemapAsset.cs
  3. 27
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SubGraph/MaterialSubGraphAsset.cs
  4. 33
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/AbstractMaterialGraphAsset.cs
  5. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/AbstractMaterialGraphAsset.cs.meta

27
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/MaterialGraphAsset.cs


namespace UnityEngine.MaterialGraph
{
public class MaterialGraphAsset : ScriptableObject, IMaterialGraphAsset
public class MaterialGraphAsset : AbstractMaterialGraphAsset
{
[SerializeField]
private MaterialGraph m_MaterialGraph = new MaterialGraph();

public IGraph graph
public override IGraph graph
}
public bool shouldRepaint
{
get { return graph.GetNodes<AbstractMaterialNode>().OfType<IRequiresTime>().Any(); }
}
public ScriptableObject GetScriptableObject()
{
return this;
}
public void OnEnable()
{
graph.OnEnable();
}
#if UNITY_EDITOR

private int GetShaderInstanceID()
{
return m_GeneratedShader == null ? 0 : m_GeneratedShader.GetInstanceID();
}
[SerializeField]
private GraphDrawingData m_DrawingData = new GraphDrawingData();
public GraphDrawingData drawingData
{
get { return m_DrawingData; }
}
}
}

27
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Remapper/MaterialRemapAsset.cs


namespace UnityEngine.MaterialGraph
{
public class MaterialRemapAsset : ScriptableObject, IMaterialGraphAsset
public class MaterialRemapAsset : AbstractMaterialGraphAsset
public IGraph graph
public override IGraph graph
{
get { return m_MasterRemapGraph; }
}

get { return m_MasterRemapGraph; }
}
public bool shouldRepaint
{
get { return graph.GetNodes<AbstractMaterialNode>().OfType<IRequiresTime>().Any(); }
}
public ScriptableObject GetScriptableObject()
{
return this;
}
public void OnEnable()
{
graph.OnEnable();
}
[SerializeField]
private GraphDrawingData m_DrawingData = new GraphDrawingData();
public GraphDrawingData drawingData
{
get { return m_DrawingData; }
}
}
}

27
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/SubGraph/MaterialSubGraphAsset.cs


namespace UnityEngine.MaterialGraph
{
public class MaterialSubGraphAsset : ScriptableObject, IMaterialGraphAsset
public class MaterialSubGraphAsset : AbstractMaterialGraphAsset
public IGraph graph
public override IGraph graph
{
get { return m_MaterialSubGraph; }
}

get { return m_MaterialSubGraph; }
}
public bool shouldRepaint
{
get { return graph.GetNodes<AbstractMaterialNode>().OfType<IRequiresTime>().Any(); }
}
public ScriptableObject GetScriptableObject()
{
return this;
}
public void OnEnable()
{
graph.OnEnable();
}
}
[SerializeField]
private GraphDrawingData m_DrawingData = new GraphDrawingData();
public GraphDrawingData drawingData
{
get { return m_DrawingData; }
}
}
}

33
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/AbstractMaterialGraphAsset.cs


using System.Linq;
using UnityEngine.Graphing;
namespace UnityEngine.MaterialGraph
{
public abstract class AbstractMaterialGraphAsset : ScriptableObject, IMaterialGraphAsset
{
public abstract IGraph graph { get; }
public bool shouldRepaint
{
get { return graph.GetNodes<AbstractMaterialNode>().OfType<IRequiresTime>().Any(); }
}
public ScriptableObject GetScriptableObject()
{
return this;
}
public void OnEnable()
{
graph.OnEnable();
}
[SerializeField]
private GraphDrawingData m_DrawingData = new GraphDrawingData();
public GraphDrawingData drawingData
{
get { return m_DrawingData; }
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Graphs/AbstractMaterialGraphAsset.cs.meta


fileFormatVersion: 2
guid: f69ae4bd132ba4c4990a5f2ec28e5932
timeCreated: 1482920380
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存