Skip to content

Commit 8bcf7d2

Browse files
committed
add GraphEditor
1 parent ea9488b commit 8bcf7d2

17 files changed

+569
-457
lines changed

Graph/Compatibility/TagTypeCompatibility.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
using System.Linq;
44
using System.Text;
55

6-
namespace Graph.Compatibility {
6+
namespace Graph.Compatibility {
7+
78
/// <summary>
89
/// Determines the compatibility between two node item connectors based on the type of the Tag property.
910
/// </summary>
@@ -16,8 +17,8 @@ public class TagTypeCompatibility : ICompatibilityStrategy {
1617
/// <returns><see langword="true"/> if the connection is valid; <see langword="false"/> otherwise</returns>
1718
public bool CanConnect( NodeConnector from, NodeConnector to )
1819
{
19-
if (null == from.Item.Tag || null == to.Item.Tag) return false;
20-
if (from.Item.Tag.GetType() == to.Item.Tag.GetType())
20+
//if (null == from.Item.Tag || null == to.Item.Tag) return false;
21+
if (from.Item.GetType().IsAssignableFrom(to.Item.GetType()))
2122
{
2223
return true;
2324
}

Graph/GraphRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ static Color GetArrowLineColor(RenderState state)
510510
} else
511511
if ((state & RenderState.Connected) != 0)
512512
{
513-
return Color.Black;
513+
return Color.LimeGreen;
514514
} else
515515
return Color.LightGray;
516516
}

Graph/Items/NodeTitleItem.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@
2929

3030
namespace Graph.Items
3131
{
32-
internal sealed class NodeTitleItem : NodeItem
32+
public sealed class NodeTitleItem : NodeItem
3333
{
34+
public NodeTitleItem() :
35+
base(true,true)
36+
{
37+
}
38+
3439
#region Text
3540
string internalTitle = string.Empty;
3641
public string Title

Graph/Node.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@
3030

3131
namespace Graph
3232
{
33+
public enum NodeType
34+
{
35+
Title,
36+
Int,
37+
Float,
38+
Vector,
39+
Color,
40+
}
41+
3342
public sealed class NodeEventArgs : EventArgs
3443
{
3544
public NodeEventArgs(Node node) { Node = node; }
@@ -100,8 +109,8 @@ public bool Collapsed
100109
internal readonly List<NodeConnector> inputConnectors = new List<NodeConnector>();
101110
internal readonly List<NodeConnector> outputConnectors = new List<NodeConnector>();
102111
internal readonly List<NodeConnection> connections = new List<NodeConnection>();
103-
internal readonly NodeTitleItem titleItem = new NodeTitleItem();
104-
readonly List<NodeItem> nodeItems = new List<NodeItem>();
112+
public NodeTitleItem titleItem = new NodeTitleItem();
113+
readonly List<NodeItem> nodeItems = new List<NodeItem>();
105114

106115
public Node(string title)
107116
{
Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,47 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 11.00
3-
# Visual Studio 2010
4-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Graph", "Graph\Graph.csproj", "{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}"
5-
EndProject
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphExample", "GraphExample\GraphExample.csproj", "{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}"
7-
EndProject
8-
Global
9-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10-
Debug|Any CPU = Debug|Any CPU
11-
Debug|Mixed Platforms = Debug|Mixed Platforms
12-
Debug|x86 = Debug|x86
13-
Release|Any CPU = Release|Any CPU
14-
Release|Mixed Platforms = Release|Mixed Platforms
15-
Release|x86 = Release|x86
16-
EndGlobalSection
17-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18-
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19-
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
20-
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
21-
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
22-
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Debug|x86.ActiveCfg = Debug|Any CPU
23-
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
24-
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Release|Any CPU.Build.0 = Release|Any CPU
25-
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
26-
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
27-
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Release|x86.ActiveCfg = Release|Any CPU
28-
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Debug|Any CPU.ActiveCfg = Debug|x86
29-
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
30-
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Debug|Mixed Platforms.Build.0 = Debug|x86
31-
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Debug|x86.ActiveCfg = Debug|x86
32-
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Debug|x86.Build.0 = Debug|x86
33-
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Release|Any CPU.ActiveCfg = Release|x86
34-
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Release|Mixed Platforms.ActiveCfg = Release|x86
35-
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Release|Mixed Platforms.Build.0 = Release|x86
36-
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Release|x86.ActiveCfg = Release|x86
37-
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Release|x86.Build.0 = Release|x86
38-
EndGlobalSection
39-
GlobalSection(SolutionProperties) = preSolution
40-
HideSolutionNode = FALSE
41-
EndGlobalSection
42-
EndGlobal
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31205.134
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Graph", "Graph\Graph.csproj", "{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphEditor", "GraphEditor\GraphEditor.csproj", "{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Debug|Mixed Platforms = Debug|Mixed Platforms
14+
Debug|x86 = Debug|x86
15+
Release|Any CPU = Release|Any CPU
16+
Release|Mixed Platforms = Release|Mixed Platforms
17+
Release|x86 = Release|x86
18+
EndGlobalSection
19+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20+
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
23+
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
24+
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Debug|x86.ActiveCfg = Debug|Any CPU
25+
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Release|Any CPU.Build.0 = Release|Any CPU
27+
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
28+
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
29+
{E4CC63D8-127D-4BC9-80E0-CCB3E9DA06DC}.Release|x86.ActiveCfg = Release|Any CPU
30+
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Debug|Any CPU.ActiveCfg = Debug|x86
31+
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
32+
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Debug|Mixed Platforms.Build.0 = Debug|x86
33+
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Debug|x86.ActiveCfg = Debug|x86
34+
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Debug|x86.Build.0 = Debug|x86
35+
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Release|Any CPU.ActiveCfg = Release|x86
36+
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Release|Mixed Platforms.ActiveCfg = Release|x86
37+
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Release|Mixed Platforms.Build.0 = Release|x86
38+
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Release|x86.ActiveCfg = Release|x86
39+
{382D4FF6-FE2B-4AE9-8FBA-0D5C44C105A7}.Release|x86.Build.0 = Release|x86
40+
EndGlobalSection
41+
GlobalSection(SolutionProperties) = preSolution
42+
HideSolutionNode = FALSE
43+
EndGlobalSection
44+
GlobalSection(ExtensibilityGlobals) = postSolution
45+
SolutionGuid = {2CAD7626-DC05-453A-9D89-0804F759389E}
46+
EndGlobalSection
47+
EndGlobal

0 commit comments

Comments
 (0)