2021-12-26 23:26:34 +08:00
|
|
|
#include "Armature.h"
|
2020-10-18 00:27:23 +08:00
|
|
|
#include "../model/TextureAtlasData.h"
|
|
|
|
#include "../model/UserData.h"
|
|
|
|
#include "../animation/WorldClock.h"
|
|
|
|
#include "../animation/Animation.h"
|
|
|
|
#include "../event/EventObject.h"
|
|
|
|
#include "IArmatureProxy.h"
|
|
|
|
#include "Bone.h"
|
|
|
|
#include "Slot.h"
|
|
|
|
#include "Constraint.h"
|
|
|
|
|
|
|
|
DRAGONBONES_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
bool Armature::_onSortSlots(Slot* a, Slot* b)
|
|
|
|
{
|
|
|
|
return a->_zOrder < b->_zOrder ? true : false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Armature::_onClear()
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (_clock != nullptr) // Remove clock before slots clear.
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
_clock->remove(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const auto bone : _bones)
|
|
|
|
{
|
|
|
|
bone->returnToPool();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const auto slot : _slots)
|
|
|
|
{
|
|
|
|
slot->returnToPool();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const auto constraint : _constraints)
|
|
|
|
{
|
|
|
|
constraint->returnToPool();
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const auto action : _actions)
|
|
|
|
{
|
|
|
|
action->returnToPool();
|
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (_animation != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
_animation->returnToPool();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_proxy != nullptr)
|
|
|
|
{
|
|
|
|
_proxy->dbClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_replaceTextureAtlasData != nullptr)
|
|
|
|
{
|
|
|
|
_replaceTextureAtlasData->returnToPool();
|
|
|
|
}
|
|
|
|
|
|
|
|
inheritAnimation = true;
|
2021-12-25 10:04:45 +08:00
|
|
|
userData = nullptr;
|
|
|
|
|
|
|
|
_debugDraw = false;
|
|
|
|
_lockUpdate = false;
|
|
|
|
_slotsDirty = false;
|
|
|
|
_zOrderDirty = false;
|
|
|
|
_flipX = false;
|
|
|
|
_flipY = false;
|
2020-10-18 00:27:23 +08:00
|
|
|
_cacheFrameIndex = -1;
|
|
|
|
_bones.clear();
|
|
|
|
_slots.clear();
|
|
|
|
_constraints.clear();
|
|
|
|
_actions.clear();
|
2021-12-25 10:04:45 +08:00
|
|
|
_armatureData = nullptr;
|
|
|
|
_animation = nullptr;
|
|
|
|
_proxy = nullptr;
|
|
|
|
_display = nullptr;
|
2020-10-18 00:27:23 +08:00
|
|
|
_replaceTextureAtlasData = nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
_replacedTexture = nullptr;
|
|
|
|
_dragonBones = nullptr;
|
|
|
|
_clock = nullptr;
|
|
|
|
_parent = nullptr;
|
2020-10-18 00:27:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Armature::_sortZOrder(const int16_t* slotIndices, unsigned offset)
|
|
|
|
{
|
|
|
|
const auto& slotDatas = _armatureData->sortedSlots;
|
|
|
|
const auto isOriginal = slotIndices == nullptr;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (_zOrderDirty || !isOriginal)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
for (std::size_t i = 0, l = slotDatas.size(); i < l; ++i)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
const auto slotIndex = isOriginal ? i : (std::size_t)slotIndices[offset + i];
|
2021-04-26 17:28:58 +08:00
|
|
|
if (slotIndex >= l)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto slotData = slotDatas[slotIndex];
|
2021-12-25 10:04:45 +08:00
|
|
|
const auto slot = getSlot(slotData->name);
|
|
|
|
if (slot != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
slot->_setZorder(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
_slotsDirty = true;
|
2020-10-18 00:27:23 +08:00
|
|
|
_zOrderDirty = !isOriginal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Armature::_addBone(Bone* value)
|
|
|
|
{
|
|
|
|
if (std::find(_bones.begin(), _bones.end(), value) == _bones.end())
|
|
|
|
{
|
|
|
|
_bones.push_back(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Armature::_addSlot(Slot* value)
|
|
|
|
{
|
|
|
|
if (std::find(_slots.begin(), _slots.end(), value) == _slots.end())
|
|
|
|
{
|
|
|
|
_slots.push_back(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Armature::_addConstraint(Constraint* value)
|
|
|
|
{
|
|
|
|
if (std::find(_constraints.cbegin(), _constraints.cend(), value) == _constraints.cend())
|
|
|
|
{
|
|
|
|
_constraints.push_back(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Armature::_bufferAction(EventObject* action, bool append)
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (std::find(_actions.cbegin(), _actions.cend(), action) == _actions.cend())
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (append)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
_actions.push_back(action);
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
_actions.insert(_actions.begin(), action);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Armature::dispose()
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (_armatureData != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
_lockUpdate = true;
|
|
|
|
_dragonBones->bufferObject(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
void Armature::init(ArmatureData* armatureData, IArmatureProxy* proxy, void* display, DragonBones* dragonBones)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
if (_armatureData != nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_armatureData = armatureData;
|
2021-12-25 10:04:45 +08:00
|
|
|
_animation = BaseObject::borrowObject<Animation>();
|
|
|
|
_proxy = proxy;
|
|
|
|
_display = display;
|
|
|
|
_dragonBones = dragonBones;
|
2020-10-18 00:27:23 +08:00
|
|
|
|
|
|
|
_proxy->dbInit(this);
|
|
|
|
_animation->init(this);
|
|
|
|
_animation->setAnimations(_armatureData->animations);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Armature::advanceTime(float passedTime)
|
|
|
|
{
|
|
|
|
if (_lockUpdate)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_armatureData == nullptr)
|
|
|
|
{
|
|
|
|
DRAGONBONES_ASSERT(false, "The armature has been disposed.");
|
|
|
|
return;
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else if (_armatureData->parent == nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
DRAGONBONES_ASSERT(
|
|
|
|
false,
|
|
|
|
"The armature data has been disposed.\nPlease make sure dispose armature before call factory.clear().");
|
2020-10-18 00:27:23 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto prevCacheFrameIndex = _cacheFrameIndex;
|
|
|
|
|
|
|
|
// Update animation.
|
|
|
|
_animation->advanceTime(passedTime);
|
|
|
|
|
|
|
|
// Sort slots.
|
|
|
|
if (_slotsDirty)
|
|
|
|
{
|
|
|
|
_slotsDirty = false;
|
|
|
|
std::sort(_slots.begin(), _slots.end(), Armature::_onSortSlots);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update bones and slots.
|
|
|
|
if (_cacheFrameIndex < 0 || _cacheFrameIndex != prevCacheFrameIndex)
|
|
|
|
{
|
|
|
|
for (const auto bone : _bones)
|
|
|
|
{
|
|
|
|
bone->update(_cacheFrameIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const auto slot : _slots)
|
|
|
|
{
|
|
|
|
slot->update(_cacheFrameIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do actions.
|
2021-12-25 10:04:45 +08:00
|
|
|
if (!_actions.empty())
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
_lockUpdate = true;
|
|
|
|
|
|
|
|
for (const auto action : _actions)
|
|
|
|
{
|
|
|
|
const auto actionData = action->actionData;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (actionData != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (actionData->type == ActionType::Play)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
if (action->slot != nullptr)
|
|
|
|
{
|
|
|
|
const auto childArmature = action->slot->getChildArmature();
|
2021-12-25 10:04:45 +08:00
|
|
|
if (childArmature != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
childArmature->getAnimation()->fadeIn(actionData->name);
|
|
|
|
}
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else if (action->bone != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
for (const auto slot : getSlots())
|
|
|
|
{
|
|
|
|
if (slot->getParent() == action->bone)
|
|
|
|
{
|
|
|
|
const auto childArmature = slot->getChildArmature();
|
2021-12-25 10:04:45 +08:00
|
|
|
if (childArmature != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
childArmature->getAnimation()->fadeIn(actionData->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
_animation->fadeIn(actionData->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
action->returnToPool();
|
|
|
|
}
|
|
|
|
|
|
|
|
_actions.clear();
|
|
|
|
_lockUpdate = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
_proxy->dbUpdate();
|
|
|
|
}
|
|
|
|
|
2021-12-26 23:26:34 +08:00
|
|
|
void Armature::invalidUpdate(std::string_view boneName, bool updateSlot)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
if (!boneName.empty())
|
|
|
|
{
|
|
|
|
const auto bone = getBone(boneName);
|
|
|
|
if (bone != nullptr)
|
|
|
|
{
|
|
|
|
bone->invalidUpdate();
|
|
|
|
|
|
|
|
if (updateSlot)
|
|
|
|
{
|
|
|
|
for (const auto slot : _slots)
|
|
|
|
{
|
|
|
|
if (slot->getParent() == bone)
|
|
|
|
{
|
|
|
|
slot->invalidUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (const auto bone : _bones)
|
|
|
|
{
|
|
|
|
bone->invalidUpdate();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (updateSlot)
|
|
|
|
{
|
|
|
|
for (const auto slot : _slots)
|
|
|
|
{
|
|
|
|
slot->invalidUpdate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Slot* Armature::containsPoint(float x, float y) const
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
for (const auto slot : _slots)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (slot->containsPoint(x, y))
|
|
|
|
{
|
2020-10-18 00:27:23 +08:00
|
|
|
return slot;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
Slot* Armature::intersectsSegment(float xA,
|
|
|
|
float yA,
|
|
|
|
float xB,
|
|
|
|
float yB,
|
|
|
|
Point* intersectionPointA,
|
|
|
|
Point* intersectionPointB,
|
|
|
|
Point* normalRadians) const
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
const auto isV = xA == xB;
|
2021-12-25 10:04:45 +08:00
|
|
|
auto dMin = 0.0f;
|
|
|
|
auto dMax = 0.0f;
|
|
|
|
auto intXA = 0.0f;
|
|
|
|
auto intYA = 0.0f;
|
|
|
|
auto intXB = 0.0f;
|
|
|
|
auto intYB = 0.0f;
|
|
|
|
auto intAN = 0.0f;
|
|
|
|
auto intBN = 0.0f;
|
2020-10-18 00:27:23 +08:00
|
|
|
Slot* intSlotA = nullptr;
|
|
|
|
Slot* intSlotB = nullptr;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
for (const auto& slot : _slots)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
auto intersectionCount =
|
|
|
|
slot->intersectsSegment(xA, yA, xB, yB, intersectionPointA, intersectionPointB, normalRadians);
|
|
|
|
if (intersectionCount > 0)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (intersectionPointA != nullptr || intersectionPointB != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (intersectionPointA != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
float d = isV ? intersectionPointA->y - yA : intersectionPointA->x - xA;
|
2021-12-25 10:04:45 +08:00
|
|
|
if (d < 0.0f)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
d = -d;
|
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (intSlotA == nullptr || d < dMin)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
dMin = d;
|
|
|
|
intXA = intersectionPointA->x;
|
|
|
|
intYA = intersectionPointA->y;
|
2020-10-18 00:27:23 +08:00
|
|
|
intSlotA = slot;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (normalRadians)
|
|
|
|
{
|
2020-10-18 00:27:23 +08:00
|
|
|
intAN = normalRadians->x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (intersectionPointB != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
float d = intersectionPointB->x - xA;
|
2021-12-25 10:04:45 +08:00
|
|
|
if (d < 0.0f)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
d = -d;
|
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (intSlotB == nullptr || d > dMax)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
dMax = d;
|
|
|
|
intXB = intersectionPointB->x;
|
|
|
|
intYB = intersectionPointB->y;
|
2020-10-18 00:27:23 +08:00
|
|
|
intSlotB = slot;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (normalRadians != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
intBN = normalRadians->y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-25 10:04:45 +08:00
|
|
|
else
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
intSlotA = slot;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (intSlotA != nullptr && intersectionPointA != nullptr)
|
|
|
|
{
|
|
|
|
intersectionPointA->x = intXA;
|
|
|
|
intersectionPointA->y = intYA;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (normalRadians != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
normalRadians->x = intAN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (intSlotB != nullptr && intersectionPointB != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
intersectionPointB->x = intXB;
|
|
|
|
intersectionPointB->y = intYB;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (normalRadians != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
normalRadians->y = intBN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return intSlotA;
|
|
|
|
}
|
|
|
|
|
2021-12-26 23:26:34 +08:00
|
|
|
Bone* Armature::getBone(std::string_view name) const
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
for (const auto& bone : _bones)
|
|
|
|
{
|
|
|
|
if (bone->getName() == name)
|
|
|
|
{
|
|
|
|
return bone;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
Bone* Armature::getBoneByDisplay(void* display) const
|
|
|
|
{
|
|
|
|
const auto slot = getSlotByDisplay(display);
|
|
|
|
|
|
|
|
return slot != nullptr ? slot->getParent() : nullptr;
|
|
|
|
}
|
|
|
|
|
2021-12-26 23:26:34 +08:00
|
|
|
Slot* Armature::getSlot(std::string_view name) const
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
for (const auto slot : _slots)
|
|
|
|
{
|
|
|
|
if (slot->getName() == name)
|
|
|
|
{
|
|
|
|
return slot;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
Slot* Armature::getSlotByDisplay(void* display) const
|
|
|
|
{
|
|
|
|
if (display != nullptr)
|
|
|
|
{
|
|
|
|
for (const auto slot : _slots)
|
|
|
|
{
|
|
|
|
if (slot->getDisplay() == display)
|
|
|
|
{
|
|
|
|
return slot;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Armature::setCacheFrameRate(unsigned value)
|
|
|
|
{
|
|
|
|
if (_armatureData->cacheFrameRate != value)
|
|
|
|
{
|
|
|
|
_armatureData->cacheFrames(value);
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
for (const auto& slot : _slots)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
const auto childArmature = slot->getChildArmature();
|
2021-12-25 10:04:45 +08:00
|
|
|
if (childArmature != nullptr && childArmature->getCacheFrameRate() == 0)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
childArmature->setCacheFrameRate(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Armature::setClock(WorldClock* value)
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (_clock == value)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (_clock)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
_clock->remove(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
_clock = value;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (_clock)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
_clock->add(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update childArmature clock.
|
|
|
|
for (const auto& slot : _slots)
|
|
|
|
{
|
|
|
|
const auto childArmature = slot->getChildArmature();
|
2021-12-25 10:04:45 +08:00
|
|
|
if (childArmature != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
childArmature->setClock(_clock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Armature::setReplacedTexture(void* value)
|
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (_replacedTexture == value)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
if (_replaceTextureAtlasData != nullptr)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
_replaceTextureAtlasData->returnToPool();
|
|
|
|
_replaceTextureAtlasData = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
_replacedTexture = value;
|
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
for (const auto& slot : _slots)
|
2020-10-18 00:27:23 +08:00
|
|
|
{
|
|
|
|
slot->invalidUpdate();
|
|
|
|
slot->update(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DRAGONBONES_NAMESPACE_END
|