Skip to content

Commit 7c06d7b

Browse files
authored
Merge pull request #4 from CCEMT/dev
Dev
2 parents 39f429e + a1f8d57 commit 7c06d7b

File tree

120 files changed

+1204
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+1204
-146
lines changed

Assets/Emilia/Node.Editor/Attribute/EditorAssetShowAttribute.cs

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Emilia.Node.Attributes
44
{
5+
/// <summary>
6+
/// 以编辑方式展示资源
7+
/// </summary>
58
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
69
public class EditorAssetShowAttribute : Attribute
710
{

Assets/Emilia/Node.Editor/Core/CopyPaste/CopyPasteContext.cs

+7
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22

33
namespace Emilia.Node.Editor
44
{
5+
/// <summary>
6+
/// 拷贝粘贴上下文
7+
/// </summary>
58
public struct CopyPasteContext
69
{
710
public object userData;
11+
12+
/// <summary>
13+
/// 依赖的Pack
14+
/// </summary>
815
public List<ICopyPastePack> dependency;
916
}
1017
}

Assets/Emilia/Node.Editor/Core/CopyPaste/CopyPasteGraph.cs

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ public class CopyPasteGraph
1111
[OdinSerialize, NonSerialized]
1212
private List<CopyPasteNode> nodes = new List<CopyPasteNode>();
1313

14+
/// <summary>
15+
/// 开始粘贴
16+
/// </summary>
1417
public void StartPaste(object userData)
1518
{
1619
Undo.IncrementCurrentGroup();
@@ -74,6 +77,9 @@ private List<ICopyPastePack> GetInputPack(CopyPasteNode node)
7477
return inputPacks;
7578
}
7679

80+
/// <summary>
81+
/// 添加Pack
82+
/// </summary>
7783
public void AddPack(ICopyPastePack pack)
7884
{
7985
CopyPasteNode addNode = new CopyPasteNode(pack);
@@ -98,6 +104,9 @@ public void AddPack(ICopyPastePack pack)
98104
nodes.Add(addNode);
99105
}
100106

107+
/// <summary>
108+
/// 移除Pack
109+
/// </summary>
101110
public void RemovePack(ICopyPastePack pack)
102111
{
103112
CopyPasteNode removeNode = null;

Assets/Emilia/Node.Editor/Core/CopyPaste/CopyPasteNode.cs

+12
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,27 @@
44

55
namespace Emilia.Node.Editor
66
{
7+
/// <summary>
8+
/// 拷贝粘贴节点
9+
/// </summary>
710
[Serializable]
811
public class CopyPasteNode
912
{
13+
/// <summary>
14+
/// 自身
15+
/// </summary>
1016
[OdinSerialize, NonSerialized]
1117
public ICopyPastePack pack;
1218

19+
/// <summary>
20+
/// 输出方向所有节点
21+
/// </summary>
1322
[OdinSerialize, NonSerialized]
1423
public List<CopyPasteNode> output;
1524

25+
/// <summary>
26+
/// 输入方向所有节点
27+
/// </summary>
1628
[OdinSerialize, NonSerialized]
1729
public List<CopyPasteNode> input;
1830

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
namespace Emilia.Node.Editor
22
{
3+
/// <summary>
4+
/// 拷贝粘贴包
5+
/// </summary>
36
public interface ICopyPastePack
47
{
8+
/// <summary>
9+
/// 判断pack是否是自己的依赖
10+
/// </summary>
511
bool CanDependency(ICopyPastePack pack);
612

13+
/// <summary>
14+
/// 粘贴
15+
/// </summary>
716
void Paste(CopyPasteContext copyPasteContext);
817
}
918
}

Assets/Emilia/Node.Editor/Core/Element/Edge/EditorEdgeAsset.cs

+18
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,45 @@ public class EditorEdgeAsset : TitleAsset, IGraphAsset
3333

3434
public override string title => "Edge";
3535

36+
/// <summary>
37+
/// Id 唯一标识
38+
/// </summary>
3639
public string id
3740
{
3841
get => _id;
3942
set => _id = value;
4043
}
4144

45+
/// <summary>
46+
/// 输出节点ID
47+
/// </summary>
4248
public string outputNodeId
4349
{
4450
get => _outputNodeId;
4551
set => _outputNodeId = value;
4652
}
4753

54+
/// <summary>
55+
/// 输入节点ID
56+
/// </summary>
4857
public string inputNodeId
4958
{
5059
get => _inputNodeId;
5160
set => _inputNodeId = value;
5261
}
5362

63+
/// <summary>
64+
/// 输出端口ID
65+
/// </summary>
5466
public string outputPortId
5567
{
5668
get => _outputPortId;
5769
set => _outputPortId = value;
5870
}
5971

72+
/// <summary>
73+
/// 输入端口ID
74+
/// </summary>
6075
public string inputPortId
6176
{
6277
get => _inputPortId;
@@ -69,6 +84,9 @@ public object userData
6984
set => _userData = value;
7085
}
7186

87+
/// <summary>
88+
/// Odin属性树
89+
/// </summary>
7290
public PropertyTree propertyTree => _propertyTree;
7391

7492
protected virtual void OnEnable()

Assets/Emilia/Node.Editor/Core/Element/Edge/EditorEdgeAttribute.cs

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Emilia.Node.Editor
44
{
5+
/// <summary>
6+
/// 用于EditorEdgeView指定EditorEdgeAsset
7+
/// </summary>
58
[AttributeUsage(AttributeTargets.Class)]
69
public class EditorEdgeAttribute : Attribute
710
{

Assets/Emilia/Node.Editor/Core/Element/Edge/EditorEdgeConnector.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private void OnMouseDown(MouseDownEvent evt)
5959

6060
Port graphElement = target as Port;
6161
if (graphElement == null) return;
62-
62+
6363
downPosition = evt.localMousePosition;
6464

6565
this.edgeViewCandidate = ReflectUtility.CreateInstance(this.edgeViewType) as IEditorEdgeView;

Assets/Emilia/Node.Editor/Core/Element/Edge/EditorEdgeDragHelper.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public override bool HandleMouseDown(MouseDownEvent evt)
128128
}
129129
else
130130
{
131-
bool startFromOutput = draggedPortView.portDirection == EditorPortDirection.Output || draggedPortView.portDirection == EditorPortDirection.InputOutput;
131+
bool startFromOutput = draggedPortView.portDirection == EditorPortDirection.Output || draggedPortView.portDirection == EditorPortDirection.Any;
132132

133133
if (startFromOutput)
134134
{
@@ -250,13 +250,19 @@ public virtual Vector2 GetEffectivePanSpeed(Vector2 mousePos)
250250
{
251251
Vector2 effectiveSpeed = Vector2.zero;
252252

253-
if (mousePos.x <= PanAreaWidth) { effectiveSpeed.x = -((PanAreaWidth - mousePos.x) / PanAreaWidth + 0.5f) * PanSpeed; }
253+
if (mousePos.x <= PanAreaWidth)
254+
{
255+
effectiveSpeed.x = -((PanAreaWidth - mousePos.x) / PanAreaWidth + 0.5f) * PanSpeed;
256+
}
254257
else if (mousePos.x >= this.graphView.contentContainer.layout.width - PanAreaWidth)
255258
{
256259
effectiveSpeed.x = ((mousePos.x - (this.graphView.contentContainer.layout.width - PanAreaWidth)) / PanAreaWidth + 0.5f) * PanSpeed;
257260
}
258261

259-
if (mousePos.y <= PanAreaWidth) { effectiveSpeed.y = -((PanAreaWidth - mousePos.y) / PanAreaWidth + 0.5f) * PanSpeed; }
262+
if (mousePos.y <= PanAreaWidth)
263+
{
264+
effectiveSpeed.y = -((PanAreaWidth - mousePos.y) / PanAreaWidth + 0.5f) * PanSpeed;
265+
}
260266
else if (mousePos.y >= graphView.contentContainer.layout.height - PanAreaWidth)
261267
{
262268
effectiveSpeed.y = ((mousePos.y - (this.graphView.contentContainer.layout.height - PanAreaWidth)) / PanAreaWidth + 0.5f) * PanSpeed;

Assets/Emilia/Node.Editor/Core/Element/Edge/EditorEdgeView.cs

+6
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ public virtual void Initialize(EditorGraphView graphView, EditorEdgeAsset asset)
8383
schedule.Execute(OnValueChanged).ExecuteLater(1);
8484
}
8585

86+
/// <summary>
87+
/// 根据比例获取点
88+
/// </summary>
8689
public Vector2 GetPointByRate(float rate)
8790
{
8891
float length = 0;
@@ -128,6 +131,9 @@ protected override EdgeControl CreateEdgeControl()
128131
return _editorEdgeControl;
129132
}
130133

134+
/// <summary>
135+
/// 强制更新EdgeControl
136+
/// </summary>
131137
public void ForceUpdateEdgeControl()
132138
{
133139
if (inputPortView != null) editorEdgeControl.to = this.WorldToLocal(inputPortView.portElement.GetGlobalCenter());

Assets/Emilia/Node.Editor/Core/Element/Edge/IEditorEdgeView.cs

+24
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,43 @@ namespace Emilia.Node.Editor
44
{
55
public interface IEditorEdgeView : IDeleteGraphElement, IRemoveViewElement, IGraphCopyPasteElement, ISelectableGraphElement
66
{
7+
/// <summary>
8+
/// 资产
9+
/// </summary>
710
EditorEdgeAsset asset { get; }
11+
812
EditorGraphView graphView { get; }
913

14+
/// <summary>
15+
/// Input端口
16+
/// </summary>
1017
IEditorPortView inputPortView { get; set; }
18+
19+
/// <summary>
20+
/// Output端口
21+
/// </summary>
1122
IEditorPortView outputPortView { get; set; }
1223

24+
/// <summary>
25+
/// 是否正在拖拽
26+
/// </summary>
1327
bool isDrag { get; set; }
28+
1429
Edge edgeElement { get; }
1530

31+
/// <summary>
32+
/// 初始化
33+
/// </summary>
1634
void Initialize(EditorGraphView graphView, EditorEdgeAsset asset);
1735

36+
/// <summary>
37+
/// 值改变
38+
/// </summary>
1839
void OnValueChanged();
1940

41+
/// <summary>
42+
/// 释放
43+
/// </summary>
2044
void Dispose();
2145
}
2246
}

Assets/Emilia/Node.Editor/Core/Element/GraphContentZoomer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void OnWheel(WheelEvent evt)
102102

103103
Vector3 position = graphView.logicPosition;
104104
Vector3 scale = graphView.logicScale;
105-
105+
106106
Vector2 zoomCenter = target.ChangeCoordinatesTo(graphView.contentViewContainer, evt.localMousePosition);
107107
float x = zoomCenter.x + graphView.contentViewContainer.layout.x;
108108
float y = zoomCenter.y + graphView.contentViewContainer.layout.y;

Assets/Emilia/Node.Editor/Core/Element/Item/EditorItemAsset.cs

+6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ public abstract class EditorItemAsset : TitleAsset, IGraphAsset
1919
[NonSerialized]
2020
private PropertyTree _propertyTree;
2121

22+
/// <summary>
23+
/// Id
24+
/// </summary>
2225
public string id
2326
{
2427
get => this._id;
2528
set => this._id = value;
2629
}
2730

31+
/// <summary>
32+
/// 位置
33+
/// </summary>
2834
public Rect position
2935
{
3036
get => this._position;

Assets/Emilia/Node.Editor/Core/Element/Item/EditorItemAttribute.cs

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Emilia.Node.Attributes
44
{
5+
/// <summary>
6+
/// 用于EditorItemView指定EditorItemAsset
7+
/// </summary>
58
[AttributeUsage(AttributeTargets.Class)]
69
public class EditorItemAttribute : Attribute
710
{

Assets/Emilia/Node.Editor/Core/Element/Item/IEditorItemView.cs

+20-1
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,37 @@ namespace Emilia.Node.Editor
55
{
66
public interface IEditorItemView : IDeleteGraphElement, IRemoveViewElement, IGraphCopyPasteElement, ISelectableGraphElement
77
{
8+
/// <summary>
9+
/// 资产
10+
/// </summary>
811
EditorItemAsset asset { get; }
912

1013
GraphElement element { get; }
1114

15+
/// <summary>
16+
/// 初始化
17+
/// </summary>
1218
void Initialize(EditorGraphView graphView, EditorItemAsset asset);
1319

20+
/// <summary>
21+
/// 设置位置
22+
/// </summary>
23+
/// <param name="position"></param>
1424
void SetPosition(Rect position);
1525

26+
/// <summary>
27+
/// 设置位置,不记录撤销
28+
/// </summary>
1629
void SetPositionNoUndo(Rect position);
17-
30+
31+
/// <summary>
32+
/// 值改变
33+
/// </summary>
1834
void OnValueChanged();
1935

36+
/// <summary>
37+
/// 释放
38+
/// </summary>
2039
void Dispose();
2140
}
2241
}

Assets/Emilia/Node.Editor/Core/Element/Node/EditorNodeAsset.cs

+6
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@ public class EditorNodeAsset : TitleAsset, IGraphAsset
2424

2525
public override string title => "Node";
2626

27+
/// <summary>
28+
/// Id
29+
/// </summary>
2730
public string id
2831
{
2932
get => _id;
3033
set => _id = value;
3134
}
3235

36+
/// <summary>
37+
/// 位置
38+
/// </summary>
3339
public Rect position
3440
{
3541
get => _position;

Assets/Emilia/Node.Editor/Core/Element/Node/EditorNodeAttribute.cs

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Emilia.Node.Attributes
44
{
5+
/// <summary>
6+
/// 用于EditorNodeView指定EditorNodeAsset
7+
/// </summary>
58
[AttributeUsage(AttributeTargets.Class)]
69
public class EditorNodeAttribute : Attribute
710
{

Assets/Emilia/Node.Editor/Core/Element/Node/EditorNodeInputPortEditInfo.cs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace Emilia.Node.Editor
22
{
3+
/// <summary>
4+
/// 端口展开编辑InputPort
5+
/// </summary>
36
public struct EditorNodeInputPortEditInfo
47
{
58
public string portName;

0 commit comments

Comments
 (0)