Stage 5: content-hash AssetStore; undo records asset keys, not pixels

- resource::AssetStore (core) keeps immutable images and sounds keyed by content
  hash for the life of the document; nothing is purged until it closes.
- Undo state holds spritesheet/sound id -> asset key maps (always tracked), so
  every edit can undo texture changes; the textures-only snapshot flag
  (edit_begin(label, true) / push(message, isTextures)) and the pixel/audio
  equality helpers are gone.
- Document::texture_get/sound_get read through the store; texture_set/sound_set
  add assets; texture_edit gives the pencil a private draft that becomes a new
  asset on the next change().
- Spritesheet dirty state compares path + asset key instead of hashing pixels.
- Preview audio reads sounds through the store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-03 15:53:34 -04:00
1 parent 65a3546c3b
commit 9f43a210c5
13 files changed
+195 -130

No files matched your search

+59 -44
View File
@@ -129,17 +129,10 @@ namespace anm2ed::document
std::string element_name_get(const Element& element) { return element.name; }
template <class Resource>
void resource_load(int id, const std::filesystem::path& path, std::map<int, Resource>& resources,
std::unordered_map<int, std::filesystem::path>& paths)
{
resources[id] = Resource(path::case_insensitive_find(path));
paths[id] = path;
}
template <class Resource>
void resources_sync(Document& document, ElementType type, std::map<int, Resource>& resources,
std::unordered_map<int, std::filesystem::path>& paths)
// Loads assets for elements that are new or whose path changed, and forgets those of removed elements.
template <class Load>
void resources_sync(Document& document, ElementType type, std::map<int, std::uint64_t>& keys,
std::unordered_map<int, std::filesystem::path>& paths, Load&& load)
{
std::set<int> validIds{};
util::WorkingDirectory workingDirectory(document.directory_get());
@@ -149,28 +142,22 @@ namespace anm2ed::document
if (element.type != type) continue;
validIds.insert(element.id);
auto path = paths.find(element.id);
if (!resources.contains(element.id) || path == paths.end() || path->second != element.path)
resource_load(element.id, element.path, resources, paths);
if (!keys.contains(element.id) || path == paths.end() || path->second != element.path)
{
load(element.id, path::case_insensitive_find(element.path));
paths[element.id] = element.path;
}
}
std::erase_if(resources, [&](const auto& pair) { return !validIds.contains(pair.first); });
std::erase_if(keys, [&](const auto& pair) { return !validIds.contains(pair.first); });
std::erase_if(paths, [&](const auto& pair) { return !validIds.contains(pair.first); });
}
uint64_t spritesheet_hash_get(const Element& spritesheet, const resource::Image* texture)
// A spritesheet is dirty when its path or image asset differs from what was last saved.
uint64_t spritesheet_hash_get(const Element& spritesheet, std::uint64_t imageKey)
{
std::size_t seed{};
auto hash_combine = [&](std::size_t value) { seed ^= value + HASH_COMBINE_CONSTANT + (seed << 6) + (seed >> 2); };
hash_combine(std::hash<int>{}(texture ? texture->size.x : 0));
hash_combine(std::hash<int>{}(texture ? texture->size.y : 0));
hash_combine(std::hash<bool>{}(texture && texture->isLinear));
hash_combine(std::hash<std::string>{}(path::to_utf8(spritesheet.path)));
auto isPixels = texture && !texture->pixels.empty();
hash_combine(isPixels ? std::hash<std::string_view>{}(std::string_view(
reinterpret_cast<const char*>(texture->pixels.data()), texture->pixels.size()))
: 0);
return static_cast<uint64_t>(seed);
auto seed = std::hash<std::string>{}(path::to_utf8(spritesheet.path));
return seed ^ (imageKey + HASH_COMBINE_CONSTANT + (seed << 6) + (seed >> 2));
}
Reference item_reference_get(Reference reference)
@@ -272,7 +259,8 @@ namespace anm2ed
auto spritesheet = anm2.element_get(ElementType::SPRITESHEET, id);
if (!spritesheet) return false;
util::WorkingDirectory workingDirectory(directory_get());
document::resource_load(id, spritesheet->path, textures, texturePaths);
texture_set(id, resource::Image(path::case_insensitive_find(spritesheet->path)));
texturePaths[id] = spritesheet->path;
return true;
}
@@ -281,7 +269,8 @@ namespace anm2ed
auto sound = anm2.element_get(ElementType::SOUND_ELEMENT, id);
if (!sound) return false;
util::WorkingDirectory workingDirectory(directory_get());
document::resource_load(id, sound->path, sounds, soundPaths);
sound_set(id, resource::AudioData(path::case_insensitive_find(sound->path)));
soundPaths[id] = sound->path;
return true;
}
@@ -335,8 +324,13 @@ namespace anm2ed
void Document::assets_sync(ChangeType type)
{
if (type == ALL || type == SPRITESHEETS || type == TEXTURES)
document::resources_sync(*this, ElementType::SPRITESHEET, textures, texturePaths);
if (type == ALL || type == SOUNDS) document::resources_sync(*this, ElementType::SOUND_ELEMENT, sounds, soundPaths);
document::resources_sync(*this, ElementType::SPRITESHEET, textures, texturePaths,
[&](int id, const std::filesystem::path& path)
{ texture_set(id, resource::Image(path)); });
if (type == ALL || type == SOUNDS)
document::resources_sync(*this, ElementType::SOUND_ELEMENT, sounds, soundPaths,
[&](int id, const std::filesystem::path& path)
{ sound_set(id, resource::AudioData(path)); });
if (type != ALL && type != SHADERS) return;
std::set<int> validShaderIds{};
@@ -368,18 +362,35 @@ namespace anm2ed
std::erase_if(shaderFragmentPaths, is_invalid);
}
resource::Image* Document::texture_get(int id)
const resource::Image* Document::texture_get(int id) const
{
auto it = textures.find(id);
return it == textures.end() ? nullptr : &it->second;
if (auto draft = textureDrafts.find(id); draft != textureDrafts.end()) return &draft->second;
auto key = textures.find(id);
return key == textures.end() ? nullptr : assets.image_get(key->second);
}
resource::AudioData* Document::sound_get(int id)
// A private copy of the spritesheet's image to draw on; it becomes a new asset on the next change().
resource::Image* Document::texture_edit(int id)
{
auto it = sounds.find(id);
return it == sounds.end() ? nullptr : &it->second;
auto texture = texture_get(id);
if (!texture) return nullptr;
return &textureDrafts.try_emplace(id, *texture).first->second;
}
void Document::texture_set(int id, resource::Image image)
{
textureDrafts.erase(id);
textures[id] = assets.image_add(std::move(image));
}
const resource::AudioData* Document::sound_get(int id) const
{
auto key = sounds.find(id);
return key == sounds.end() ? nullptr : assets.audio_get(key->second);
}
void Document::sound_set(int id, resource::AudioData data) { sounds[id] = assets.audio_add(std::move(data)); }
resource::Shader* Document::shader_get(int shaderId)
{
auto it = shaders.find(shaderId);
@@ -498,7 +509,7 @@ namespace anm2ed
}
}
textures[id] = resource::Image(packedPixels.data(), packedSize);
texture_set(id, resource::Image(packedPixels.data(), packedSize));
for (auto& region : spritesheet->children)
if (region.type == ElementType::REGION && crops.contains(region.id)) region.crop = crops.at(region.id);
@@ -554,7 +565,7 @@ namespace anm2ed
regionIdMap[id][sourceRegionId] = sourceRegion.id;
}
}
textures[baseId] = std::move(mergedTexture);
texture_set(baseId, std::move(mergedTexture));
std::unordered_map<int, int> layerSpritesheetBefore{};
if (auto layers = anm2.element_get(ElementType::LAYERS))
@@ -614,7 +625,8 @@ namespace anm2ed
if (spritesheet.type == ElementType::SPRITESHEET)
{
validIds.insert(spritesheet.id);
auto currentHash = document::spritesheet_hash_get(spritesheet, texture_get(spritesheet.id));
auto currentHash = document::spritesheet_hash_get(
spritesheet, textures.contains(spritesheet.id) ? textures.at(spritesheet.id) : 0);
spritesheetHashes[spritesheet.id] = currentHash;
spritesheetSaveHashes.try_emplace(spritesheet.id, currentHash);
}
@@ -626,6 +638,8 @@ namespace anm2ed
void Document::change(ChangeType type)
{
for (auto& [id, draft] : std::exchange(textureDrafts, {}))
textures[id] = assets.image_add(std::move(draft));
hash_set();
assets_sync(type);
@@ -712,7 +726,7 @@ namespace anm2ed
index = UidIndex(anm2);
}
void Document::edit_begin(StringType label, bool isTextures) { snapshots.push(localize.get(label), isTextures); }
void Document::edit_begin(StringType label) { snapshots.push(localize.get(label)); }
edit::Uids Document::edit_run(StringType label, ChangeType type, const std::function<edit::Uids(Anm2&)>& operation)
{
@@ -739,7 +753,7 @@ namespace anm2ed
auto spritesheet = anm2.element_get(ElementType::SPRITESHEET, id);
if (!spritesheet) return;
assets_sync(TEXTURES);
spritesheetHashes[id] = document::spritesheet_hash_get(*spritesheet, texture_get(id));
spritesheetHashes[id] = document::spritesheet_hash_get(*spritesheet, textures.contains(id) ? textures.at(id) : 0);
}
void Document::spritesheet_hash_set_saved(int id)
@@ -914,7 +928,7 @@ namespace anm2ed
auto& element = items->children.emplace_back(element_make(ElementType::SPRITESHEET));
element.id = element_child_next_id_get(*items, ElementType::SPRITESHEET);
element.path = relativePath;
textures[element.id] = std::move(texture);
texture_set(element.id, std::move(texture));
texturePaths[element.id] = element.path;
added.insert(element.id);
spritesheet.reference = element.id;
@@ -940,7 +954,8 @@ namespace anm2ed
element.id = element_child_next_id_get(*items, ElementType::SOUND_ELEMENT);
element.path = path::backslash_replace(path::make_relative(path::backslash_handle(path), directory_get()));
WorkingDirectory workingDirectory(directory_get());
document::resource_load(element.id, element.path, sounds, soundPaths);
sound_set(element.id, resource::AudioData(path::case_insensitive_find(element.path)));
soundPaths[element.id] = element.path;
added.insert(element.id);
sound.reference = element.id;
toast_log(Level::INFO, TOAST_SOUND_INITIALIZED, element.id, path::to_utf8(element.path));
+9 -4
View File
@@ -9,6 +9,7 @@
#include <unordered_map>
#include <vector>
#include "asset_store.hpp"
#include "edit/edit.hpp"
#include "selection.hpp"
#include "snapshots.hpp"
@@ -32,6 +33,8 @@ namespace anm2ed
Snapshots snapshots{};
std::map<int, Storage> regionBySpritesheet{};
Storage animation{};
resource::AssetStore assets{};
std::map<int, resource::Image> textureDrafts{};
int changeAllFramePropertiesRegionId{-1};
int changeAllFramePropertiesShaderId{-1};
@@ -97,7 +100,6 @@ namespace anm2ed
Snapshot& current = snapshots.current;
#define X(type, name) type& name = current.name;
SNAPSHOT_STEP_STATE_FIELDS
SNAPSHOT_STEP_RESOURCE_FIELDS
#undef X
Anm2& anm2 = current.anm2;
std::string& message = current.message;
@@ -115,8 +117,11 @@ namespace anm2ed
bool texture_reload(int);
bool sound_reload(int);
bool shader_reload(int, std::string* = nullptr);
resource::Image* texture_get(int);
resource::AudioData* sound_get(int);
const resource::Image* texture_get(int) const;
resource::Image* texture_edit(int);
void texture_set(int, resource::Image);
const resource::AudioData* sound_get(int) const;
void sound_set(int, resource::AudioData);
resource::Shader* shader_get(int);
bool regions_trim(int, const std::set<int>&);
bool spritesheet_pack(int, int);
@@ -124,7 +129,7 @@ namespace anm2ed
void hash_set();
void clean();
void change(ChangeType);
void edit_begin(StringType, bool = false);
void edit_begin(StringType);
edit::Uids edit_run(StringType, ChangeType, const std::function<edit::Uids(Anm2&)>&);
// Snapshots for undo, runs the operation on the model, then commits; void operations select nothing.
+13 -9
View File
@@ -210,7 +210,13 @@ namespace anm2ed::imgui
return document.sound_get(soundID) ? soundID : -1;
}
bool render_audio_stream_generate(AudioStream& audioStream, std::map<int, AudioData>& sounds,
void sounds_detach(const Document& document, MIX_Mixer* mixer)
{
for (auto& [id, _] : document.sounds)
if (auto sound = document.sound_get(id)) audio::track_detach(*sound, mixer);
}
bool render_audio_stream_generate(AudioStream& audioStream, const Document& document,
const std::vector<int>& frameSoundIDs, int fps)
{
audioStream.stream.clear();
@@ -229,7 +235,7 @@ namespace anm2ed::imgui
for (auto soundID : frameSoundIDs)
{
if (soundID != -1 && sounds.contains(soundID)) audio::play(sounds.at(soundID), false, mixer);
if (auto sound = document.sound_get(soundID)) audio::play(*sound, false, mixer);
sampleFrameAccumulator += framesPerStep;
auto sampleFramesToGenerate = (int)std::floor(sampleFrameAccumulator);
@@ -239,8 +245,7 @@ namespace anm2ed::imgui
frameBuffer.resize((std::size_t)sampleFramesToGenerate * (std::size_t)channels);
if (!MIX_Generate(mixer, frameBuffer.data(), (int)(frameBuffer.size() * sizeof(float))))
{
for (auto& [_, sound] : sounds)
audio::track_detach(sound, mixer);
sounds_detach(document, mixer);
MIX_DestroyMixer(mixer);
audioStream.stream.clear();
return false;
@@ -249,8 +254,7 @@ namespace anm2ed::imgui
audioStream.stream.insert(audioStream.stream.end(), frameBuffer.begin(), frameBuffer.end());
}
for (auto& [_, sound] : sounds)
audio::track_detach(sound, mixer);
sounds_detach(document, mixer);
MIX_DestroyMixer(mixer);
return true;
}
@@ -268,8 +272,8 @@ namespace anm2ed::imgui
auto stop_all_sounds = [&]()
{
for (auto& [_, sound] : document.sounds)
audio::stop(sound, mixer);
for (auto& [id, _] : document.sounds)
if (auto sound = document.sound_get(id)) audio::stop(*sound, mixer);
};
if (manager.isRecording)
@@ -367,7 +371,7 @@ namespace anm2ed::imgui
{
if (settings.timelineIsSound && type != render::GIF)
{
if (!render_audio_stream_generate(audioStream, document.sounds, renderFrameSoundIDs, renderFrameRate))
if (!render_audio_stream_generate(audioStream, document, renderFrameSoundIDs, renderFrameRate))
{
toasts.push(localize.get(TOAST_EXPORT_RENDERED_ANIMATION_FAILED));
logger.error("Failed to generate deterministic render audio stream; exporting without audio.");
+2 -2
View File
@@ -133,7 +133,7 @@ namespace anm2ed::imgui
if (options.isMakeSpritesheet || options.isRemoveCurrent)
{
document.edit_begin(EDIT_EXPORT_REGION, true);
document.edit_begin(EDIT_EXPORT_REGION);
if (options.isMakeSpritesheet)
{
@@ -150,7 +150,7 @@ namespace anm2ed::imgui
exported.children.push_back(exportedRegion);
spritesheets->children.push_back(exported);
document.textures[exported.id] = Image(pixels.data(), exportSize);
document.texture_set(exported.id, Image(pixels.data(), exportSize));
document.texturePaths[exported.id] = exported.path;
document.spritesheet.reference = exported.id;
document.spritesheet.selection = {exported.id};
+6 -7
View File
@@ -359,10 +359,10 @@ namespace anm2ed::imgui
auto fraction = current - glm::floor(current);
return glm::floor(value) + fraction;
};
auto edit_begin_push = [&](StringType label, bool isTextures = false)
auto edit_begin_push = [&](StringType label)
{
manager.command_push({manager.selected, [label, isTextures](Manager&, Document& document)
{ document.edit_begin(label, isTextures); }});
manager.command_push(
{manager.selected, [label](Manager&, Document& document) { document.edit_begin(label); }});
};
auto document_change_push = [&](Document::ChangeType changeType)
{
@@ -542,9 +542,8 @@ namespace anm2ed::imgui
auto queuedSpritesheet = referenceSpritesheet;
manager.command_push({manager.selected, [=](Manager&, Document& document)
{
auto texture = document.texture_get(queuedSpritesheet);
if (!texture) return;
texture->pixel_line(start, end, color);
if (auto texture = document.texture_edit(queuedSpritesheet))
texture->pixel_line(start, end, color);
}});
};
auto texture_change_push = [&]()
@@ -819,7 +818,7 @@ namespace anm2ed::imgui
{
if (!texture) break;
auto color = useTool == tool::DRAW ? toolColor : vec4();
if (isMouseClicked) edit_begin_push(useTool == tool::DRAW ? EDIT_DRAW : EDIT_ERASE, true);
if (isMouseClicked) edit_begin_push(useTool == tool::DRAW ? EDIT_DRAW : EDIT_ERASE);
if (isMouseDown) texture_line_apply(ivec2(previousTextureMousePos), ivec2(textureMousePos), color);
if (isMouseReleased) texture_change_push();
break;
+1 -1
View File
@@ -80,7 +80,7 @@ namespace anm2ed::imgui
void spritesheet_textures_edit(Document& document, StringType edit, Document::ChangeType changeType,
const std::function<bool()>& behavior, StringType successToast, StringType failToast)
{
document.edit_begin(edit, true);
document.edit_begin(edit);
auto isSuccess = behavior();
toast_log(isSuccess ? Level::INFO : Level::ERROR, isSuccess ? successToast : failToast);
document.change(changeType);
+1 -1
View File
@@ -66,7 +66,7 @@ namespace anm2ed::imgui
struct WindowCardImage
{
resource::Image* texture{};
const resource::Image* texture{};
glm::vec2 size{};
glm::vec2 uvMin{};
glm::vec2 uvMax{1.0f};
+52
View File
@@ -0,0 +1,52 @@
#include "asset_store.hpp"
#include <span>
namespace anm2ed::resource
{
constexpr std::uint64_t FNV_OFFSET = 14695981039346656037ull;
constexpr std::uint64_t FNV_PRIME = 1099511628211ull;
std::uint64_t bytes_hash(std::span<const std::uint8_t> bytes, std::uint64_t hash = FNV_OFFSET)
{
for (auto byte : bytes)
hash = (hash ^ byte) * FNV_PRIME;
return hash;
}
template <class Value> std::span<const std::uint8_t> value_bytes_get(const Value& value)
{
return {reinterpret_cast<const std::uint8_t*>(&value), sizeof(value)};
}
// Content hash; 0 stays free to mean "no asset".
std::uint64_t hash_finish(std::uint64_t hash) { return hash ? hash : 1; }
std::uint64_t AssetStore::image_add(Image image)
{
auto hash = bytes_hash(value_bytes_get(image.size));
hash = bytes_hash(value_bytes_get(image.isLinear), hash);
hash = hash_finish(bytes_hash(image.pixels, hash));
images.try_emplace(hash, std::move(image));
return hash;
}
std::uint64_t AssetStore::audio_add(AudioData data)
{
auto hash = hash_finish(bytes_hash(data.bytes));
audio.try_emplace(hash, std::move(data));
return hash;
}
const Image* AssetStore::image_get(std::uint64_t hash) const
{
auto it = images.find(hash);
return it == images.end() ? nullptr : &it->second;
}
const AudioData* AssetStore::audio_get(std::uint64_t hash) const
{
auto it = audio.find(hash);
return it == audio.end() ? nullptr : &it->second;
}
}
+24
View File
@@ -0,0 +1,24 @@
#pragma once
#include <cstdint>
#include <unordered_map>
#include "audio_data.hpp"
#include "image.hpp"
namespace anm2ed::resource
{
// Immutable images and sounds keyed by content hash. Undo history records keys, never pixels or bytes, and
// entries live until the document closes so any step can be restored.
class AssetStore
{
std::unordered_map<std::uint64_t, Image> images{};
std::unordered_map<std::uint64_t, AudioData> audio{};
public:
std::uint64_t image_add(Image);
std::uint64_t audio_add(AudioData);
const Image* image_get(std::uint64_t) const;
const AudioData* audio_get(std::uint64_t) const;
};
}
+1 -48
View File
@@ -26,51 +26,12 @@ namespace anm2ed::snapshots
left.references == right.references;
}
bool is_texture_equal(const resource::Image& left, const resource::Image& right)
{
return left.uid == right.uid ||
(left.size == right.size && left.isLinear == right.isLinear && left.pixels == right.pixels);
}
bool is_audio_equal(const resource::AudioData& left, const resource::AudioData& right)
{
return left.is_valid() == right.is_valid();
}
template <typename T, typename Compare>
bool is_map_equal(const std::map<int, T>& left, const std::map<int, T>& right, Compare compare)
{
if (left.size() != right.size()) return false;
auto leftIt = left.begin();
auto rightIt = right.begin();
while (leftIt != left.end() && rightIt != right.end())
{
if (leftIt->first != rightIt->first) return false;
if (!compare(leftIt->second, rightIt->second)) return false;
++leftIt;
++rightIt;
}
return leftIt == left.end() && rightIt == right.end();
}
template <typename T> bool is_value_equal(const T& left, const T& right) { return left == right; }
bool is_value_equal(const Playback& left, const Playback& right) { return is_playback_equal(left, right); }
bool is_value_equal(const Storage& left, const Storage& right) { return is_storage_equal(left, right); }
bool is_value_equal(const std::map<int, resource::Image>& left, const std::map<int, resource::Image>& right)
{
return is_map_equal(left, right, is_texture_equal);
}
bool is_value_equal(const std::map<int, resource::AudioData>& left, const std::map<int, resource::AudioData>& right)
{
return is_map_equal(left, right, is_audio_equal);
}
bool is_element_shallow_equal(const Element& left, const Element& right)
{
return left.type == right.type && left.tag == right.tag && left.name == right.name &&
@@ -202,7 +163,6 @@ namespace anm2ed
#define X(type, name) \
if (this->name) return false;
SNAPSHOT_STEP_STATE_FIELDS
SNAPSHOT_STEP_RESOURCE_FIELDS
#undef X
return true;
@@ -216,7 +176,6 @@ namespace anm2ed
#define X(type, name) \
if (this->name) snapshot.name = direction == SnapshotStepDirection::UNDO ? this->name->undo : this->name->redo;
SNAPSHOT_STEP_STATE_FIELDS
SNAPSHOT_STEP_RESOURCE_FIELDS
#undef X
}
@@ -268,12 +227,7 @@ namespace anm2ed
pendingStep = step.is_empty() ? std::nullopt : std::optional<SnapshotStep>(std::move(step));
}
void Snapshots::push(const std::string& message, bool isTextures)
{
auto step = snapshots::step_anm2_make(current);
if (isTextures) step.textures = SnapshotStepValue<SnapshotTextureMap>{current.textures, {}};
step_push(message, std::move(step));
}
void Snapshots::push(const std::string& message) { step_push(message, snapshots::step_anm2_make(current)); }
void Snapshots::commit()
{
@@ -321,7 +275,6 @@ namespace anm2ed
if (snapshots::is_value_equal(step.name->undo, step.name->redo)) step.name.reset(); \
}
SNAPSHOT_STEP_STATE_FIELDS
SNAPSHOT_STEP_RESOURCE_FIELDS
#undef X
if (step.is_empty()) return;
+7 -13
View File
@@ -7,8 +7,6 @@
#include <vector>
#include "anm2/anm2.hpp"
#include "audio_data.hpp"
#include "image.hpp"
#include "playback.hpp"
#include "selection.hpp"
#include "storage.hpp"
@@ -61,16 +59,15 @@ namespace anm2ed
Storage shader{};
Storage sound{};
Storage spritesheet{};
std::map<int, resource::Image> textures{};
std::map<int, resource::AudioData> sounds{};
std::map<int, std::uint64_t> textures{};
std::map<int, std::uint64_t> sounds{};
Anm2 anm2{};
Selection selection{};
float frameTime{};
std::string message = snapshots::ACTION;
};
using SnapshotTextureMap = std::map<int, resource::Image>;
using SnapshotSoundMap = std::map<int, resource::AudioData>;
using AssetKeys = std::map<int, std::uint64_t>;
#define SNAPSHOT_STEP_STATE_FIELDS \
X(Playback, playback) \
@@ -83,11 +80,9 @@ namespace anm2ed
X(Storage, sound) \
X(Storage, spritesheet) \
X(Selection, selection) \
X(float, frameTime)
#define SNAPSHOT_STEP_RESOURCE_FIELDS \
X(SnapshotTextureMap, textures) \
X(SnapshotSoundMap, sounds)
X(float, frameTime) \
X(AssetKeys, textures) \
X(AssetKeys, sounds)
struct SnapshotStep
{
@@ -96,7 +91,6 @@ namespace anm2ed
#define X(type, name) std::optional<SnapshotStepValue<type>> name{};
SNAPSHOT_STEP_STATE_FIELDS
SNAPSHOT_STEP_RESOURCE_FIELDS
#undef X
bool is_empty() const;
@@ -131,7 +125,7 @@ namespace anm2ed
std::optional<SnapshotStep> pendingStep{};
std::optional<Reference> pendingFocus{};
void push(const std::string&, bool = false);
void push(const std::string&);
void step_push(const std::string&, SnapshotStep);
void commit();
bool undo();