mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Fix exporting one tag without "play subtags/repeats" and changing its anidir (fix #4297)
This commit is contained in:
parent
45e74c7338
commit
a7d4c23af9
@ -195,6 +195,18 @@ doc::Tag* calculate_frames_sequence(const Site& site,
|
|||||||
SelectedFrames selFrames;
|
SelectedFrames selFrames;
|
||||||
tag = calculate_selected_frames(site, framesValue, selFrames);
|
tag = calculate_selected_frames(site, framesValue, selFrames);
|
||||||
framesSeq = FramesSequence(selFrames);
|
framesSeq = FramesSequence(selFrames);
|
||||||
|
switch (aniDir) {
|
||||||
|
case AniDir::REVERSE:
|
||||||
|
framesSeq = framesSeq.makeReverse();
|
||||||
|
break;
|
||||||
|
case AniDir::PING_PONG:
|
||||||
|
framesSeq = framesSeq.makePingPong();
|
||||||
|
break;
|
||||||
|
case AniDir::PING_PONG_REVERSE:
|
||||||
|
framesSeq = framesSeq.makeReverse();
|
||||||
|
framesSeq = framesSeq.makePingPong();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
frame_t start = 0;
|
frame_t start = 0;
|
||||||
|
@ -171,7 +171,7 @@ FramesSequence FramesSequence::makePingPong() const
|
|||||||
if (i == 0) reversedRange.toFrame+=step;
|
if (i == 0) reversedRange.toFrame+=step;
|
||||||
if (j == 0) reversedRange.fromFrame-=step;
|
if (j == 0) reversedRange.fromFrame-=step;
|
||||||
|
|
||||||
if (reversedRange.fromFrame != reversedRange.toFrame)
|
if (reversedRange != range)
|
||||||
newFrames.m_ranges.insert(
|
newFrames.m_ranges.insert(
|
||||||
newFrames.m_ranges.begin() + n,
|
newFrames.m_ranges.begin() + n,
|
||||||
reversedRange);
|
reversedRange);
|
||||||
|
@ -196,6 +196,33 @@ TEST(FramesSequence, MakeReverse)
|
|||||||
EXPECT_EQ(1, res[13]);
|
EXPECT_EQ(1, res[13]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(FramesSequence, MakePingPong)
|
||||||
|
{
|
||||||
|
FramesSequence f;
|
||||||
|
f.insert(1, 3);
|
||||||
|
EXPECT_EQ(3, f.size());
|
||||||
|
EXPECT_EQ(1, f.ranges());
|
||||||
|
f = f.makePingPong();
|
||||||
|
EXPECT_EQ(4, f.size());
|
||||||
|
EXPECT_EQ(2, f.ranges());
|
||||||
|
|
||||||
|
FramesSequence f2;
|
||||||
|
f2.insert(1, 2);
|
||||||
|
EXPECT_EQ(2, f2.size());
|
||||||
|
EXPECT_EQ(1, f2.ranges());
|
||||||
|
f2 = f2.makePingPong();
|
||||||
|
EXPECT_EQ(2, f2.size());
|
||||||
|
EXPECT_EQ(1, f2.ranges());
|
||||||
|
|
||||||
|
FramesSequence f3;
|
||||||
|
f3.insert(1, 1);
|
||||||
|
EXPECT_EQ(1, f3.size());
|
||||||
|
EXPECT_EQ(1, f3.ranges());
|
||||||
|
f3 = f3.makePingPong();
|
||||||
|
EXPECT_EQ(1, f3.size());
|
||||||
|
EXPECT_EQ(1, f3.ranges());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(FramesSequence, MakePingPongAndFilter)
|
TEST(FramesSequence, MakePingPongAndFilter)
|
||||||
{
|
{
|
||||||
FramesSequence f;
|
FramesSequence f;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user