浏览代码

fix up serialisation on load.

/main
Tim Cooper 8 年前
当前提交
8bbb99b1
共有 3 个文件被更改,包括 29 次插入19 次删除
  1. 40
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphEditWindow.cs
  2. 2
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphInspector.cs
  3. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/HelperShader.shader.meta

40
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphEditWindow.cs


// TODO JOCE Derive from GraphViewEditorWindow
public abstract class AbstractGraphEditWindow : EditorWindow, ISerializationCallbackReceiver
{
public RenderTexture rt;
[SerializeField]
private ScriptableObject m_ToLoad;
private bool shouldRepaint
{

void Update()
{
if (m_ToLoad)
{
ChangeSelction (m_ToLoad as IGraphAsset);
m_ToLoad = null;
}
if (shouldRepaint)
Repaint();
}

if (m_Selected == newSelection)
return;
if (m_Selected != null) {
if (EditorUtility.DisplayDialog ("Save Old Graph?", "Save Old Graph?", "yes!", "no")) {
UpdateAsset ();
}
}
m_Selected = newSelection;
m_InMemoryAsset = UnityEngine.Object.Instantiate (newGraph) as IGraphAsset;

graph.ValidateGraph ();
var source = CreateDataSource ();
source.Initialize (m_InMemoryAsset, this);
source.Initialize (m_InMemoryAsset, this) ;
m_GraphEditorDrawer.presenter = source;
//m_GraphView.StretchToParentSize();
Repaint ();

m_GraphEditorDrawer.graphView.Schedule (Focus).StartingIn (1).Until (() => focused);
}
}
public void OnBeforeSerialize()
{
m_ToLoad = m_Selected as ScriptableObject;
}
public void OnAfterDeserialize()
{}
/*
private void ConvertSelectionToSubGraph()

m_Canvas.Repaint();
}*/
public void OnBeforeSerialize()
{
/* var o = m_Selected as ScriptableObject;
if (o != null)
m_LastSelectedGraphSerialized = o;*/
}
public void OnAfterDeserialize()
{
/* if (m_LastSelectedGraphSerialized != null)
m_Selected = m_LastSelectedGraphSerialized as T;
m_LastSelectedGraphSerialized = null;*/
}
}
}

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


protected IGraphAsset graphAsset
{
get { return target as IGraphAsset; }
get { return target as IGraphAsset; }
}
protected AbstractGraphInspector(IEnumerable<TypeMapping> typeMappings)

6
MaterialGraphProject/Assets/UnityShaderEditor/Editor/HelperShader.shader.meta


fileFormatVersion: 2
guid: 9ab5e16c2083a4fe689209a8c1ae425e
timeCreated: 1495403711
timeCreated: 1495436993
nonModifiableTextures: []
nonModifiableTextures:
- Texture_2ad4e61d_d44e_4e70_b3d0_540eae630bdf_Uniform: {fileID: 2800000, guid: 76c3d794167d8524481195736f067518,
type: 3}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存