SVG spritesheets
An .svg spritesheet loads through lunasvg (now part of the core library) at one pixel per SVG unit, so regions, crops and picking work as for PNGs. The preview, renders and CLI draw it again, cached per power-of-two zoom level up to 8x, so it stays sharp when zoomed or scaled. Its pixels aren't edited (pencil, eraser, pack and merge leave it alone, and Save skips it), and the Isaac warning counts SVG sheets since the game can't load them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b31a28ebe9
commit
a917d8ae97
21 files changed
+178
-21
No files matched your search
@@ -20,6 +20,14 @@ namespace anm2ed::model
|
||||
frame.rotation, math::percent_to_unit(frame.skew));
|
||||
}
|
||||
|
||||
// How many canvas pixels one spritesheet pixel of a layer draw covers (along its longer axis).
|
||||
float draw_scale_get(const Draw& draw)
|
||||
{
|
||||
auto model = draw.parent * draw_quad_model_get(draw);
|
||||
auto size = glm::max(draw.frame.size, glm::vec2(1.0f));
|
||||
return std::max(glm::length(glm::vec2(model[0])) / size.x, glm::length(glm::vec2(model[1])) / size.y);
|
||||
}
|
||||
|
||||
// When an item is drawn: now, and for each sample its time if the track has a frame there.
|
||||
std::vector<std::pair<int, float>> draw_times_get(const Animation& animation, const Track& track,
|
||||
const DrawOptions& options)
|
||||
|
||||
@@ -53,5 +53,6 @@ namespace anm2ed::model
|
||||
};
|
||||
|
||||
glm::mat4 draw_quad_model_get(const Draw&);
|
||||
float draw_scale_get(const Draw&);
|
||||
std::vector<Draw> animation_draws_get(const Model&, const Animation&, const DrawOptions&);
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "file.hpp"
|
||||
#include "frames.hpp"
|
||||
#include "image.hpp"
|
||||
#include "math.hpp"
|
||||
#include "path.hpp"
|
||||
#include "time.hpp"
|
||||
@@ -1373,6 +1374,9 @@ namespace anm2ed::model
|
||||
{
|
||||
IsaacIssues issues{};
|
||||
issues.animationLayers = (int)std::ranges::count_if(model.content.layers, &Layer::is_animation);
|
||||
issues.vectorSpritesheets =
|
||||
(int)std::ranges::count_if(model.content.spritesheets, [](const Spritesheet& spritesheet)
|
||||
{ return path::is_extension(spritesheet.path, resource::image::SVG_EXTENSION); });
|
||||
for (auto [index, animation] : model.animations_get())
|
||||
{
|
||||
for (const auto* entries : {&animation->layers, &animation->nulls})
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace anm2ed::model
|
||||
int triggerSounds{};
|
||||
int extraEvents{};
|
||||
int animationLayers{};
|
||||
int vectorSpritesheets{};
|
||||
|
||||
bool operator==(const IsaacIssues&) const = default;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user