mirror of https://github.com/axmolengine/axmol.git
fix add display
This commit is contained in:
parent
e1acbb6af4
commit
90d7abb3ca
|
@ -261,17 +261,11 @@ void Armature::addBone(Bone *bone, const char *parentName)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (_parentBone)
|
||||
_parentBone->addChildBone(bone);
|
||||
else
|
||||
_topBoneList->addObject(bone);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_parentBone)
|
||||
_parentBone->addChildBone(bone);
|
||||
else
|
||||
_topBoneList->addObject(bone);
|
||||
}
|
||||
|
||||
|
@ -338,7 +332,7 @@ Dictionary *Armature::getBoneDic()
|
|||
return _boneDic;
|
||||
}
|
||||
|
||||
const AffineTransform& Armature::getNodeToParentTransform() const
|
||||
const AffineTransform &Armature::getNodeToParentTransform() const
|
||||
{
|
||||
if (_transformDirty)
|
||||
{
|
||||
|
@ -452,7 +446,7 @@ void Armature::update(float dt)
|
|||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_topBoneList, object)
|
||||
{
|
||||
static_cast<Bone*>(object)->update(dt);
|
||||
static_cast<Bone *>(object)->update(dt);
|
||||
}
|
||||
|
||||
_armatureTransformDirty = false;
|
||||
|
@ -523,6 +517,8 @@ void Armature::draw()
|
|||
}
|
||||
}
|
||||
armature->draw();
|
||||
|
||||
_atlas = armature->getTextureAtlas();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -679,7 +675,7 @@ Bone *Armature::getBoneAtPoint(float x, float y)
|
|||
|
||||
for(int i = length - 1; i >= 0; i--)
|
||||
{
|
||||
bs = static_cast<Bone*>( _children->getObjectAtIndex(i) );
|
||||
bs = static_cast<Bone *>( _children->getObjectAtIndex(i) );
|
||||
if(bs->getDisplayManager()->containPoint(x, y))
|
||||
{
|
||||
return bs;
|
||||
|
|
|
@ -165,6 +165,13 @@ 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)
|
||||
|
@ -182,6 +189,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());
|
||||
|
@ -211,7 +225,7 @@ void Bone::updateDisplayedOpacity(GLubyte parentOpacity)
|
|||
updateColor();
|
||||
}
|
||||
|
||||
void Bone::setColor(const Color3B& color)
|
||||
void Bone::setColor(const Color3B &color)
|
||||
{
|
||||
CCNodeRGBA::setColor(color);
|
||||
updateColor();
|
||||
|
|
|
@ -135,6 +135,7 @@ void DisplayManager::addDisplay(Node *display, int index)
|
|||
if (SpriteDisplayData *spriteDisplayData = (SpriteDisplayData *)decoDisplay->getDisplayData())
|
||||
{
|
||||
skin->setSkinData(spriteDisplayData->skinData);
|
||||
((CCSpriteDisplayData *)displayData)->skinData = spriteDisplayData->skinData;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -118,6 +118,7 @@ void Skin::setSkinData(const BaseData &var)
|
|||
setPosition(Point(_skinData.x, _skinData.y));
|
||||
|
||||
_skinTransform = getNodeToParentTransform();
|
||||
updateArmatureTransform();
|
||||
}
|
||||
|
||||
const BaseData &Skin::getSkinData() const
|
||||
|
|
|
@ -136,7 +136,7 @@ static const char *CONFIG_FILE_PATH = "config_file_path";
|
|||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
|
||||
std::vector<std::string> s_arrConfigFileList;
|
||||
std::vector<std::string> s_arrConfigFileList;
|
||||
float s_PositionReadScale = 1;
|
||||
static float s_FlashToolVersion = VERSION_2_0;
|
||||
static float s_CocoStudioVersion = VERSION_COMBINED;
|
||||
|
|
Loading…
Reference in New Issue