mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Copy frame tags when we duplicate a sprite
This commit is contained in:
parent
dae3a0dd81
commit
b3232311ff
@ -28,6 +28,7 @@
|
||||
#include "doc/context.h"
|
||||
#include "doc/document_event.h"
|
||||
#include "doc/document_observer.h"
|
||||
#include "doc/frame_tag.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/palette.h"
|
||||
@ -446,6 +447,10 @@ Document* Document::duplicate(DuplicateType type) const
|
||||
for (frame_t i(0); i < sourceSprite->totalFrames(); ++i)
|
||||
spriteCopy->setFrameDuration(i, sourceSprite->frameDuration(i));
|
||||
|
||||
// Copy frame tags
|
||||
for (const FrameTag* tag : sourceSprite->frameTags())
|
||||
spriteCopy->frameTags().add(new FrameTag(*tag));
|
||||
|
||||
// Copy color palettes
|
||||
{
|
||||
PalettesList::const_iterator it = sourceSprite->getPalettes().begin();
|
||||
|
@ -25,6 +25,17 @@ FrameTag::FrameTag(frame_t from, frame_t to)
|
||||
{
|
||||
}
|
||||
|
||||
FrameTag::FrameTag(const FrameTag& other)
|
||||
: Object(ObjectType::FrameTag)
|
||||
, m_owner(nullptr)
|
||||
, m_from(other.m_from)
|
||||
, m_to(other.m_to)
|
||||
, m_color(other.m_color)
|
||||
, m_name(other.m_name)
|
||||
, m_aniDir(other.m_aniDir)
|
||||
{
|
||||
}
|
||||
|
||||
FrameTag::~FrameTag()
|
||||
{
|
||||
ASSERT(!m_owner);
|
||||
|
@ -22,6 +22,7 @@ namespace doc {
|
||||
class FrameTag : public Object {
|
||||
public:
|
||||
FrameTag(frame_t from, frame_t to);
|
||||
FrameTag(const FrameTag& other);
|
||||
~FrameTag();
|
||||
|
||||
FrameTags* owner() const { return m_owner; }
|
||||
@ -45,7 +46,8 @@ namespace doc {
|
||||
std::string m_name;
|
||||
AniDir m_aniDir;
|
||||
|
||||
DISABLE_COPYING(FrameTag);
|
||||
// Disable operator=
|
||||
FrameTag& operator=(FrameTag&);
|
||||
};
|
||||
|
||||
} // namespace doc
|
||||
|
Loading…
x
Reference in New Issue
Block a user