浏览代码

Start upgrade to new graph view.

/main
Tim Cooper 8 年前
当前提交
591ca2fd
共有 31 个文件被更改,包括 72 次插入73 次删除
  1. 3
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphEditWindow.cs
  2. 2
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/GraphEditorDrawer.cs
  3. 11
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/NodeDrawer.cs
  4. 24
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/TitleBarButtonDrawer.cs
  5. 9
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/TitleBarDrawer.cs
  6. 13
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Manipulators/ClickGlobalSelector.cs
  7. 9
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Manipulators/Clicker.cs
  8. 2
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Manipulators/Commandable.cs
  9. 4
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/SerializableGraphView.cs
  10. 2
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Testing/UnitTests/SerializedGraphTests.cs
  11. 6
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/MaterialNodeDrawer.cs
  12. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/NodePreviewDrawer.cs
  13. 22
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphPreviewGenerator.cs
  14. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphView.cs
  15. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/PropertyNodeTests.cs
  16. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/AbstractMaterialGraphTests.cs
  17. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/DynamicSlotTests.cs
  18. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/FixedSlotTests.cs
  19. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/Function1InputTests.cs
  20. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/Function2InputTests.cs
  21. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/Function3InputTests.cs
  22. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/MaterialGraphTests.cs
  23. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/MaterialNodeTests.cs
  24. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/MaterialSlotTests.cs
  25. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PixelShaderNodeTests.cs
  26. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PropertyChunkTests.cs
  27. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PropertyGeneratorTests.cs
  28. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PropertyNodeTests.cs
  29. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/ShaderGeneratorTests.cs
  30. 2
      MaterialGraphProject/MaterialGraphProject.sln.DotSettings.user
  31. 2
      MaterialGraphProject/ProjectSettings/ProjectVersion.txt

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


using System;
using System.Runtime.Remoting.Messaging;
using UnityEngine.RMGUI;
using UnityEngine.Experimental.UIElements;
namespace UnityEditor.Graphing.Drawing
{

2
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/GraphEditorDrawer.cs


using System;
using UnityEngine.RMGUI;
namespace UnityEditor.Graphing.Drawing
{

11
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/NodeDrawer.cs


using RMGUI.GraphView;
using UnityEditor.Graphing.Util;
using UnityEngine;
using UnityEngine.RMGUI;
using UnityEngine.Experimental.UIElements;
namespace UnityEditor.Graphing.Drawing
{

public NodeDrawer()
{
content = new GUIContent("");
text = string.Empty;
m_ControlsContainer = new VisualContainer
{

for (int i = 0; i < controlPresenters.Count; i++)
{
var controlData = controlPresenters[i];
var imContainer = m_ControlsContainer.GetChildAtIndex(i) as IMGUIContainer;
imContainer.OnGUIHandler = controlData.OnGUIHandler;
var imContainer = m_ControlsContainer.GetChildAt(i) as IMGUIContainer;
imContainer.OnGuiHandler = controlData.OnGUIHandler;
imContainer.height = controlData.GetHeight();
}
}

foreach (var controlData in controlPresenters)
{
var imContainer = new IMGUIContainer()
var imContainer = new IMGUIContainer(controlData.OnGUIHandler)
OnGUIHandler = controlData.OnGUIHandler,
pickingMode = PickingMode.Position,
height = controlData.GetHeight()
};

24
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/TitleBarButtonDrawer.cs


using UnityEngine.RMGUI;
using UnityEngine.Experimental.UIElements;
using UnityEngine.RMGUI.StyleSheets;
using UnityEngine;
namespace UnityEditor.Graphing.Drawing

public TitleBarButtonDrawer(TitleBarButtonPresenter dataProvider)
{
classList = new ClassList("titleBarItem");
AddToClassList("titleBarItem");
m_clicker = new Clicker();
m_clicker.onClick += OnClick;

AddChild(new VisualElement() { classList = new ClassList("titleBarItemBorder") });
m_label = new VisualElement()
{
classList = new ClassList("titleBarItemLabel"),
content = new GUIContent("")
};
var ve = new VisualElement();
ve.AddToClassList("titleBarItemBorder");
AddChild(ve);
m_label = new VisualElement();
m_label.AddToClassList("titleBarItemLabel");
AddChild(new VisualElement() { classList = new ClassList("titleBarItemBorder") });
var ve2 = new VisualElement();
ve2.AddToClassList("titleBarItemBorder");
this.dataProvider = dataProvider;
}

if (m_dataProvider == null)
return;
m_label.content.text = m_dataProvider.text;
m_label.text = m_dataProvider.text;
this.Dirty(ChangeType.Repaint);
}

9
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/TitleBarDrawer.cs


using System.Collections.Generic;
using RMGUI.GraphView;
using UnityEngine.RMGUI;
using UnityEngine.RMGUI.StyleSheets;
using RMGUI.GraphView;
using UnityEngine.Experimental.UIElements;
using System;
namespace UnityEditor.Graphing.Drawing
{

public TitleBarDrawer(TitleBarPresenter dataProvider)
{
classList = ClassList.empty;
name = "TitleBar";
m_LeftContainer = new VisualContainer()

void UpdateContainer(VisualContainer container, IEnumerable<TitleBarButtonPresenter> itemDatas)
{
// The number of items can't change for now.
foreach (var pair in itemDatas.Zip(container.children.OfType<TitleBarButtonDrawer>()))
foreach (var pair in itemDatas.Zip(container.OfType<TitleBarButtonDrawer>()))
{
var itemData = pair.Item1;
var item = pair.Item2;

13
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Manipulators/ClickGlobalSelector.cs


using System;
using RMGUI.GraphView;
using UnityEditor.Graphing.Drawing;
using UnityEngine.RMGUI;
using UnityEngine.Experimental.UIElements;
using ManipulatorActivationFilter = UnityEngine.Experimental.UIElements.ManipulatorActivationFilter;
using MouseButton = UnityEngine.Experimental.UIElements.MouseButton;
using MouseManipulator = UnityEngine.Experimental.UIElements.MouseManipulator;
namespace UnityEditor.Graphing.Drawing
{

{
phaseInterest = EventPhase.Capture;
activators.Add(new ManipActivator {button = MouseButton.LeftMouse});
activators.Add(new ManipActivator {button = MouseButton.RightMouse});
phaseInterest = PropagationPhase.Capture;
activators.Add(new ManipulatorActivationFilter {button = MouseButton.LeftMouse});
activators.Add(new ManipulatorActivationFilter { button = MouseButton.RightMouse});
}
public override EventPropagation HandleEvent(Event evt, VisualElement finalTarget)

9
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Manipulators/Clicker.cs


using RMGUI.GraphView;
using UnityEngine.RMGUI;
using UnityEngine.Experimental.UIElements;
using MouseManipulator = UnityEngine.Experimental.UIElements.MouseManipulator;
using ManipulatorActivationFilter = UnityEngine.Experimental.UIElements.ManipulatorActivationFilter;
using MouseButton = UnityEngine.Experimental.UIElements.MouseButton;
namespace UnityEditor.Graphing.Drawing
{

public Clicker()
{
activators.Add(new ManipActivator {button = MouseButton.LeftMouse});
activators.Add(new ManipulatorActivationFilter {button = MouseButton.LeftMouse});
}
public override EventPropagation HandleEvent(Event evt, VisualElement finalTarget)

2
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Manipulators/Commandable.cs


using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.RMGUI;
using UnityEngine.Experimental.UIElements;
namespace UnityEditor.Graphing.Drawing
{

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


using System.Linq;
using RMGUI.GraphView;
using UnityEngine;
using UnityEngine.RMGUI;
using UnityEngine.Experimental.UIElements;
namespace UnityEditor.Graphing.Drawing
{

if (graphAsset == null || graphAsset.drawingData.selection.SequenceEqual(selection.OfType<NodeDrawer>().Select(d => ((GraphNodePresenter) d.presenter).node.guid))) return;
var selectedDrawers = graphDataSource.graphAsset.drawingData.selection
.Select(guid => contentViewContainer.children
.Select(guid => contentViewContainer
.OfType<NodeDrawer>()
.FirstOrDefault(drawer => ((GraphNodePresenter) drawer.presenter).node.guid == guid))
.ToList();

2
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Testing/UnitTests/SerializedGraphTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[Test]

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


using UnityEditor.Graphing.Drawing;
using UnityEngine.Graphing;
using UnityEngine.MaterialGraph;
using UnityEngine.RMGUI;
using UnityEngine.Experimental.UIElements;
using UnityEditor.Graphing.Util;
using UnityEngine;

if (nodeData.expanded)
{
m_PreviewContainer.paintFlags &= ~PaintFlags.Invisible;
//m_PreviewContainer.paintFlags &= ~PaintFlags.Invisible;
m_PreviewContainer.paintFlags |= PaintFlags.Invisible;
//m_PreviewContainer.paintFlags |= PaintFlags.Invisible;
m_PreviewContainer.AddToClassList("hidden");
}
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Drawer/NodePreviewDrawer.cs


using UnityEngine;
using UnityEngine.RMGUI;
using UnityEngine.Experimental.UIElements;
namespace UnityEditor.MaterialGraph.Drawing
{

22
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphPreviewGenerator.cs


public MaterialGraphPreviewGenerator()
{
EditorUtility.SetCameraAnimateMaterials(utility.m_Camera, true);
EditorUtility.SetCameraAnimateMaterials(utility.camera, true);
if (s_Meshes[0] == null)
{

if (mode == PreviewMode.Preview3D)
{
utility.m_Camera.transform.position = -Vector3.forward * 5;
utility.m_Camera.transform.rotation = Quaternion.identity;
utility.camera.transform.position = -Vector3.forward * 5;
utility.camera.transform.rotation = Quaternion.identity;
utility.m_Camera.projectionMatrix = Matrix4x4.identity;
utility.camera.projectionMatrix = Matrix4x4.identity;
EditorUtility.SetCameraAnimateMaterialsTime(utility.m_Camera, time);
utility.m_Light[0].intensity = 1.0f;
utility.m_Light[0].transform.rotation = Quaternion.Euler(50f, 50f, 0);
utility.m_Light[1].intensity = 1.0f;
InternalEditorUtility.SetCustomLighting(utility.m_Light, Color.black);
EditorUtility.SetCameraAnimateMaterialsTime(utility.camera, time);
utility.lights[0].intensity = 1.0f;
utility.lights[0].transform.rotation = Quaternion.Euler(50f, 50f, 0);
utility.lights[1].intensity = 1.0f;
InternalEditorUtility.SetCustomLighting(utility.lights, Color.black);
utility.m_Camera.clearFlags = CameraClearFlags.Depth;
utility.camera.clearFlags = CameraClearFlags.Depth;
utility.DrawMesh(
mode == PreviewMode.Preview3D ? s_Meshes[0] : quad,

0);
utility.m_Camera.Render();
utility.camera.Render();
Unsupported.SetRenderSettingsUseFogNoDirty(oldFog);
InternalEditorUtility.RemoveCustomLighting();

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


using UnityEngine;
using UnityEngine.Graphing;
using UnityEngine.MaterialGraph;
using UnityEngine.RMGUI;
using UnityEngine.Experimental.UIElements;
using Edge = RMGUI.GraphView.Edge;
using Object = UnityEngine.Object;

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/IntegrationTests/PropertyNodeTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
private static readonly string[] s_TexturePath =

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/AbstractMaterialGraphTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[Test]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/DynamicSlotTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[SetUp]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/FixedSlotTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[SetUp]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/Function1InputTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[SetUp]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/Function2InputTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[SetUp]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/Function3InputTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[SetUp]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/MaterialGraphTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[Test]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/MaterialNodeTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[SetUp]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/MaterialSlotTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[SetUp]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PixelShaderNodeTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[SetUp]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PropertyChunkTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[SetUp]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PropertyGeneratorTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
private const string kPropertyName = "ThePropertyName";

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/PropertyNodeTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
[SetUp]

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Testing/UnitTests/ShaderGeneratorTests.cs


[TestFixtureSetUp]
public void RunBeforeAnyTests()
{
Debug.logger.logHandler = new ConsoleLogHandler();
Debug.unityLogger.logHandler = new ConsoleLogHandler();
}
class TestNode : AbstractMaterialNode

2
MaterialGraphProject/MaterialGraphProject.sln.DotSettings.user


<s:String x:Key="/Default/Environment/ContinuousTesting/PersistentDataLocation/@EntryValue">C:\Users\Tim\AppData\Local\Temp\JetBrains\ContinuousTesting\7e95cb10-f230-442a-ba1f-a26bdb4193cb</s:String>
<s:String x:Key="/Default/Environment/ContinuousTesting/ScopeCriterion/@EntryValue">9b0nIQIAAACJbLoh9b0nIQIAAADP4jFoJAAAADwATQBhAHQAZQByAGkAYQBsAEcAcgBhAHAAaABQAHIAbwBqAGUAYwB0AC4AQwBTAGgAYQByAHAALgBFAGQAaQB0AG8AcgA+AC0AAABDADoAXABjAG8AZABlAFwATQBhAHQAZQByAGkAYQBsAEcAcgBhAHAAaABHAGkAdABcAE0AYQB0AGUAcgBpAGEAbABHAHIAYQBwAGgAUAByAG8AagBlAGMAdAA4rDtD+4tkDSUAAABVAG4AaQB0AHkARQBkAGkAdABvAHIALgBHAHIAYQBwAGgAaQBuAGcALgBJAG4AdABlAGcAcgBhAHQAaQBvAG4AVABlAHMAdABzAA==</s:String>
<s:String x:Key="/Default/Environment/ContinuousTesting/SnapshotLocation/@EntryValue">C:\Users\Tim\AppData\Local\Temp\ssm.Cuvulyq.tmp</s:String>
<s:String x:Key="/Default/Environment/ContinuousTesting/SnapshotLocation/@EntryValue">C:\Users\tim\AppData\Local\Temp\ssm.Metecyz.tmp</s:String>
<s:String x:Key="/Default/Environment/ContinuousTesting/Strategy/@EntryValue">RunTests</s:String>
<s:String x:Key="/Default/Environment/ContinuousTesting/TriggerMode/@EntryValue">OnBuild</s:String></wpf:ResourceDictionary>

2
MaterialGraphProject/ProjectSettings/ProjectVersion.txt


m_EditorVersion: 5.6.0b6
m_EditorVersion: 2017.2.0a1
正在加载...
取消
保存