Stage 6: Document::change() always refreshes derived data; ChangeType removed

change() now flushes drafts, re-syncs assets and shaders, rebuilds every label
list and the uid index, and commits. Document::ChangeType, the switch in
change(), the type parameter of edit_apply/edit_run/edit_push/assets_sync,
Window::changeType and every per-call change type (about 40 sites) are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-03 15:59:44 -04:00
1 parent 9f43a210c5
commit 2d0f70b1e5
25 files changed
+128 -202

No files matched your search

+5 -6
View File
@@ -173,7 +173,7 @@ namespace anm2ed::imgui
document.region.selection.clear();
}
}
document.change(Document::SPRITESHEETS);
document.change();
}
toast_log(Level::INFO, TOAST_EXPORT_REGION, sourceRegion.name, pathString);
@@ -218,7 +218,7 @@ namespace anm2ed::imgui
{
auto spritesheet = document.anm2.element_get(ElementType::SPRITESHEET, spritesheetId);
if (!spritesheet) return;
document.edit_apply(EDIT_MOVE_REGIONS, window.changeType,
document.edit_apply(EDIT_MOVE_REGIONS,
[&](Anm2&)
{
vector::move_indices_to_position(spritesheet->children, indices, targetIndex);
@@ -384,7 +384,6 @@ namespace anm2ed::imgui
Window window{};
window.title = LABEL_REGIONS_WINDOW;
window.isOpen = &Settings::windowIsRegions;
window.changeType = Document::SPRITESHEETS;
window.elementType = ElementType::REGION;
window.childLabel = "##Regions Child";
window.cardLines = REGION_CARD_LINES;
@@ -451,13 +450,13 @@ namespace anm2ed::imgui
};
window.remove_unused = [](Window& window, Manager&, Settings&, Document& document, Clipboard&)
{
document.edit_apply(EDIT_REMOVE_UNUSED_REGIONS, window.changeType, [&](Anm2& anm2)
document.edit_apply(EDIT_REMOVE_UNUSED_REGIONS, [&](Anm2& anm2)
{ return edit::regions_remove_unused(anm2, document.spritesheet.reference); });
};
window.trim = [](Window& window, Manager&, Settings&, Document& document, Clipboard&)
{
auto& region = document.region;
document.edit_apply(EDIT_TRIM_REGIONS, window.changeType,
document.edit_apply(EDIT_TRIM_REGIONS,
[&](Anm2&)
{
if (!document.regions_trim(document.spritesheet.reference, region.selection)) return;
@@ -473,7 +472,7 @@ namespace anm2ed::imgui
if (!spritesheet || clipboard.is_empty()) return;
auto maxIdBefore = element_child_max_id_get(*spritesheet, ElementType::REGION);
std::string errorString{};
document.edit_apply(EDIT_PASTE_REGIONS, window.changeType,
document.edit_apply(EDIT_PASTE_REGIONS,
[&](Anm2& anm2)
{
edit::regions_paste(anm2, document.spritesheet.reference, clipboard.get(),