Skip to content

Commit 34cb05a

Browse files
authored
Merge pull request #5 from Angel-foxxo/master
small fixes
2 parents c3751bb + fc535df commit 34cb05a

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

AttributeList.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ public virtual object? this[string name]
273273
{
274274
var valueType = value.GetType();
275275

276-
// type must be equal, or a superclass
277-
if (prop.PropertyType != valueType && valueType.IsSubclassOf(prop.PropertyType))
276+
// types must be equal, or a superclass
277+
if (prop.PropertyType != typeof(Element) && valueType.IsSubclassOf(prop.PropertyType))
278278
{
279279
throw new InvalidDataException($"class property '{prop.Name}' with type '{prop.PropertyType}' does not match the type '{valueType}' of the value being set, this is likely a mismatch between the real class and the class from the datamodel");
280280
}

ICodec.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,11 @@ public static bool TryConstructCustomElement(Dictionary<string, Type> types, Dat
256256

257257
object uninitializedObject = RuntimeHelpers.GetUninitializedObject(derivedType);
258258

259-
elementConstructor.Invoke(uninitializedObject, [dataModel, elem_name, elem_id, elem_class]);
260-
261259
// this will initialize values such as
262260
// public Datamodel.ElementArray Children { get; } = [];
263261
customClassInitializer.Invoke(uninitializedObject, []);
264262

263+
elementConstructor.Invoke(uninitializedObject, [dataModel, elem_name, elem_id, elem_class]);
265264

266265
elem = (Element?)uninitializedObject;
267266
return true;

Tests/ValveMap.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ internal class CMapSelectionSet : DMElement
180180
{
181181
public Datamodel.ElementArray Children { get; } = [];
182182
public string SelectionSetName { get; set; } = string.Empty;
183-
public CObjectSelectionSetDataElement SelectionSetData { get; set; } = [];
183+
public DMElement SelectionSetData { get; set; } = [];
184184

185185
public CMapSelectionSet() { }
186186
public CMapSelectionSet(string name)
@@ -195,6 +195,12 @@ internal class CObjectSelectionSetDataElement : DMElement
195195
public Datamodel.ElementArray selectedObjects { get; set; } = [];
196196
}
197197

198+
internal class CFaceSelectionSetDataElement : DMElement
199+
{
200+
public Datamodel.IntArray faces { get; set; } = [];
201+
public Datamodel.ElementArray meshes { get; set; } = [];
202+
}
203+
198204

199205
internal class CMapEntity : BaseEntity
200206
{

0 commit comments

Comments
 (0)