axmol/extensions/DragonBones/model/DragonBonesData.cpp

56 lines
1.1 KiB
C++
Raw Normal View History

2021-12-24 21:11:44 +08:00
#include "DragonBonesData.h"
#include "UserData.h"
#include "ArmatureData.h"
DRAGONBONES_NAMESPACE_BEGIN
void DragonBonesData::_onClear()
{
for (const auto& pair : armatures)
{
pair.second->returnToPool();
}
if (binary != nullptr)
{
delete binary;
}
if (userData != nullptr)
{
userData->returnToPool();
}
autoSearch = false;
2021-12-25 10:04:45 +08:00
frameRate = 0;
version = "";
name = "";
frameIndices.clear();
cachedFrames.clear();
armatureNames.clear();
armatures.clear();
2021-12-25 10:04:45 +08:00
binary = nullptr;
intArray = nullptr;
floatArray = nullptr;
frameIntArray = nullptr;
frameFloatArray = nullptr;
2021-12-25 10:04:45 +08:00
frameArray = nullptr;
timelineArray = nullptr;
userData = nullptr;
}
void DragonBonesData::addArmature(ArmatureData* value)
{
2021-12-25 10:04:45 +08:00
if (armatures.find(value->name) != armatures.end())
{
DRAGONBONES_ASSERT(false, "Same armature: " + value->name);
return;
}
2021-12-25 10:04:45 +08:00
value->parent = this;
armatures[value->name] = value;
armatureNames.push_back(value->name);
}
DRAGONBONES_NAMESPACE_END