Files
ReSkate/Extension/Objects/ParkEditor/park_object_sets.h
T
tsullivan13andClaude Opus 5.5 d9bac524db Park editor: saved object sets; duplicate selections; group local axes
Sets: save a selection under a name and place it again anywhere, on any map.

- The library gets an OBJECTS / SETS switch. SETS saves the selected
  objects as a set and lists the saved sets to place or delete (Delete asks
  for a second press).
- A set is a park file in <profile>/object_sets/<name>.park.json, so it
  shares the park format, its 2 MB limit and its name rules. Positions are
  relative to the set's anchor: the middle of its footprint, at its lowest
  origin.
- Placing follows the cursor as one wire cube per object, on surfaces or
  the grid plane; the mouse wheel turns it by the angle step. A click
  pastes the whole set: one undo step, under the paste path's object and
  session limits. Sets with objects missing from the catalog cannot be
  placed.
- A placed or pasted group is then selected with the move gizmo.

Editing groups:

- Local axes work for multi-selections. A placed set's axes are the
  rotation it was placed with, plus every later turn; any other group uses
  its last selected object's rotation. Applying a moved group does not snap
  its own rotation to the angle grid.
- Duplicate (button or Ctrl+D) copies every selected object at its saved
  position, rotation and scale, one grid step along X, as one paste.
- On a server with object scaling off, pastes (sets, duplicates, Ctrl+V)
  are made at 1x.

Tests cover set storage (anchor, round trip, replace, names, damaged files,
delete), saving and placing a set through the UI (surface, wheel, one
paste, no live preview), selecting it with its own axes, moving it along
them, and duplicating with and without scaling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 09:02:41 -07:00

21 lines
1.1 KiB
C++

#pragma once
#include "Engine/Game/World/park_editor.h"
#include "Extension/Objects/object_placements.h"
#include <filesystem>
#include <string_view>
#include <vector>
// Saved object sets: a selection kept under a name and placed again later, on any map.
// Each set is a park file (park_document.h) in its own folder, so the format, the size limit
// and the name rules are the park's. Positions are relative to the set's anchor.
namespace dingosdk::editor {
inline constexpr std::size_t max_object_sets = 256;
// Moves the objects so the anchor (the middle of their footprint, at their lowest origin) is at 0.
profile::ObjectLayout anchored_set(profile::ObjectLayout objects);
void save_object_set(const std::filesystem::path &directory, std::string_view name, std::string_view map,
const profile::ObjectLayout &objects);
void remove_object_set(const std::filesystem::path &directory, std::string_view name);
// Every readable set, by name. A file that does not decode is left out.
std::vector<EditorObjectSet> load_object_sets(const std::filesystem::path &directory);
} // namespace dingosdk::editor