Skip to content

Commit c186164

Browse files
committed
Add ToString overrides for HalfEdgeMesh handle types
I kept ToString() to just the index so it stays a low-level identity string. Higher-level tools can add whatever labeling or context they need
1 parent d334eb9 commit c186164

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

engine/Sandbox.Engine/Scene/Components/Mesh/HalfEdgeMesh/HalfEdgeMesh.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ public HalfEdgeHandle Edge
7272
get => new( Mesh is null ? -1 : Mesh[this].Edge, Mesh );
7373
set => Mesh?.SetVertexEdge( this, value );
7474
}
75+
76+
public override string ToString()
77+
=> Index >= 0 ? $"{Index}" : "Invalid Vertex";
7578
}
7679

7780
public sealed record FaceHandle : IHandle
@@ -93,6 +96,9 @@ public HalfEdgeHandle Edge
9396
get => new( Mesh is null ? -1 : Mesh[this].Edge, Mesh );
9497
set => Mesh?.SetFaceEdge( this, value );
9598
}
99+
100+
public override string ToString()
101+
=> Index >= 0 ? $"{Index}" : "Invalid Face";
96102
}
97103

98104
public sealed record HalfEdgeHandle : IHandle
@@ -132,6 +138,9 @@ public FaceHandle Face
132138
get => new( Mesh is null ? -1 : Mesh[this].Face, Mesh );
133139
set => Mesh?.SetEdgeFace( this, value );
134140
}
141+
142+
public override string ToString()
143+
=> Index >= 0 ? $"{Index}" : "Invalid Edge";
135144
}
136145

137146
internal sealed partial class Mesh

0 commit comments

Comments
 (0)