2021-12-24 21:11:44 +08:00
|
|
|
|
#include "DragonBonesData.h"
|
2020-10-18 00:27:23 +08:00
|
|
|
|
#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 = "";
|
2020-10-18 00:27:23 +08:00
|
|
|
|
frameIndices.clear();
|
|
|
|
|
cachedFrames.clear();
|
|
|
|
|
armatureNames.clear();
|
|
|
|
|
armatures.clear();
|
2021-12-25 10:04:45 +08:00
|
|
|
|
binary = nullptr;
|
|
|
|
|
intArray = nullptr;
|
|
|
|
|
floatArray = nullptr;
|
|
|
|
|
frameIntArray = nullptr;
|
2020-10-18 00:27:23 +08:00
|
|
|
|
frameFloatArray = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
|
frameArray = nullptr;
|
|
|
|
|
timelineArray = nullptr;
|
|
|
|
|
userData = nullptr;
|
2020-10-18 00:27:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DragonBonesData::addArmature(ArmatureData* value)
|
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
|
if (armatures.find(value->name) != armatures.end())
|
2020-10-18 00:27:23 +08:00
|
|
|
|
{
|
|
|
|
|
DRAGONBONES_ASSERT(false, "Same armature: " + value->name);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
|
value->parent = this;
|
2020-10-18 00:27:23 +08:00
|
|
|
|
armatures[value->name] = value;
|
|
|
|
|
armatureNames.push_back(value->name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DRAGONBONES_NAMESPACE_END
|