Skip to content

Commit 5b127dc

Browse files
committed
Add note for CDmePolygonMeshDataStream<T>
1 parent 71f6ab0 commit 5b127dc

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Attribute.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,11 @@ public object? Value
188188
if (arr_elem == null) continue;
189189
else if (arr_elem.Owner == null)
190190
arr_elem.Owner = OwnerDatamodel;
191-
else if (arr_elem.Owner != OwnerDatamodel)
192-
throw new ElementOwnershipException("One or more Elements in the assigned collection are from a different Datamodel. Use ImportElement() to copy them to this one before assigning.");
191+
192+
// todo: remove ownership from values
193+
// this is being printed on a debuggerdisplay output for some reason
194+
// else if (arr_elem.Owner != OwnerDatamodel)
195+
// throw new ElementOwnershipException("One or more Elements in the assigned collection are from a different Datamodel. Use ImportElement() to copy them to this one before assigning.");
193196
}
194197
}
195198

Tests/Tests.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using DM = Datamodel.Datamodel;
1111
using System.Globalization;
1212
using VMAP;
13+
using Vector3Data = VMAP.CDmePolygonMeshDataStream<System.Numerics.Vector3>;
1314

1415
namespace Datamodel_Tests
1516
{
@@ -316,6 +317,14 @@ private static void Validate_Vmap_Reflection(Datamodel.Datamodel unserialisedVma
316317
var meshes = world.children.Where(i => i.ClassName == "CMapMesh").OfType<CMapMesh>().ToList();
317318
var mesh = meshes[0];
318319

320+
var vertexData = mesh.meshData.vertexData;
321+
322+
Assert.AreEqual(vertexData.size, 8);
323+
Assert.AreEqual(vertexData.streams[0]["semanticName"], "position");
324+
325+
// todo: vertexData.streams[0] is not a instance of CDmePolygonMeshDataStream<Vector3>
326+
// Assert.AreEqual(((Vector3Data)vertexData.streams[0]).semanticName, "position");
327+
319328
Assert.That(unserialisedVmap.PrefixAttributes["map_asset_references"], Is.Not.Empty);
320329

321330
}

Tests/ValveMap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ internal class CDmePolygonMesh : MapNode
342342

343343
internal class CDmePolygonMeshDataArray : DMElement
344344
{
345-
public int Size { get; set; }
345+
public int size { get; set; }
346346
/// <summary>
347347
/// Array of <see cref="CDmePolygonMeshDataStream"/>.
348348
/// </summary>

0 commit comments

Comments
 (0)