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:
1 parent
65a3546c3b
commit
9f43a210c5
13 files changed
+195
-130
No files matched your search
@@ -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};
|
||||
|
||||
Reference in new issue
Block a user