Big refactor, shuffling a lot of files around
This commit is contained in:
@@ -3,24 +3,38 @@
|
||||
#include <filesystem>
|
||||
#include <set>
|
||||
|
||||
#include "anm2.h"
|
||||
#include "imgui.h"
|
||||
#include "anm2/anm2.h"
|
||||
#include "imgui_.h"
|
||||
#include "playback.h"
|
||||
#include "snapshots.h"
|
||||
#include "types.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace anm2ed::document
|
||||
namespace anm2ed
|
||||
{
|
||||
class Document
|
||||
{
|
||||
public:
|
||||
enum ChangeType
|
||||
{
|
||||
LAYERS,
|
||||
NULLS,
|
||||
SPRITESHEETS,
|
||||
EVENTS,
|
||||
ANIMATIONS,
|
||||
ITEMS,
|
||||
FRAMES,
|
||||
SOUNDS,
|
||||
ALL,
|
||||
COUNT
|
||||
};
|
||||
|
||||
std::filesystem::path path{};
|
||||
anm2::Anm2 anm2{};
|
||||
std::string message{};
|
||||
playback::Playback playback{};
|
||||
snapshots::Snapshots snapshots{};
|
||||
Playback playback{};
|
||||
Snapshots snapshots{};
|
||||
|
||||
float previewZoom{200};
|
||||
glm::vec2 previewPan{};
|
||||
@@ -34,6 +48,8 @@ namespace anm2ed::document
|
||||
int mergeTarget{-1};
|
||||
imgui::MultiSelectStorage animationMultiSelect;
|
||||
imgui::MultiSelectStorage animationMergeMultiSelect;
|
||||
std::vector<const char*> animationNamesCStr{};
|
||||
std::vector<std::string> animationNames{};
|
||||
|
||||
anm2::Reference hoveredFrame{anm2::REFERENCE_DEFAULT};
|
||||
|
||||
@@ -41,7 +57,7 @@ namespace anm2ed::document
|
||||
int hoveredSpritesheet{-1};
|
||||
std::set<int> unusedSpritesheetIDs{};
|
||||
std::vector<std::string> spritesheetNames{};
|
||||
std::vector<const char*> spritesheetNamesCstr{};
|
||||
std::vector<const char*> spritesheetNamesCStr{};
|
||||
imgui::MultiSelectStorage spritesheetMultiSelect;
|
||||
|
||||
int referenceLayer{-1};
|
||||
@@ -58,6 +74,15 @@ namespace anm2ed::document
|
||||
int hoveredEvent{-1};
|
||||
std::set<int> unusedEventIDs{};
|
||||
imgui::MultiSelectStorage eventMultiSelect;
|
||||
std::vector<const char*> eventNamesCStr{};
|
||||
std::vector<std::string> eventNames{};
|
||||
|
||||
int referenceSound{-1};
|
||||
int hoveredSound{-1};
|
||||
std::set<int> unusedSoundIDs{};
|
||||
imgui::MultiSelectStorage soundMultiSelect;
|
||||
std::vector<const char*> soundNamesCStr{};
|
||||
std::vector<std::string> soundNames{};
|
||||
|
||||
uint64_t hash{};
|
||||
uint64_t saveHash{};
|
||||
@@ -72,7 +97,7 @@ namespace anm2ed::document
|
||||
void hash_set();
|
||||
void clean();
|
||||
void on_change();
|
||||
void change(types::change::Type);
|
||||
void change(ChangeType);
|
||||
bool is_dirty();
|
||||
bool is_autosave_dirty();
|
||||
std::filesystem::path directory_get();
|
||||
@@ -81,7 +106,6 @@ namespace anm2ed::document
|
||||
|
||||
anm2::Frame* frame_get();
|
||||
void frames_add(anm2::Item* item);
|
||||
void frames_change();
|
||||
void frames_delete(anm2::Item* item);
|
||||
void frames_bake(int, bool, bool);
|
||||
void frame_crop_set(anm2::Frame*, glm::vec2);
|
||||
@@ -99,31 +123,35 @@ namespace anm2ed::document
|
||||
void frame_flip_y(anm2::Frame* frame);
|
||||
void frame_shorten();
|
||||
void frame_extend();
|
||||
void frames_change(anm2::FrameChange&, types::frame_change::Type, bool, int = -1);
|
||||
void frames_change(anm2::FrameChange&, anm2::ChangeType, bool, int = -1);
|
||||
void frames_deserialize(const std::string&);
|
||||
|
||||
anm2::Item* item_get();
|
||||
void item_add(anm2::Type, int, std::string&, types::locale::Type, int);
|
||||
void item_remove(anm2::Animation* animation);
|
||||
void item_remove(anm2::Animation*);
|
||||
void item_visible_toggle(anm2::Item*);
|
||||
|
||||
anm2::Spritesheet* spritesheet_get();
|
||||
void spritesheet_add(const std::string&);
|
||||
void spritesheets_deserialize(const std::string&, types::merge::Type);
|
||||
|
||||
void layer_set(anm2::Layer& layer);
|
||||
void layer_set(anm2::Layer&);
|
||||
void layers_remove_unused();
|
||||
void layers_deserialize(const std::string&, types::merge::Type);
|
||||
|
||||
void null_set(anm2::Null& null);
|
||||
void null_rect_toggle(anm2::Null& null);
|
||||
void null_set(anm2::Null&);
|
||||
void null_rect_toggle(anm2::Null&);
|
||||
void nulls_remove_unused();
|
||||
void nulls_deserialize(const std::string&, types::merge::Type);
|
||||
|
||||
void event_add();
|
||||
void event_set(anm2::Event&);
|
||||
void events_remove_unused();
|
||||
void events_deserialize(const std::string&, types::merge::Type);
|
||||
|
||||
void sound_add(const std::string& path);
|
||||
void sounds_remove_unused();
|
||||
void sounds_deserialize(const std::string& string, types::merge::Type);
|
||||
|
||||
void animation_add();
|
||||
void animation_set(int);
|
||||
void animation_duplicate();
|
||||
@@ -141,7 +169,19 @@ namespace anm2ed::document
|
||||
void undo();
|
||||
void redo();
|
||||
|
||||
bool is_undo();
|
||||
bool is_redo();
|
||||
bool is_able_to_undo();
|
||||
bool is_able_to_redo();
|
||||
};
|
||||
|
||||
#define DOCUMENT_SNAPSHOT(document, message) document.snapshot(message);
|
||||
#define DOCUMENT_CHANGE(document, changeType) document.change(changeType);
|
||||
|
||||
#define DOCUMENT_EDIT(document, message, changeType, body) \
|
||||
{ \
|
||||
\
|
||||
DOCUMENT_SNAPSHOT(document, message) \
|
||||
body; \
|
||||
DOCUMENT_CHANGE(document, changeType) \
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user