#pragma once #include #include #include "model/model.h" enum class SelectionKind { ANIMATIONS, ANIMATION_GROUPS, TRACKS, GROUPS, FRAMES, SPRITESHEETS, REGIONS, SHADERS, LAYERS, NULLS, EVENTS, SOUNDS, LIBRARIES }; // What is selected, by element uid, plus the focused animation/track/frame. uids follow elements through edits, // so nothing here is repaired by index. The UI reads it as References through a UidIndex. struct Selection { std::map> uids; Handle focus = {}; std::map focuses; bool operator==(const Selection&) const = default; }; std::set selection_references_get(const Selection&, const UidIndex&, SelectionKind); void selection_references_set(Selection&, const Model&, SelectionKind, const std::set&); Reference selection_focus_get(const Selection&, const UidIndex&); void selection_focus_set(Selection&, const Model&, Reference); // Content items (spritesheets, regions of the focused spritesheet, shaders, layers, ...) are selected by uid and // read back as ids. std::set selection_ids_get(const Selection&, const Model&, SelectionKind); void selection_ids_set(Selection&, const Model&, SelectionKind, const std::set&); int selection_focus_id_get(const Selection&, const Model&, SelectionKind); void selection_focus_id_set(Selection&, const Model&, SelectionKind, int); void selection_follow(Selection&, const Model&, const UidIndex&, Reference);