浏览代码

[fix]Partial fix to rendering not being updated. Not complete but getting there.

/main
Tim Cooper 8 年前
当前提交
defd6784
共有 8 个文件被更改,包括 18 次插入11 次删除
  1. 3
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Presenters/GraphControlPresenter.cs
  2. 2
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/SerializableGraphView.cs
  3. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateShaderGraph.cs
  4. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/AbstractMaterialGraphInspector.cs
  5. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/MaterialNodeDrawer.cs
  6. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialNodePresenter.cs
  7. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/NodePreviewPresenter.cs
  8. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Normal/UnpackNormalNode.cs

3
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Presenters/GraphControlPresenter.cs


using System;
using UIElements.GraphView;
using UnityEditor.MaterialGraph.Drawing;
using UnityEngine;
using UnityEngine.Graphing;

public abstract class GraphControlPresenter : GraphElementPresenter
public abstract class GraphControlPresenter : MaterialNodePresenter
{
public INode node { get; private set; }

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


var graphDataSource = GetPresenter<AbstractGraphPresenter>();
if (graphDataSource == null || graphDataSource.graphAsset == null)
return;
Selection.activeObject = graphDataSource.graphAsset.GetScriptableObject();
//Selection.activeObject = graphDataSource.graphAsset.GetScriptableObject();
}
private void PropagateSelection()

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateShaderGraph.cs


using System.IO;
using UnityEditor.ProjectWindowCallback;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph
{

public override void Action(int instanceId, string pathName, string resourceFile)
{
var graph = new UnityEngine.MaterialGraph.MaterialGraph();
graph.AddNode(new MetallicMasterNode());
File.WriteAllText(pathName, EditorJsonUtility.ToJson(graph));
AssetDatabase.Refresh ();
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/AbstractMaterialGraphInspector.cs


var size = Mathf.Min(r.width, r.height);
var image = m_NodePreviewPresenter.Render(new Vector2(size, size));
GUI.DrawTexture(r, image, ScaleMode.ScaleToFit);
m_NodePreviewPresenter.modificationScope = ModificationScope.Node;
// m_NodePreviewPresenter.modificationScope = ModificationScope.Node;
}
else
{

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/MaterialNodeDrawer.cs


UpdatePreviewTexture(m_currentPreviewData);
return;
}
m_currentPreviewData = nodeData.elements.OfType<NodePreviewPresenter>().FirstOrDefault();
UpdatePreviewTexture(m_currentPreviewData);

m_PreviewImage.AddToClassList("hidden");
}
}
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/MaterialNodePresenter.cs


}
}
public override UnityEngine.Object[] GetObjectsToWatch()
{
var towatch = new List<UnityEngine.Object>();
towatch.AddRange(base.GetObjectsToWatch());
towatch.Add(m_NodePreviewPresenter);
return towatch.ToArray();
}
public override void OnModified(ModificationScope scope)
{
base.OnModified(scope);

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Presenters/NodePreviewPresenter.cs


private AbstractMaterialNode m_Node;
[NonSerialized]
[SerializeField]
private ModificationScope m_modificationScope;
// Null means no modification is currently in progress.

7
MaterialGraphProject/Assets/UnityShaderEditor/Runtime/Nodes/Normal/UnpackNormalNode.cs


name = "UnpackNormal";
}
public override bool hasPreview
{
get { return false; }
}
static string Unity_Sign(
static string Unity_UnpackNormal(
[Slot(0, Binding.None)] Vector4 packedNormal,
[Slot(1, Binding.None)] out Vector3 normal)
{

正在加载...
取消
保存