浏览代码

[Material graph] Tidy up asset handling (generic graph drawer that can be used by all graphs)

/main
Tim Cooper 9 年前
当前提交
cea17e49
共有 8 个文件被更改,包括 71 次插入12 次删除
  1. 2
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/GraphDataSource.cs
  2. 14
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/GraphEditWindow.cs
  3. 17
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Assets/SerializableGraphAsset.cs
  4. 5
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/SerializableGraph.cs
  5. 5
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/AbstractMaterialGraph.cs
  6. 14
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/MaterialGraphAsset.cs
  7. 14
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs
  8. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs.meta

2
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/GraphDataSource.cs


}
return s_DrawerUI;
}
}
}
public CanvasElement[] FetchElements()
{

14
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/GraphEditWindow.cs


namespace UnityEditor.Graphing.Drawing
{
class GraphEditWindow : EditorWindow
public class GraphEditWindow : AbstractGraphEditWindow<SerializableGraphAsset>
{
[MenuItem("Window/Graph Editor")]
public static void OpenMenu()

}
public abstract class AbstractGraphEditWindow<T> : EditorWindow where T : ScriptableObject, IGraphAsset
{
private SerializableGraphAsset m_LastSelection;
private T m_LastSelection;
[NonSerialized]
private Canvas2D m_Canvas;

{
get
{
return m_LastSelection != null && m_LastSelection.graph != null;
return m_LastSelection != null && m_LastSelection.shouldRepaint;
}
}

if (Selection.activeObject == null || !EditorUtility.IsPersistent(Selection.activeObject))
return;
if (Selection.activeObject is SerializableGraphAsset)
if (Selection.activeObject is T)
var selection = (SerializableGraphAsset) Selection.activeObject;
var selection = (T) Selection.activeObject;
if (selection != m_LastSelection)
{
m_LastSelection = selection;

EditorGUILayout.EndHorizontal();
}*/
}
}

17
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Assets/SerializableGraphAsset.cs


namespace UnityEngine.Graphing
{
public class SerializableGraphAsset : ScriptableObject
public interface IGraphAsset
{
IGraph graph { get; }
bool shouldRepaint { get; }
}
public class SerializableGraphAsset : ScriptableObject, IGraphAsset
private SerializableGraph m_Graph = new SerializableGraph();
protected SerializableGraph m_Graph = new SerializableGraph();
public SerializableGraph graph
public IGraph graph
}
public bool shouldRepaint
{
get { return false; }
}
}
}

5
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Runtime/Implementation/SerializableGraph.cs


foreach (var node in nodes)
node.ValidateNode();
}
public virtual bool RequiresConstantRepaint()
{
return false;
}
}
}

5
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/AbstractMaterialGraph.cs


}
}
public override bool RequiresConstantRepaint()
{
return nodes.OfType<IRequiresTime>().Any();
}
/*public PreviewRenderUtility previewUtility
{
get

14
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/MaterialGraphAsset.cs


using System.Linq;
using UnityEngine.Graphing;
public class MaterialGraphAsset : ScriptableObject
public class MaterialGraphAsset : ScriptableObject, IGraphAsset
public MaterialGraph graph
public IGraph graph
get { return m_MaterialGraph; }
get { return m_MaterialGraph.currentGraph; }
}
public bool shouldRepaint
{
get { return graph.nodes.OfType<IRequiresTime>().Any(); }
}
public Material GetMaterial()

14
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs


using UnityEditor.Graphing.Drawing;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph
{
public class MaterialGraphEditWindow : AbstractGraphEditWindow<MaterialGraphAsset>
{
[MenuItem("Window/Material Editor")]
public static void OpenMenu()
{
GetWindow<MaterialGraphEditWindow>();
}
}
}

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphEditWindow.cs.meta


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