Коммит
cfb3a9f75d
|
@ -5,11 +5,12 @@ All notable changes to this package will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.2.1] - 2019-02-06
|
||||
## [0.2.1] - 2019-02-07
|
||||
|
||||
### Added
|
||||
|
||||
- It is possible to hide the legend within the inspector through the window menu
|
||||
- Runtime tests
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -39,6 +39,11 @@ public class GraphVisualizerClient
|
|||
}
|
||||
}
|
||||
|
||||
public static void ClearGraphs()
|
||||
{
|
||||
instance.m_Graphs.Clear();
|
||||
}
|
||||
|
||||
public static IEnumerable<PlayableGraph> GetGraphs()
|
||||
{
|
||||
return instance.m_Graphs;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: db91a525414eed845a7f8efa1070a218
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e4c186e2d570110b48de95a1c5fecc03
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,101 @@
|
|||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
using UnityEngine.Playables;
|
||||
|
||||
class GraphVisualizerClientTest
|
||||
{
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
// Clear graphs between tests, otherwise graphs are still referenced across tests.
|
||||
GraphVisualizerClient.ClearGraphs();
|
||||
}
|
||||
|
||||
private static PlayableGraph CreatePlayableGraph(string name)
|
||||
{
|
||||
var graph = PlayableGraph.Create(name);
|
||||
ScriptPlayableOutput.Create(graph, "output");
|
||||
return graph;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanShowGraph()
|
||||
{
|
||||
var graph1 = CreatePlayableGraph("test1");
|
||||
var graph2 = CreatePlayableGraph("test2");
|
||||
|
||||
GraphVisualizerClient.Show(graph1);
|
||||
var graphs = GraphVisualizerClient.GetGraphs().ToArray();
|
||||
|
||||
Assert.That(graphs.Length, Is.EqualTo(1));
|
||||
Assert.That(graphs[0].GetEditorName(), Is.EqualTo(graph1.GetEditorName()));
|
||||
|
||||
GraphVisualizerClient.Show(graph2);
|
||||
graphs = GraphVisualizerClient.GetGraphs().ToArray();
|
||||
|
||||
Assert.That(graphs.Length, Is.EqualTo(2));
|
||||
Assert.That(graphs[0].GetEditorName(), Is.EqualTo(graph1.GetEditorName()));
|
||||
Assert.That(graphs[1].GetEditorName(), Is.EqualTo(graph2.GetEditorName()));
|
||||
|
||||
graph1.Destroy();
|
||||
graph2.Destroy();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CannotShowSameGraphTwice()
|
||||
{
|
||||
var graph1 = CreatePlayableGraph("test1");
|
||||
|
||||
GraphVisualizerClient.Show(graph1);
|
||||
var graphs = GraphVisualizerClient.GetGraphs().ToArray();
|
||||
|
||||
Assert.That(graphs.Length, Is.EqualTo(1));
|
||||
|
||||
graph1.Destroy();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanHideGraph()
|
||||
{
|
||||
var graph1 = CreatePlayableGraph("test1");
|
||||
var graph2 = CreatePlayableGraph("test2");
|
||||
|
||||
GraphVisualizerClient.Show(graph1);
|
||||
GraphVisualizerClient.Show(graph2);
|
||||
var graphs = GraphVisualizerClient.GetGraphs().ToArray();
|
||||
|
||||
Assert.That(graphs.Length, Is.EqualTo(2));
|
||||
Assert.That(graphs[0].GetEditorName(), Is.EqualTo(graph1.GetEditorName()));
|
||||
Assert.That(graphs[1].GetEditorName(), Is.EqualTo(graph2.GetEditorName()));
|
||||
|
||||
GraphVisualizerClient.Hide(graph1);
|
||||
graphs = GraphVisualizerClient.GetGraphs().ToArray();
|
||||
|
||||
Assert.That(graphs.Length, Is.EqualTo(1));
|
||||
Assert.That(graphs[0].GetEditorName(), Is.EqualTo(graph2.GetEditorName()));
|
||||
|
||||
graph1.Destroy();
|
||||
graph2.Destroy();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanClearGraphs()
|
||||
{
|
||||
var graph1 = CreatePlayableGraph("test1");
|
||||
var graph2 = CreatePlayableGraph("test2");
|
||||
|
||||
GraphVisualizerClient.Show(graph1);
|
||||
GraphVisualizerClient.Show(graph2);
|
||||
var graphs = GraphVisualizerClient.GetGraphs().ToArray();
|
||||
|
||||
Assert.That(graphs.Length, Is.EqualTo(2));
|
||||
|
||||
GraphVisualizerClient.ClearGraphs();
|
||||
graphs = GraphVisualizerClient.GetGraphs().ToArray();
|
||||
|
||||
Assert.That(graphs.Length, Is.EqualTo(0));
|
||||
|
||||
graph1.Destroy();
|
||||
graph2.Destroy();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 76f082e5010cb366e9639d3b6f99834e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "Unity.PlayableGraphVisualizer.Tests",
|
||||
"references": [
|
||||
"Unity.PlayableGraphVisualizer"
|
||||
],
|
||||
"optionalUnityReferences": [
|
||||
"TestAssemblies"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": []
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 24b367a1e8631110f924a62b35bba83d
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "com.unity.playablegraph-visualizer",
|
||||
"displayName": "PlayableGraph Visualizer",
|
||||
"version": "0.2.1-preview",
|
||||
"version": "0.2.1-preview.3",
|
||||
"unity": "2018.1",
|
||||
"description": "The PlayableGraph Visualizer is a tool that displays the PlayableGraphs in the scene. It can be used in both Play and Edit mode and will always reflect the current state of the graph. Playable nodes are represented by colored nodes, varying according to their type. Connections color intensity indicates its weight.",
|
||||
"licence": "MIT",
|
||||
|
|
Загрузка…
Ссылка в новой задаче