mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-01 01:20:25 +00:00
Don't generate new slice keyframes when duplicating the sprite (duplicate only the slice keyframes)
Related to #2568
This commit is contained in:
parent
25ca9e4a13
commit
23559a9b44
@ -515,12 +515,9 @@ Doc* Doc::duplicate(DuplicateType type) const
|
||||
// Copy slices
|
||||
for (const Slice *slice : sourceSprite->slices()) {
|
||||
auto sliceCopy = new Slice(*slice);
|
||||
sliceCopy->setUserData(slice->userData());
|
||||
|
||||
for (frame_t i(0); i < sourceSprite->totalFrames(); ++i)
|
||||
sliceCopy->insert(i, *slice->getByFrame(i));
|
||||
|
||||
spriteCopy->slices().add(sliceCopy);
|
||||
|
||||
ASSERT(sliceCopy->owner() == &spriteCopy->slices());
|
||||
}
|
||||
|
||||
// Copy color palettes
|
||||
|
@ -8,7 +8,6 @@
|
||||
#define DOC_KEYFRAMES_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "base/disable_copying.h"
|
||||
#include "doc/frame.h"
|
||||
|
||||
#include <vector>
|
||||
@ -111,6 +110,11 @@ namespace doc {
|
||||
|
||||
Keyframes() { }
|
||||
|
||||
Keyframes(const Keyframes& other) {
|
||||
for (const auto& key : other.m_keys)
|
||||
m_keys.push_back(Key(key.frame(), new T(*key.value())));
|
||||
}
|
||||
|
||||
void insert(const frame_t frame, T* value) {
|
||||
auto it = getIterator(frame);
|
||||
if (it == end())
|
||||
@ -189,9 +193,6 @@ namespace doc {
|
||||
|
||||
private:
|
||||
List m_keys;
|
||||
|
||||
// Disable operator=
|
||||
DISABLE_COPYING(Keyframes);
|
||||
};
|
||||
|
||||
} // namespace doc
|
||||
|
@ -42,13 +42,13 @@ Slice::Slice()
|
||||
}
|
||||
|
||||
Slice::Slice(const Slice& other)
|
||||
: WithUserData(ObjectType::Slice)
|
||||
: WithUserData(other)
|
||||
, m_owner(nullptr)
|
||||
, m_name(other.m_name)
|
||||
, m_keys(other.m_keys)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Slice::~Slice()
|
||||
{
|
||||
ASSERT(!m_owner);
|
||||
|
Loading…
x
Reference in New Issue
Block a user