Fixes for exit confirmation when saved
This commit is contained in:
46
src/anm2.h
46
src/anm2.h
@@ -137,23 +137,31 @@ struct Anm2Spritesheet
|
||||
std::string path{};
|
||||
Texture texture;
|
||||
std::vector<u8> pixels;
|
||||
|
||||
auto operator<=>(const Anm2Spritesheet&) const = default;
|
||||
};
|
||||
|
||||
struct Anm2Layer
|
||||
{
|
||||
std::string name = "New Layer";
|
||||
s32 spritesheetID{};
|
||||
s32 spritesheetID{}
|
||||
|
||||
auto operator<=>(const Anm2Layer&) const = default;
|
||||
};
|
||||
|
||||
struct Anm2Null
|
||||
{
|
||||
std::string name = "New Null";
|
||||
bool isShowRect = false;
|
||||
|
||||
auto operator<=>(const Anm2Null&) const = default;
|
||||
};
|
||||
|
||||
struct Anm2Event
|
||||
{
|
||||
std::string name = "New Event";
|
||||
|
||||
auto operator<=>(const Anm2Event&) const = default;
|
||||
};
|
||||
|
||||
struct Anm2Frame
|
||||
@@ -171,27 +179,16 @@ struct Anm2Frame
|
||||
vec2 scale = {100, 100};
|
||||
vec3 offsetRGB = COLOR_OFFSET_NONE;
|
||||
vec4 tintRGBA = COLOR_OPAQUE;
|
||||
};
|
||||
|
||||
struct Anm2FrameChange
|
||||
{
|
||||
std::optional<bool> isVisible;
|
||||
std::optional<bool> isInterpolated;
|
||||
std::optional<f32> rotation;
|
||||
std::optional<s32> delay;
|
||||
std::optional<vec2> crop;
|
||||
std::optional<vec2> pivot;
|
||||
std::optional<vec2> position;
|
||||
std::optional<vec2> size;
|
||||
std::optional<vec2> scale;
|
||||
std::optional<vec3> offsetRGB;
|
||||
std::optional<vec4> tintRGBA;
|
||||
auto operator<=>(const Anm2Frame&) const = default;
|
||||
};
|
||||
|
||||
struct Anm2Item
|
||||
{
|
||||
bool isVisible = true;
|
||||
std::vector<Anm2Frame> frames;
|
||||
|
||||
auto operator<=>(const Anm2Item&) const = default;
|
||||
};
|
||||
|
||||
struct Anm2Animation
|
||||
@@ -204,6 +201,8 @@ struct Anm2Animation
|
||||
std::vector<s32> layerOrder;
|
||||
std::map<s32, Anm2Item> nullAnimations;
|
||||
Anm2Item triggers;
|
||||
|
||||
auto operator<=>(const Anm2Animation&) const = default;
|
||||
};
|
||||
|
||||
struct Anm2
|
||||
@@ -219,6 +218,8 @@ struct Anm2
|
||||
s32 defaultAnimationID = ID_NONE;
|
||||
s32 fps = ANM2_FPS_DEFAULT;
|
||||
s32 version{};
|
||||
|
||||
auto operator<=>(const Anm2&) const = default;
|
||||
};
|
||||
|
||||
struct Anm2Reference
|
||||
@@ -231,6 +232,21 @@ struct Anm2Reference
|
||||
auto operator<=>(const Anm2Reference&) const = default;
|
||||
};
|
||||
|
||||
struct Anm2FrameChange
|
||||
{
|
||||
std::optional<bool> isVisible;
|
||||
std::optional<bool> isInterpolated;
|
||||
std::optional<f32> rotation;
|
||||
std::optional<s32> delay;
|
||||
std::optional<vec2> crop;
|
||||
std::optional<vec2> pivot;
|
||||
std::optional<vec2> position;
|
||||
std::optional<vec2> size;
|
||||
std::optional<vec2> scale;
|
||||
std::optional<vec3> offsetRGB;
|
||||
std::optional<vec4> tintRGBA;
|
||||
};
|
||||
|
||||
enum Anm2MergeType
|
||||
{
|
||||
ANM2_MERGE_APPEND_FRAMES,
|
||||
|
@@ -3012,6 +3012,8 @@ void imgui_init
|
||||
self->window = window;
|
||||
self->glContext = glContext;
|
||||
|
||||
self->saveAnm2 = *anm2;
|
||||
|
||||
ImGui::CreateContext();
|
||||
ImGui::StyleColorsDark();
|
||||
|
||||
@@ -3032,6 +3034,7 @@ void imgui_init
|
||||
if (!SETTINGS_HOTKEY_MEMBERS[i]) continue;
|
||||
imgui_hotkey_chord_registry()[i] = imgui_chord_from_string_get(*&(self->settings->*SETTINGS_HOTKEY_MEMBERS[i]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void imgui_update(Imgui* self)
|
||||
|
@@ -209,6 +209,7 @@ struct Imgui
|
||||
ImguiPopupType pendingPopupType = IMGUI_POPUP_NONE;
|
||||
ImVec2 pendingPopupPosition{};
|
||||
std::vector<ImguiLogItem> log;
|
||||
Anm2 saveAnm2;
|
||||
SDL_SystemCursor cursor;
|
||||
SDL_SystemCursor pendingCursor;
|
||||
bool isCursorSet = false;
|
||||
@@ -217,7 +218,6 @@ struct Imgui
|
||||
bool isTryQuit = false;
|
||||
};
|
||||
|
||||
|
||||
static inline void imgui_snapshot(Imgui* self, const std::string& action = SNAPSHOT_ACTION)
|
||||
{
|
||||
self->snapshots->action = action;
|
||||
@@ -252,6 +252,8 @@ static inline void imgui_file_save(Imgui* self)
|
||||
anm2_serialize(self->anm2, self->anm2->path);
|
||||
imgui_log_push(self, std::format(IMGUI_LOG_FILE_SAVE_FORMAT, self->anm2->path));
|
||||
}
|
||||
|
||||
self->saveAnm2 = *self->anm2;
|
||||
}
|
||||
|
||||
static inline void imgui_file_new(Imgui* self)
|
||||
@@ -269,7 +271,7 @@ static inline void imgui_file_save_as(Imgui* self)
|
||||
|
||||
static inline void imgui_quit(Imgui* self)
|
||||
{
|
||||
if (!self->snapshots->undoStack.is_empty())
|
||||
if (self->saveAnm2 != *self->anm2)
|
||||
self->isTryQuit = true;
|
||||
else
|
||||
self->isQuit = true;
|
||||
|
@@ -13,6 +13,8 @@ struct Texture
|
||||
GLuint id = GL_ID_NONE;
|
||||
ivec2 size{};
|
||||
bool isInvalid = true;
|
||||
|
||||
auto operator<=>(const Texture&) const = default;
|
||||
};
|
||||
|
||||
bool texture_from_encoded_data_init(Texture* self, ivec2 size, const u8* data, u32 length);
|
||||
|
Reference in New Issue
Block a user