Big refactor, shuffling a lot of files around

This commit is contained in:
2025-11-01 19:51:19 -04:00
parent 99b7d9f49d
commit 62cd94ca78
125 changed files with 4073 additions and 3011 deletions

View File

@@ -1,16 +1,9 @@
#include "snapshots.h"
namespace anm2ed::snapshots
{
namespace
{
void textures_ensure(anm2::Anm2& anm2)
{
for (auto& [id, spritesheet] : anm2.content.spritesheets)
spritesheet.texture.ensure_pixels();
}
}
using namespace anm2ed::snapshots;
namespace anm2ed
{
bool SnapshotStack::is_empty()
{
return top == 0;
@@ -40,7 +33,6 @@ namespace anm2ed::snapshots
void Snapshots::push(const anm2::Anm2& anm2, anm2::Reference reference, const std::string& message)
{
textures_ensure(const_cast<anm2::Anm2&>(anm2));
Snapshot snapshot = {anm2, reference, message};
undoStack.push(snapshot);
redoStack.clear();
@@ -50,10 +42,8 @@ namespace anm2ed::snapshots
{
if (auto current = undoStack.pop())
{
textures_ensure(anm2);
Snapshot snapshot = {anm2, reference, message};
redoStack.push(snapshot);
textures_ensure(current->anm2);
anm2 = current->anm2;
reference = current->reference;
message = current->message;
@@ -64,10 +54,8 @@ namespace anm2ed::snapshots
{
if (auto current = redoStack.pop())
{
textures_ensure(anm2);
Snapshot snapshot = {anm2, reference, message};
undoStack.push(snapshot);
textures_ensure(current->anm2);
anm2 = current->anm2;
reference = current->reference;
message = current->message;