1.when add a skin to last index, applay it's skindata to the previous skindata

2.Do not retain target when regist frame event and movement event
This commit is contained in:
2youyou2 2013-11-11 13:33:47 +08:00
parent 707a6c246f
commit 0a72c3c1c2
2 changed files with 22 additions and 17 deletions

View File

@ -69,9 +69,6 @@ ArmatureAnimation::~ArmatureAnimation(void)
{
CC_SAFE_RELEASE_NULL(_tweenList);
CC_SAFE_RELEASE_NULL(_animationData);
CC_SAFE_RELEASE_NULL(_movementEventTarget);
CC_SAFE_RELEASE_NULL(_frameEventTarget);
}
bool ArmatureAnimation::init(Armature *armature)
@ -423,23 +420,13 @@ std::string ArmatureAnimation::getCurrentMovementID() const
void ArmatureAnimation::setMovementEventCallFunc(Object *target, SEL_MovementEventCallFunc callFunc)
{
if (target != _movementEventTarget)
{
CC_SAFE_RETAIN(target);
CC_SAFE_RELEASE_NULL(_movementEventTarget);
_movementEventTarget = target;
}
_movementEventTarget = target;
_movementEventCallFunc = callFunc;
}
void ArmatureAnimation::setFrameEventCallFunc(Object *target, SEL_FrameEventCallFunc callFunc)
{
if (target != _frameEventTarget)
{
CC_SAFE_RETAIN(target);
CC_SAFE_RELEASE_NULL(_frameEventTarget);
_frameEventTarget = target;
}
_frameEventTarget = target;
_frameEventCallFunc = callFunc;
}

View File

@ -142,8 +142,26 @@ void DisplayManager::addDisplay(Node *display, int index)
}
else
{
BaseData baseData;
skin->setSkinData(baseData);
bool find = false;
for (int i = _decoDisplayList->count()-2; i>=0; i--)
{
DecorativeDisplay *dd = static_cast<DecorativeDisplay*>(_decoDisplayList->objectAtIndex(i));
SpriteDisplayData *spriteDisplayData = static_cast<SpriteDisplayData*>(dd->getDisplayData());
if (spriteDisplayData)
{
find = true;
skin->setSkinData(spriteDisplayData->skinData);
static_cast<SpriteDisplayData*>(displayData)->skinData = spriteDisplayData->skinData;
break;
}
}
if (!find)
{
BaseData baseData;
skin->setSkinData(baseData);
}
}
}
else if (dynamic_cast<ParticleSystemQuad *>(display))