Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/OpenApparatus.IO/Exporters/JsonExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ public static EnvironmentDocument BuildDocument(
Slot = o.Slot,
Position = new[] { o.Position.X, o.Position.Y, o.Position.Z },
Rotation = o.Rotation,
GlobalId = o.GlobalId,
TypeId = o.TypeId,
CustomId = o.CustomId,
Name = o.Name,
});
}
entry.Objects = objList;
Expand All @@ -193,6 +197,10 @@ public static EnvironmentDocument BuildDocument(
Slot = o.Slot,
Position = new[] { o.Position.X, o.Position.Y, o.Position.Z },
Rotation = o.Rotation,
GlobalId = o.GlobalId,
TypeId = o.TypeId,
CustomId = o.CustomId,
Name = o.Name,
});
}
if (outsideList != null)
Expand Down Expand Up @@ -360,6 +368,10 @@ public sealed class ObjectInstanceEntry
public int Slot { get; set; }
public float[] Position { get; set; } = System.Array.Empty<float>();
public float Rotation { get; set; }
public string GlobalId { get; set; } = "";
public string TypeId { get; set; } = "";
public string CustomId { get; set; } = "";
public string Name { get; set; } = "";
}

public sealed class ShapeSection
Expand Down
4 changes: 4 additions & 0 deletions src/OpenApparatus.IO/ProjectFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,8 @@ public sealed class ObjectInstanceEntry
public float Y { get; set; }
public float Z { get; set; }
public float Rotation { get; set; }
public string? GlobalId { get; set; }
public string? TypeId { get; set; }
public string? CustomId { get; set; }
public string? Name { get; set; }
}
14 changes: 14 additions & 0 deletions src/OpenApparatus.IO/RoomObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,27 @@ namespace OpenApparatus.IO;
/// re-evaluated on Rebuild() so an object whose room shrinks or moves is
/// reassigned to whatever room now contains its world position.
/// <see cref="Slot"/> is a 1-based index into the VM's ObjectTypes list.
///
/// <see cref="GlobalId"/>, <see cref="TypeId"/>, <see cref="CustomId"/> and
/// <see cref="Name"/> are user-editable identity strings. They get sensible
/// defaults at placement time but uniqueness is not enforced — two objects
/// may legitimately share any of them.
/// </summary>
public sealed class RoomObject
{
public int OwningRoomId { get; set; }
public int Slot { get; set; }
public Vector3 Position { get; set; }
public float Rotation { get; set; }

/// <summary>Per-apparatus running index, assigned at placement (0, 1, 2…).</summary>
public string GlobalId { get; set; } = "";
/// <summary>Per-type running index, assigned at placement (0, 1, 2… within the object's type).</summary>
public string TypeId { get; set; } = "";
/// <summary>Free-form identifier; defaults to "{GlobalId}_{TypeId}".</summary>
public string CustomId { get; set; } = "";
/// <summary>Display name; defaults to "{TypeName}_{GlobalId}_{TypeId}".</summary>
public string Name { get; set; } = "";
}

/// <summary>Shape primitive for object types. Procedural geometry is generated
Expand Down
Loading