fix add display

This commit is contained in:
yinkaile 2013-10-29 16:57:06 +08:00
parent dfc40d354e
commit 2d3df69982
4 changed files with 18 additions and 8 deletions

View File

@ -265,18 +265,12 @@ void Armature::addBone(Bone *bone, const char *parentName)
}
else
{
if (_parentBone)
_parentBone->addChildBone(bone);
else
_topBoneList->addObject(bone);
_topBoneList->addObject(bone);
}
}
else
{
if (_parentBone)
_parentBone->addChildBone(bone);
else
_topBoneList->addObject(bone);
_topBoneList->addObject(bone);
}
bone->setArmature(this);
@ -527,6 +521,7 @@ void Armature::draw()
}
}
armature->draw();
_atlas = armature->getTextureAtlas();
}
break;
default:

View File

@ -167,6 +167,12 @@ void Bone::update(float delta)
if (_parentBone)
_boneTransformDirty = _boneTransformDirty || _parentBone->isTransformDirty();
CCBone *armatureParentBone = _armature->getParentBone();
if (armatureParentBone && !_boneTransformDirty)
{
_boneTransformDirty = armatureParentBone->isTransformDirty();
}
if (_boneTransformDirty)
{
if (_armature->getArmatureData()->dataVersion >= VERSION_COMBINED)
@ -184,6 +190,13 @@ void Bone::update(float delta)
{
_worldTransform = AffineTransformConcat(_worldTransform, _parentBone->_worldTransform);
}
else
{
if (armatureParentBone)
{
_worldTransform = CCAffineTransformConcat(_worldTransform, armatureParentBone->getNodeToArmatureTransform());
}
}
}
DisplayFactory::updateDisplay(this, _displayManager->getCurrentDecorativeDisplay(), delta, _boneTransformDirty || _armature->getArmatureTransformDirty());

View File

@ -137,6 +137,7 @@ void DisplayManager::addDisplay(Node *display, int index)
if (SpriteDisplayData *spriteDisplayData = (SpriteDisplayData *)decoDisplay->getDisplayData())
{
skin->setSkinData(spriteDisplayData->skinData);
((CCSpriteDisplayData *)displayData)->skinData = spriteDisplayData->skinData;
}
else
{

View File

@ -120,6 +120,7 @@ void Skin::setSkinData(const BaseData &var)
setPosition(Point(_skinData.x, _skinData.y));
_skinTransform = getNodeToParentTransform();
updateArmatureTransform();
}
const BaseData &Skin::getSkinData() const