Frame Blur (Flash's blur filter), child properties in Change All Frame Properties, flips under Visible
Blur is a layer frame's box blur, as Flash's low-quality BlurFilter: a box that many canvas pixels wide, averaged over the frame's crop (premultiplied) by the texture shader, the quad grown by its reach. An animation layer blurs its child's draws at least as much. It interpolates, copies, batches (clamped to 0-255), saves as an editor-only Blur attribute and counts as an Isaac issue. Change All Frame Properties gains the Child section (animation, mode, start frame, random, restart), applied only to animation layers and disabled when no animation layer is targeted. Frame Properties' Flip X/Y sit below Visible instead of inside Child. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b6cd671f7
commit
0adb0f89bc
26 files changed
+308
-48
No files matched your search
@@ -105,6 +105,7 @@ namespace anm2ed
|
||||
inline constexpr int FPS_MIN = 1;
|
||||
inline constexpr int FPS_MAX = 120;
|
||||
inline constexpr int FRAME_DEPTH_MAX = 100;
|
||||
inline constexpr float FRAME_BLUR_MAX = 255.0f; // Flash's BlurFilter limit
|
||||
|
||||
enum class SpritesheetMergeOrigin
|
||||
{
|
||||
@@ -189,7 +190,8 @@ namespace anm2ed
|
||||
X(tintA, tint.a, false, true, changeIsTintA, changeTint.a) \
|
||||
X(colorOffsetR, colorOffset.r, false, true, changeIsColorOffsetR, changeColorOffset.r) \
|
||||
X(colorOffsetG, colorOffset.g, false, true, changeIsColorOffsetG, changeColorOffset.g) \
|
||||
X(colorOffsetB, colorOffset.b, false, true, changeIsColorOffsetB, changeColorOffset.b)
|
||||
X(colorOffsetB, colorOffset.b, false, true, changeIsColorOffsetB, changeColorOffset.b) \
|
||||
X(blur, blur, true, false, changeIsBlur, changeBlur)
|
||||
|
||||
struct FrameChange
|
||||
{
|
||||
@@ -204,6 +206,12 @@ namespace anm2ed
|
||||
std::optional<Interpolation> interpolation{};
|
||||
std::optional<bool> isFlipX{};
|
||||
std::optional<bool> isFlipY{};
|
||||
// An animation layer's child; a spritesheet layer's frames keep theirs.
|
||||
std::optional<std::string> childAnimation{};
|
||||
std::optional<ChildMode> childMode{};
|
||||
std::optional<int> childStart{};
|
||||
std::optional<bool> isChildStartRandom{};
|
||||
std::optional<bool> isChildRestart{};
|
||||
};
|
||||
|
||||
struct Reference
|
||||
|
||||
@@ -123,6 +123,7 @@ namespace anm2ed::model
|
||||
child.parent = transform * child.parent;
|
||||
child.frame.tint *= frame.tint;
|
||||
child.frame.colorOffset += frame.colorOffset;
|
||||
child.frame.blur = std::max(child.frame.blur, frame.blur); // Each part blurs on its own, as the game draws it.
|
||||
if (child.source != &model) child.frame.shaderId = -1;
|
||||
layerOrders.emplace_back(layerOrder + frame.depth, frame.depth);
|
||||
draws.push_back(std::move(child));
|
||||
|
||||
+10
-1
@@ -18,6 +18,7 @@ namespace anm2ed::model
|
||||
frame.skew = glm::mix(frame.skew, next.skew, amount);
|
||||
frame.colorOffset = glm::mix(frame.colorOffset, next.colorOffset, amount);
|
||||
frame.tint = glm::mix(frame.tint, next.tint, amount);
|
||||
frame.blur = glm::mix(frame.blur, next.blur, amount);
|
||||
}
|
||||
|
||||
// Splits an interpolated frame into uninterpolated frames of at most `interval`; the first keeps the frame's uid.
|
||||
@@ -170,7 +171,7 @@ namespace anm2ed::model
|
||||
}
|
||||
|
||||
void frames_change(Track& track, FrameChange change, ItemType itemType, ChangeType changeType,
|
||||
const std::set<int>& selection)
|
||||
const std::set<int>& selection, bool isAnimationLayer)
|
||||
{
|
||||
auto apply = [&](auto& target, const auto& optionalValue)
|
||||
{
|
||||
@@ -205,6 +206,14 @@ namespace anm2ed::model
|
||||
if (!isLayerOnly || itemType == ItemType::LAYER) apply(frame.member, change.name);
|
||||
FRAME_CHANGE_SCALARS
|
||||
#undef X
|
||||
frame.blur = std::clamp(frame.blur, 0.0f, FRAME_BLUR_MAX);
|
||||
if (!isAnimationLayer) continue;
|
||||
if (change.childAnimation) frame.childAnimation = *change.childAnimation;
|
||||
if (change.childMode) frame.childMode = *change.childMode;
|
||||
if (change.isChildStartRandom) frame.isChildStartRandom = *change.isChildStartRandom;
|
||||
if (change.isChildRestart) frame.isChildRestart = *change.isChildRestart;
|
||||
apply(frame.childStart, change.childStart);
|
||||
frame.childStart = std::clamp(frame.childStart, 0, FRAME_NUM_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,6 @@ namespace anm2ed::model
|
||||
void frame_bake(Track&, int, int, bool, bool);
|
||||
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 frames_change(Track&, FrameChange, ItemType, ChangeType, const std::set<int>&, bool isAnimationLayer = false);
|
||||
glm::vec4 animation_rect(const Model&, const Animation&, bool, const LibraryGet& = {});
|
||||
}
|
||||
@@ -55,6 +55,7 @@ namespace anm2ed::model
|
||||
int regionId{-1};
|
||||
int shaderId{-1};
|
||||
int depth{}; // a layer frame draws this many layers above (or below) its place in the timeline; editor-only
|
||||
float blur{}; // Flash's BlurFilter at quality 1: one box blur this many canvas pixels wide; editor-only
|
||||
// On an animation layer: the child animation (empty for the layer's own) and how it plays; editor-only.
|
||||
std::string childAnimation{};
|
||||
ChildMode childMode{ChildMode::LOOP};
|
||||
|
||||
+4
-1
@@ -41,7 +41,7 @@ namespace anm2ed::model
|
||||
"XPivot", "YPivot", "XCrop", "YCrop", "XPosition", "YPosition", "Width", "Height", "XScale", "YScale", "SkewX",
|
||||
"SkewY", "ShearX", "ShearY", "RedTint", "GreenTint", "BlueTint", "AlphaTint", "RedOffset", "GreenOffset", "BlueOffset",
|
||||
"Interpolated", "Origin", "BakeInterpolation", "BakeDelay", "BakeCount", "OriginalDelay", "Library", "Animation",
|
||||
"ChildAnimation", "ChildMode", "ChildStart", "Restart"};
|
||||
"ChildAnimation", "ChildMode", "ChildStart", "Restart", "Blur"};
|
||||
// clang-format on
|
||||
constexpr std::string_view SOURCE_DOCUMENT_TAG = "SourceDocument";
|
||||
constexpr std::string_view FRAME_RESTORE_TAG = "FrameRestore";
|
||||
@@ -223,6 +223,7 @@ namespace anm2ed::model
|
||||
frame.regionId = int_get(element, "RegionId");
|
||||
frame.shaderId = int_get(element, "ShaderId");
|
||||
frame.depth = int_get(element, "Depth", 0);
|
||||
frame.blur = float_get(element, "Blur");
|
||||
frame.childAnimation = string_get(element, "ChildAnimation");
|
||||
auto childMode = std::ranges::find(CHILD_MODE_VALUES, string_get(element, "ChildMode"));
|
||||
if (childMode != std::end(CHILD_MODE_VALUES))
|
||||
@@ -1169,6 +1170,7 @@ namespace anm2ed::model
|
||||
if (writer.is(SERIALIZE_EXTENSIONS) && type == ItemType::LAYER)
|
||||
{
|
||||
if (frame.depth != 0) sink.attribute("Depth", frame.depth);
|
||||
if (frame.blur != 0.0f) sink.attribute("Blur", frame.blur);
|
||||
if (!frame.childAnimation.empty()) sink.attribute("ChildAnimation", frame.childAnimation);
|
||||
if (frame.childMode != ChildMode::LOOP) sink.attribute("ChildMode", CHILD_MODE_VALUES[(int)frame.childMode]);
|
||||
if (frame.isChildStartRandom)
|
||||
@@ -1370,6 +1372,7 @@ namespace anm2ed::model
|
||||
issues.skewFrames += frame.skew != glm::vec2();
|
||||
issues.shaderFrames += frame.shaderId != -1;
|
||||
issues.depthFrames += track.type == ItemType::LAYER && frame.depth != 0;
|
||||
issues.blurFrames += track.type == ItemType::LAYER && frame.blur != 0.0f;
|
||||
issues.triggerSounds +=
|
||||
track.type == ItemType::TRIGGER &&
|
||||
std::ranges::any_of(frame.soundIds, [](int id) { return id != -1; });
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace anm2ed::model
|
||||
int skewFrames{};
|
||||
int shaderFrames{};
|
||||
int depthFrames{};
|
||||
int blurFrames{};
|
||||
int triggerSounds{};
|
||||
int animationLayers{};
|
||||
|
||||
|
||||
Reference in new issue
Block a user