feat(editor): object save/load JSON, working duplicate, export objects

- Object placer save/load: objects.json persists placed M2/WMO objects
  across sessions (path, position, rotation, scale, type)
- Fixed Duplicate button in Object panel: now actually creates a copy
  with correct path/type/scale instead of being a no-op stub
- Export Zone now saves objects.json alongside ADT/WDT/creatures/manifest
- Object JSON loader parses all fields for full round-trip
This commit is contained in:
Kelsi 2026-05-05 05:14:03 -07:00
parent 8341fb6dc9
commit 8c9407e0f5
4 changed files with 104 additions and 5 deletions

View file

@ -565,12 +565,17 @@ void EditorUI::renderObjectPanel(EditorApp& app) {
ImGui::SameLine();
if (ImGui::Button("Delete", ImVec2(100, 0))) placer.deleteSelected();
if (ImGui::Button("Duplicate", ImVec2(100, 0))) {
PlacedObject copy = *sel;
copy.uniqueId = 0;
copy.position += glm::vec3(5.0f, 5.0f, 0.0f);
copy.selected = false;
std::string dupPath = sel->path;
glm::vec3 dupPos = sel->position + glm::vec3(10.0f, 10.0f, 0.0f);
glm::vec3 dupRot = sel->rotation;
float dupScale = sel->scale;
auto dupType = sel->type;
placer.clearSelection();
// Can't easily push from here, but move slightly signals intent
placer.setActivePath(dupPath, dupType);
placer.setPlacementScale(dupScale);
placer.setPlacementRotationY(dupRot.y);
placer.placeObject(dupPos);
app.markObjectsDirty();
}
ImGui::SameLine();
if (ImGui::Button("Deselect", ImVec2(100, 0)))