Stage 10a: delete dead code, merge tiny files, unify duplicated concepts
- Dead code: util/map, util/unordered_map, unused vector/math/string/input helpers, Document getters, special-interpolation bake leftovers, triggers_sort, SnapshotStack::max_size_get, AudioStream capture API. - Merges: util/xml, util/string, resource/strings.cpp inlined; constants into input.hpp; tooltip into layout; Recorder into render; onionskin, tools, welcome and frame properties are panel functions; timeline popups.cpp folded into timeline.cpp. - util/origin.hpp replaced by model Origin (the merge setting stays a combo index, so saved preferences keep their meaning). - Item type names/icons/colors moved from model/common.hpp to the timeline header; the model no longer includes icon/strings headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4d16f21541
commit
4c569cb1e5
60 files changed
+605
-1021
No files matched your search
@@ -7,8 +7,6 @@
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include "icon.hpp"
|
||||
#include "strings.hpp"
|
||||
#include "types.hpp"
|
||||
|
||||
#define ANM2_ELEMENT_TYPES \
|
||||
@@ -106,59 +104,6 @@ namespace anm2ed
|
||||
inline constexpr int APPEND_RIGHT = (int)SpritesheetMergeOrigin::APPEND_RIGHT;
|
||||
inline constexpr int APPEND_BOTTOM = (int)SpritesheetMergeOrigin::APPEND_BOTTOM;
|
||||
|
||||
inline const glm::vec4 ROOT_COLOR = glm::vec4(0.140f, 0.310f, 0.560f, 1.000f);
|
||||
inline const glm::vec4 ROOT_COLOR_ACTIVE = glm::vec4(0.240f, 0.520f, 0.880f, 1.000f);
|
||||
inline const glm::vec4 ROOT_COLOR_HOVERED = glm::vec4(0.320f, 0.640f, 1.000f, 1.000f);
|
||||
|
||||
inline const glm::vec4 LAYER_COLOR = glm::vec4(0.640f, 0.320f, 0.110f, 1.000f);
|
||||
inline const glm::vec4 LAYER_COLOR_ACTIVE = glm::vec4(0.840f, 0.450f, 0.170f, 1.000f);
|
||||
inline const glm::vec4 LAYER_COLOR_HOVERED = glm::vec4(0.960f, 0.560f, 0.240f, 1.000f);
|
||||
|
||||
inline const glm::vec4 NULL_COLOR = glm::vec4(0.140f, 0.430f, 0.200f, 1.000f);
|
||||
inline const glm::vec4 NULL_COLOR_ACTIVE = glm::vec4(0.250f, 0.650f, 0.350f, 1.000f);
|
||||
inline const glm::vec4 NULL_COLOR_HOVERED = glm::vec4(0.350f, 0.800f, 0.480f, 1.000f);
|
||||
|
||||
inline const glm::vec4 TRIGGER_COLOR = glm::vec4(0.620f, 0.150f, 0.260f, 1.000f);
|
||||
inline const glm::vec4 TRIGGER_COLOR_ACTIVE = glm::vec4(0.820f, 0.250f, 0.380f, 1.000f);
|
||||
inline const glm::vec4 TRIGGER_COLOR_HOVERED = glm::vec4(0.950f, 0.330f, 0.490f, 1.000f);
|
||||
|
||||
#define ANM2_ITEM_TYPES \
|
||||
X(NONE, STRING_UNDEFINED, resource::icon::NONE, glm::vec4(), glm::vec4(), glm::vec4()) \
|
||||
X(ROOT, BASIC_ROOT, resource::icon::ROOT, ROOT_COLOR, ROOT_COLOR_ACTIVE, ROOT_COLOR_HOVERED) \
|
||||
X(LAYER, BASIC_LAYER_ANIMATION, resource::icon::LAYER, LAYER_COLOR, LAYER_COLOR_ACTIVE, LAYER_COLOR_HOVERED) \
|
||||
X(NULL_, BASIC_NULL_ANIMATION, resource::icon::NULL_, NULL_COLOR, NULL_COLOR_ACTIVE, NULL_COLOR_HOVERED) \
|
||||
X(TRIGGER, BASIC_TRIGGERS, resource::icon::TRIGGERS, TRIGGER_COLOR, TRIGGER_COLOR_ACTIVE, TRIGGER_COLOR_HOVERED)
|
||||
|
||||
constexpr StringType TYPE_STRINGS[] = {
|
||||
#define X(symbol, string, icon, color, colorActive, colorHovered) string,
|
||||
ANM2_ITEM_TYPES
|
||||
#undef X
|
||||
};
|
||||
|
||||
constexpr resource::icon::Type TYPE_ICONS[] = {
|
||||
#define X(symbol, string, icon, color, colorActive, colorHovered) icon,
|
||||
ANM2_ITEM_TYPES
|
||||
#undef X
|
||||
};
|
||||
|
||||
inline const glm::vec4 TYPE_COLOR[] = {
|
||||
#define X(symbol, string, icon, color, colorActive, colorHovered) color,
|
||||
ANM2_ITEM_TYPES
|
||||
#undef X
|
||||
};
|
||||
|
||||
inline const glm::vec4 TYPE_COLOR_ACTIVE[] = {
|
||||
#define X(symbol, string, icon, color, colorActive, colorHovered) colorActive,
|
||||
ANM2_ITEM_TYPES
|
||||
#undef X
|
||||
};
|
||||
|
||||
inline const glm::vec4 TYPE_COLOR_HOVERED[] = {
|
||||
#define X(symbol, string, icon, color, colorActive, colorHovered) colorHovered,
|
||||
ANM2_ITEM_TYPES
|
||||
#undef X
|
||||
};
|
||||
|
||||
enum class RegionFrameMapping
|
||||
{
|
||||
PRESERVE,
|
||||
|
||||
@@ -203,24 +203,6 @@ namespace anm2ed::model
|
||||
}
|
||||
}
|
||||
|
||||
// Bakes every ease-in/ease-out frame (not linear ones) in every track into single-step frames.
|
||||
void special_interpolated_frames_bake(Model& model, int interval, bool isRoundScale, bool isRoundRotation)
|
||||
{
|
||||
for (int i = 0; i < model.animations_count_get(); ++i)
|
||||
animation_tracks_each(*model.animation_edit(i),
|
||||
[&](Track& track)
|
||||
{
|
||||
if (track.type == ItemType::TRIGGER) return;
|
||||
for (int index = (int)track.frames.size() - 1; index >= 0; --index)
|
||||
{
|
||||
auto interpolation = track.frames[index].interpolation;
|
||||
if (interpolation == Interpolation::NONE || interpolation == Interpolation::LINEAR)
|
||||
continue;
|
||||
frame_bake(track, index, interval, isRoundScale, isRoundRotation);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Bounds of all visible layer frames over the animation's length, or -1 when nothing is drawn.
|
||||
glm::vec4 animation_rect(const Model& model, const Animation& animation, bool isRootTransform)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,5 @@ namespace anm2ed::model
|
||||
void frames_generate_from_grid(Track&, glm::ivec2, glm::ivec2, glm::vec2, int, int, int);
|
||||
void frames_sort_by_at_frame(Track&);
|
||||
void frames_change(Track&, FrameChange, ItemType, ChangeType, const std::set<int>&);
|
||||
void special_interpolated_frames_bake(Model&, int, bool, bool);
|
||||
glm::vec4 animation_rect(const Model&, const Animation&, bool);
|
||||
}
|
||||
+3
-19
@@ -13,7 +13,6 @@
|
||||
#include "math.hpp"
|
||||
#include "path.hpp"
|
||||
#include "time.hpp"
|
||||
#include "util/xml.hpp"
|
||||
|
||||
using namespace tinyxml2;
|
||||
using namespace anm2ed::util;
|
||||
@@ -1337,7 +1336,9 @@ namespace anm2ed::model
|
||||
{
|
||||
XMLDocument document{};
|
||||
document.InsertEndChild(element_write(document, node));
|
||||
return xml::document_to_string(document);
|
||||
XMLPrinter printer{};
|
||||
document.Print(&printer);
|
||||
return printer.CStr();
|
||||
}
|
||||
|
||||
void node_hash(std::uint64_t& hash, const XmlNode& node)
|
||||
@@ -1430,23 +1431,6 @@ namespace anm2ed::model
|
||||
return hash;
|
||||
}
|
||||
|
||||
bool is_special_interpolated_frames(const Model& model)
|
||||
{
|
||||
for (auto [index, animation] : model.animations_get())
|
||||
{
|
||||
bool isSpecial{};
|
||||
animation_tracks_each(*animation,
|
||||
[&](const Track& track)
|
||||
{
|
||||
for (const auto& frame : track.frames)
|
||||
isSpecial |=
|
||||
track.type != ItemType::TRIGGER && is_special_interpolation(frame.interpolation);
|
||||
});
|
||||
if (isSpecial) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string frame_to_string(const Frame& frame, ItemType type)
|
||||
{
|
||||
return node_to_string(frame_write(Writer(CLIPBOARD_FLAGS), frame, type));
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace anm2ed::model
|
||||
std::string model_to_string(const Model&, Options = {});
|
||||
std::string model_serialize(const Model&, Flags);
|
||||
std::uint64_t model_hash(const Model&);
|
||||
bool is_special_interpolated_frames(const Model&);
|
||||
|
||||
std::string frame_to_string(const Frame&, ItemType);
|
||||
std::string animation_to_string(const Animation&, int = -1);
|
||||
|
||||
Reference in new issue
Block a user