diff --git a/cocos/editor-support/cocostudio/CCArmature.cpp b/cocos/editor-support/cocostudio/CCArmature.cpp index 9f0e909e25..684b98eeb9 100644 --- a/cocos/editor-support/cocostudio/CCArmature.cpp +++ b/cocos/editor-support/cocostudio/CCArmature.cpp @@ -155,7 +155,7 @@ bool Armature::init(const std::string& name) CC_BREAK_IF(!frameData); bone->getTweenData()->copy(frameData); - bone->changeDisplayByIndex(frameData->displayIndex, false); + bone->changeDisplayWithIndex(frameData->displayIndex, false); } while (0); } @@ -222,7 +222,7 @@ Bone *Armature::createBone(const std::string& boneName) } bone->setBoneData(boneData); - bone->getDisplayManager()->changeDisplayByIndex(-1, false); + bone->getDisplayManager()->changeDisplayWithIndex(-1, false); return bone; } diff --git a/cocos/editor-support/cocostudio/CCArmatureAnimation.cpp b/cocos/editor-support/cocostudio/CCArmatureAnimation.cpp index fb7ff59299..90549e3042 100644 --- a/cocos/editor-support/cocostudio/CCArmatureAnimation.cpp +++ b/cocos/editor-support/cocostudio/CCArmatureAnimation.cpp @@ -236,7 +236,7 @@ void ArmatureAnimation::play(const std::string& animationName, int durationTo, if(!bone->isIgnoreMovementBoneData()) { //! this bone is not include in this movement, so hide it - bone->getDisplayManager()->changeDisplayByIndex(-1, false); + bone->getDisplayManager()->changeDisplayWithIndex(-1, false); tween->stop(); } diff --git a/cocos/editor-support/cocostudio/CCBone.cpp b/cocos/editor-support/cocostudio/CCBone.cpp index a6b46b3bef..ecf13a5bf8 100644 --- a/cocos/editor-support/cocostudio/CCBone.cpp +++ b/cocos/editor-support/cocostudio/CCBone.cpp @@ -418,13 +418,22 @@ void Bone::removeDisplay(int index) void Bone::changeDisplayByIndex(int index, bool force) { - _displayManager->changeDisplayByIndex(index, force); + changeDisplayWithIndex(index, force); } - -void Bone::changeDisplayByName(const std::string& name, bool force) +void Bone::changeDisplayByName(const std::string &name, bool force) { - _displayManager->changeDisplayByName(name, force); + changeDisplayWithName(name, force); +} + +void Bone::changeDisplayWithIndex(int index, bool force) +{ + _displayManager->changeDisplayWithIndex(index, force); +} + +void Bone::changeDisplayWithName(const std::string& name, bool force) +{ + _displayManager->changeDisplayWithName(name, force); } ColliderDetector* Bone::getColliderDetector() const diff --git a/cocos/editor-support/cocostudio/CCBone.h b/cocos/editor-support/cocostudio/CCBone.h index 6d469eb965..a5afb8641f 100644 --- a/cocos/editor-support/cocostudio/CCBone.h +++ b/cocos/editor-support/cocostudio/CCBone.h @@ -91,8 +91,11 @@ public: void removeDisplay(int index); - void changeDisplayByIndex(int index, bool force); - void changeDisplayByName(const std::string& name, bool force); + CC_DEPRECATED_ATTRIBUTE void changeDisplayByIndex(int index, bool force); + CC_DEPRECATED_ATTRIBUTE void changeDisplayByName(const std::string& name, bool force); + + void changeDisplayWithIndex(int index, bool force); + void changeDisplayWithName(const std::string& name, bool force); /** * Add a child to this bone, and it will let this child call setParent(Bone *parent) function to set self to it's parent diff --git a/cocos/editor-support/cocostudio/CCDisplayManager.cpp b/cocos/editor-support/cocostudio/CCDisplayManager.cpp index aa59698679..f05ccb1675 100644 --- a/cocos/editor-support/cocostudio/CCDisplayManager.cpp +++ b/cocos/editor-support/cocostudio/CCDisplayManager.cpp @@ -108,7 +108,7 @@ void DisplayManager::addDisplay(DisplayData *displayData, int index) if(index == _displayIndex) { _displayIndex = -1; - changeDisplayByIndex(index, false); + changeDisplayWithIndex(index, false); } } @@ -193,7 +193,7 @@ void DisplayManager::addDisplay(Node *display, int index) if(index == _displayIndex) { _displayIndex = -1; - changeDisplayByIndex(index, false); + changeDisplayWithIndex(index, false); } } @@ -213,7 +213,7 @@ const cocos2d::Vector& DisplayManager::getDecorativeDisplayL return _decoDisplayList; } -void DisplayManager::changeDisplayByIndex(int index, bool force) +void DisplayManager::changeDisplayWithIndex(int index, bool force) { CCASSERT( index < (int)_decoDisplayList.size(), "the _index value is out of range"); @@ -243,13 +243,13 @@ void DisplayManager::changeDisplayByIndex(int index, bool force) setCurrentDecorativeDisplay(decoDisplay); } -void CCDisplayManager::changeDisplayByName(const std::string& name, bool force) +void CCDisplayManager::changeDisplayWithName(const std::string& name, bool force) { for (int i = 0; i<_decoDisplayList.size(); i++) { if (_decoDisplayList.at(i)->getDisplayData()->displayName == name) { - changeDisplayByIndex(i, force); + changeDisplayWithIndex(i, force); break; } } diff --git a/cocos/editor-support/cocostudio/CCDisplayManager.h b/cocos/editor-support/cocostudio/CCDisplayManager.h index 75ba93b455..6b3f188236 100644 --- a/cocos/editor-support/cocostudio/CCDisplayManager.h +++ b/cocos/editor-support/cocostudio/CCDisplayManager.h @@ -74,6 +74,12 @@ public: const cocos2d::Vector& getDecorativeDisplayList() const; + /* + * @deprecated, please use changeDisplayWithIndex and changeDisplayWithName + */ + CC_DEPRECATED_ATTRIBUTE void changeDisplayByIndex(int index, bool force); + CC_DEPRECATED_ATTRIBUTE void changeDisplayByName(const std::string& name, bool force); + /** * Change display by index. You can just use this method to change display in the display list. * The display list is just used for this bone, and it is the displays you may use in every frame. @@ -83,9 +89,8 @@ public: * @param index The index of the display you want to change * @param force If true, then force change display to specified display, or current display will set to display index edit in the flash every key frame. */ - void changeDisplayByIndex(int index, bool force); - - void changeDisplayByName(const std::string& name, bool force); + void changeDisplayWithIndex(int index, bool force); + void changeDisplayWithName(const std::string& name, bool force); cocos2d::Node *getDisplayRenderNode() const; DisplayType getDisplayRenderNodeType() const; diff --git a/cocos/editor-support/cocostudio/CCTween.cpp b/cocos/editor-support/cocostudio/CCTween.cpp index ccd5a74eeb..282df8297e 100644 --- a/cocos/editor-support/cocostudio/CCTween.cpp +++ b/cocos/editor-support/cocostudio/CCTween.cpp @@ -330,7 +330,7 @@ void Tween::arriveKeyFrame(FrameData *keyFrameData) if (!displayManager->isForceChangeDisplay()) { - displayManager->changeDisplayByIndex(displayIndex, false); + displayManager->changeDisplayWithIndex(displayIndex, false); } //! Update bone zorder, bone's zorder is determined by frame zorder and bone zorder diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp index 0baa0e306d..35865b7813 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/CocoStudioArmatureTest/ArmatureScene.cpp @@ -635,7 +635,7 @@ void TestParticleDisplay::onEnter() Bone *bone = Bone::create("p1"); bone->addDisplay(p1, 0); - bone->changeDisplayByIndex(0, true); + bone->changeDisplayWithIndex(0, true); bone->setIgnoreMovementBoneData(true); bone->setZOrder(100); bone->setScale(1.2f); @@ -643,7 +643,7 @@ void TestParticleDisplay::onEnter() bone = Bone::create("p2"); bone->addDisplay(p2, 0); - bone->changeDisplayByIndex(0, true); + bone->changeDisplayWithIndex(0, true); bone->setIgnoreMovementBoneData(true); bone->setZOrder(100); bone->setScale(1.2f); @@ -727,7 +727,7 @@ void TestUseMutiplePicture::onTouchesEnded(const std::vector& touches, { ++displayIndex; displayIndex = (displayIndex) % 8; - armature->getBone("weapon")->changeDisplayByIndex(displayIndex, true); + armature->getBone("weapon")->changeDisplayWithIndex(displayIndex, true); } TestColliderDetector::~TestColliderDetector() @@ -1230,7 +1230,7 @@ void Hero::changeMount(Armature *armature) //Add hero as a display to this bone bone->addDisplay(this, 0); //Change this bone's display - bone->changeDisplayByIndex(0, true); + bone->changeDisplayWithIndex(0, true); bone->setIgnoreMovementBoneData(true); setPosition(Point(0,0));