Stage 4: one uid-based Selection for the timeline and animations list
- Selection { map<kind, set<uid>> uids; Handle focus; } (src/selection.*, core)
replaces Document::reference, the frames/items/animation Storages,
groupReferences, and the timeline's selection snapshot/lock/focus state.
- Because selection is by uid it follows elements through edits by itself;
after an edit or undo, selection_follow only drops removed uids and moves a
removed focus to its nearest survivor. The Stage 2 handle capture/re-resolve,
frames_reference_normalize_for, frames_selection_sync_for and the index-based
frame validity repair are gone.
- Document keeps a UidIndex (rebuilt on every change) and exposes
reference_get/reference_set, selected_get/selected_set(kind),
frame_references_get/set and animations_selected_get/set.
- UidIndex records each uid's element type.
- The animations list keeps its ImGui multi-select Storage as a per-frame mirror
of the Selection; content windows are unchanged until Stage 8.
- tests/selection.cpp and tests/undo.cpp cover selection through inserts,
reverses, deletes, item and animation removal, regrouping and undo.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
700b613c62
commit
65a3546c3b
29 files changed
+484
-608
No files matched your search
@@ -48,10 +48,10 @@ namespace anm2ed::imgui
|
||||
{
|
||||
auto& document = *manager.get();
|
||||
auto frameSelectionCount = document.frame_references_get(Document::FrameReferenceFallback::NONE).size();
|
||||
if (frameSelectionCount == 0 && document.reference.frameIndex >= 0) frameSelectionCount = 1;
|
||||
if (frameSelectionCount == 0 && document.reference_get().frameIndex >= 0) frameSelectionCount = 1;
|
||||
auto isSingleFrameSelection = frameSelectionCount == 1;
|
||||
auto isMultiFrameSelection = frameSelectionCount > 1;
|
||||
auto isSingleFrameBatchMode = isSingleFrameSelection && document.reference.itemType != TRIGGER && isBatchMode;
|
||||
auto isSingleFrameBatchMode = isSingleFrameSelection && document.reference_get().itemType != TRIGGER && isBatchMode;
|
||||
auto isBatchFrameProperties = isMultiFrameSelection || isSingleFrameBatchMode;
|
||||
auto windowLabel = std::string(
|
||||
localize.get(isBatchFrameProperties ? LABEL_CHANGE_ALL_FRAME_PROPERTIES : LABEL_FRAME_PROPERTIES_WINDOW));
|
||||
@@ -60,7 +60,7 @@ namespace anm2ed::imgui
|
||||
if (ImGui::Begin(windowLabel.c_str(), &settings.windowIsFrameProperties))
|
||||
{
|
||||
auto& anm2 = document.anm2;
|
||||
auto& reference = document.reference;
|
||||
auto reference = document.reference_get();
|
||||
auto& type = reference.itemType;
|
||||
auto frame = reference.frameIndex >= 0 ? anm2.element_get(reference) : nullptr;
|
||||
|
||||
@@ -138,8 +138,10 @@ namespace anm2ed::imgui
|
||||
frame.atFrame = atFrame;
|
||||
if (!item) return;
|
||||
frames_sort_by_at_frame(*item);
|
||||
document.reference.frameIndex = frame_index_from_at_frame_get(*item, atFrame);
|
||||
document.frame_references_set({document.reference});
|
||||
auto reference = document.reference_get();
|
||||
reference.frameIndex = frame_index_from_at_frame_get(*item, atFrame);
|
||||
document.reference_set(reference);
|
||||
document.frame_references_set({reference});
|
||||
});
|
||||
}
|
||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_TRIGGER_AT_FRAME));
|
||||
|
||||
Reference in new issue
Block a user