diff --git a/LibBSP/Source/Structs/BSP/StaticModel.cs b/LibBSP/Source/Structs/BSP/StaticModel.cs
index ae5fd50..cc82553 100644
--- a/LibBSP/Source/Structs/BSP/StaticModel.cs
+++ b/LibBSP/Source/Structs/BSP/StaticModel.cs
@@ -171,6 +171,44 @@ namespace LibBSP {
Parent = parent;
}
+ ///
+ /// Creates a new by copying the fields in , using
+ /// to get and
+ /// to use when creating the new .
+ /// If the 's 's is different from
+ /// the one from , it does not matter, because fields are copied by name.
+ ///
+ /// The to copy.
+ ///
+ /// The to use as the of the new .
+ /// Use null to use the 's instead.
+ ///
+ public StaticModel(StaticModel source, ILump parent = null) {
+ Parent = parent;
+
+ if (parent != null && parent.Bsp != null) {
+ if (source.Parent != null && source.Parent.Bsp != null && source.Parent.Bsp.version == parent.Bsp.version && source.LumpVersion == parent.LumpInfo.version) {
+ Data = new byte[source.Data.Length];
+ Array.Copy(source.Data, Data, source.Data.Length);
+ return;
+ } else {
+ Data = new byte[GetStructLength(parent.Bsp.version, parent.LumpInfo.version)];
+ }
+ } else {
+ if (source.Parent != null && source.Parent.Bsp != null) {
+ Data = new byte[GetStructLength(source.Parent.Bsp.version, source.Parent.LumpInfo.version)];
+ } else {
+ Data = new byte[GetStructLength(MapType.Undefined, 0)];
+ }
+ }
+
+ Data = source.Data;
+ Name = source.Name;
+ Origin = source.Origin;
+ Angles = source.Angles;
+ Scale = source.Scale;
+ }
+
///
/// Factory method to parse a byte array into a .
///