mirror of
https://github.com/leozide/leocad.git
synced 2026-10-27 06:20:55 +00:00
Full before-and-after model snapshots accumulate large amounts of memory during editing, even when an operation changes only one object. Compact completed edits to retain only added, removed, or modified object states, with ordering metadata kept only for structural changes. Restore objects by stable IDs, including group relationships, and detach views before removing cameras. Compose merged edits from their deltas and compare animation keys as well as current property values so keyframe-only edits remain undoable.
50 lines
898 B
C++
50 lines
898 B
C++
#pragma once
|
|
|
|
#define LC_MAX_GROUP_NAME 64
|
|
|
|
enum class lcGroupId : uint32_t;
|
|
|
|
constexpr uint32_t LC_GROUP_ID_INVALID = std::numeric_limits<uint32_t>::max();
|
|
|
|
struct lcGroupHistoryState
|
|
{
|
|
lcGroupId Id;
|
|
uint32_t ParentId;
|
|
QString Name;
|
|
|
|
bool operator==(const lcGroupHistoryState& Other) const
|
|
{
|
|
return Id == Other.Id && ParentId == Other.ParentId && Name == Other.Name;
|
|
}
|
|
};
|
|
|
|
class lcGroup
|
|
{
|
|
public:
|
|
lcGroup();
|
|
|
|
lcGroup* GetTopGroup()
|
|
{
|
|
return mGroup ? mGroup->GetTopGroup() : this;
|
|
}
|
|
|
|
lcGroupId GetId() const
|
|
{
|
|
return mId;
|
|
}
|
|
|
|
void FileLoad(lcFile* File);
|
|
void CreateName(const std::vector<std::unique_ptr<lcGroup>>& Groups);
|
|
|
|
lcGroupHistoryState GetHistoryState() const;
|
|
void SetHistoryState(const lcGroupHistoryState& State, lcGroup* Parent);
|
|
|
|
lcGroup* mGroup = nullptr;
|
|
QString mName;
|
|
|
|
protected:
|
|
lcGroupId mId = static_cast<lcGroupId>(0);
|
|
|
|
static lcGroupId mNextId;
|
|
};
|