From d29931dc4f74d788539f1de36c10be1925afea9e Mon Sep 17 00:00:00 2001
From: yinkaile <501251991@qq.com>
Date: Sat, 8 Jun 2013 22:08:22 +0800
Subject: [PATCH] 1.add hd resource 2.remove zobie resource 3.support frame
event
---
extensions/CCArmature/CCArmature.cpp | 2 +-
extensions/CCArmature/CCBone.cpp | 12 +
extensions/CCArmature/CCBone.h | 2 +-
extensions/CCArmature/animation/CCTween.h | 2 +
.../CCArmature/display/CCDisplayManager.cpp | 1 +
.../ArmatureTest/ArmatureScene.cpp | 51 +-
.../ArmatureTest/ArmatureScene.h | 10 +-
.../Cpp/TestCpp/Resources/armature/Dragon.xml | 2 +-
.../armature/Example08.png.REMOVED.git-id | 1 -
.../TestCpp/Resources/armature/Example08.xml | 671 ------------------
.../armature/zamboni.json.REMOVED.git-id | 1 -
.../hd/armature/Cowboy0.png.REMOVED.git-id | 1 +
.../hd/armature/Dragon.png.REMOVED.git-id | 1 +
.../hd/armature/TestBone0.png.REMOVED.git-id | 1 +
.../hd/armature/weapon.png.REMOVED.git-id | 1 +
15 files changed, 36 insertions(+), 723 deletions(-)
delete mode 100644 samples/Cpp/TestCpp/Resources/armature/Example08.png.REMOVED.git-id
delete mode 100644 samples/Cpp/TestCpp/Resources/armature/Example08.xml
delete mode 100644 samples/Cpp/TestCpp/Resources/armature/zamboni.json.REMOVED.git-id
create mode 100644 samples/Cpp/TestCpp/Resources/hd/armature/Cowboy0.png.REMOVED.git-id
create mode 100644 samples/Cpp/TestCpp/Resources/hd/armature/Dragon.png.REMOVED.git-id
create mode 100644 samples/Cpp/TestCpp/Resources/hd/armature/TestBone0.png.REMOVED.git-id
create mode 100644 samples/Cpp/TestCpp/Resources/hd/armature/weapon.png.REMOVED.git-id
diff --git a/extensions/CCArmature/CCArmature.cpp b/extensions/CCArmature/CCArmature.cpp
index bae5cf61a7..133635f9ea 100644
--- a/extensions/CCArmature/CCArmature.cpp
+++ b/extensions/CCArmature/CCArmature.cpp
@@ -290,7 +290,7 @@ void CCArmature::removeBone(CCBone *bone, bool recursion)
m_pTopBoneList->removeObject(bone);
}
m_pBoneDic->removeObjectForKey(bone->getName());
- m_pChildren->removeObject(bone);
+ removeChild(bone, true);
}
diff --git a/extensions/CCArmature/CCBone.cpp b/extensions/CCArmature/CCBone.cpp
index 10846c2ada..45252de07b 100644
--- a/extensions/CCArmature/CCBone.cpp
+++ b/extensions/CCArmature/CCBone.cpp
@@ -144,6 +144,18 @@ CCBoneData *CCBone::getBoneData()
return m_pBoneData;
}
+void CCBone::setArmature(CCArmature *armature)
+{
+ m_pArmature = armature;
+ m_pTween->setAnimation(m_pArmature->getAnimation());
+}
+
+
+CCArmature *CCBone::getArmature()
+{
+ return m_pArmature;
+}
+
void CCBone::update(float delta)
{
if (m_pParent)
diff --git a/extensions/CCArmature/CCBone.h b/extensions/CCArmature/CCBone.h
index 3be1b0a572..564fdb7de9 100644
--- a/extensions/CCArmature/CCBone.h
+++ b/extensions/CCArmature/CCBone.h
@@ -145,7 +145,7 @@ public:
CC_PROPERTY(CCBoneData *, m_pBoneData, BoneData);
//! A weak reference to the CCArmature
- CC_SYNTHESIZE(CCArmature *, m_pArmature, Armature);
+ CC_PROPERTY(CCArmature *, m_pArmature, Armature);
//! A weak reference to the child CCArmature
CC_PROPERTY(CCArmature *, m_pChildArmature, ChildArmature);
diff --git a/extensions/CCArmature/animation/CCTween.h b/extensions/CCArmature/animation/CCTween.h
index 67315f941e..3f81713965 100644
--- a/extensions/CCArmature/animation/CCTween.h
+++ b/extensions/CCArmature/animation/CCTween.h
@@ -82,6 +82,8 @@ public:
*/
virtual void play(CCMovementBoneData *movementBoneData, int durationTo, int durationTween, int loop, int tweenEasing);
+ inline void setAnimation(CCArmatureAnimation *animation) { m_pAnimation = animation; }
+ inline CCArmatureAnimation *getAnimation() const { return m_pAnimation; }
protected:
/**
diff --git a/extensions/CCArmature/display/CCDisplayManager.cpp b/extensions/CCArmature/display/CCDisplayManager.cpp
index 5ada0ddd7a..c8b645faa4 100644
--- a/extensions/CCArmature/display/CCDisplayManager.cpp
+++ b/extensions/CCArmature/display/CCDisplayManager.cpp
@@ -189,6 +189,7 @@ void CCDisplayManager::setCurrentDecorativeDisplay(CCDecorativeDisplay *decoDisp
m_pBone->setChildArmature((CCArmature *)m_pDisplayRenderNode);
}
m_pDisplayRenderNode->retain();
+ m_pDisplayRenderNode->setVisible(m_bVisible);
}
}
diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp
index fe72aa3666..aaac12e545 100644
--- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp
+++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.cpp
@@ -22,8 +22,6 @@ CCLayer *CreateLayer(int index)
pLayer = new TestCSWithSkeleton(); break;
case TEST_COCOSTUDIO_WITHOUT_SKELETON:
pLayer = new TestCSWithoutSkeleton(); break;
- case TEST_COCOSTUDIO_WITH_CONVERT_FROM_DRAGON_BONES_2_0:
- pLayer = new TestCSContertFromDragonBone(); break;
case TEST_PERFORMANCE:
pLayer = new TestPerformance(); break;
case TEST_CHANGE_ZORDER:
@@ -99,11 +97,9 @@ ArmatureTestScene::ArmatureTestScene(bool bPortrait)
}
void ArmatureTestScene::runThisTest()
{
- CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/Example08.png", "armature/Example08.plist", "armature/Example08.xml");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/TestBone0.png", "armature/TestBone0.plist", "armature/TestBone.json");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/Cowboy0.png", "armature/Cowboy0.plist", "armature/Cowboy.json");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/knight.png", "armature/knight.plist", "armature/knight.xml");
- CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/zamboni0.png", "armature/zamboni0.plist", "armature/zamboni.json");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/weapon.png", "armature/weapon.plist", "armature/weapon.xml");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/robot.png", "armature/robot.plist", "armature/robot.xml");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/cyborg.png", "armature/cyborg.plist", "armature/cyborg.xml");
@@ -118,6 +114,7 @@ void ArmatureTestScene::MainMenuCallback(CCObject* pSender)
{
TestScene::MainMenuCallback(pSender);
+ removeAllChildren();
CCArmatureDataManager::sharedArmatureDataManager()->purgeArmatureSystem();
}
@@ -212,10 +209,8 @@ void TestDragonBones20::onEnter()
armature->getAnimation()->playByIndex(1);
armature->getAnimation()->setAnimationScale(0.4f);
armature->setPosition(VisibleRect::center().x, VisibleRect::center().y * 0.3f);
- armature->setScale(0.6);
+ armature->setScale(0.6f);
addChild(armature);
-
-
}
std::string TestDragonBones20::title()
@@ -262,28 +257,6 @@ std::string TestCSWithoutSkeleton::title()
-void TestCSContertFromDragonBone::onEnter()
-{
- ArmatureTestLayer::onEnter();
-
- cocos2d::extension::CCArmature *armature = cocos2d::extension::CCArmature::create("Zombie_zamboni");
- armature->getAnimation()->playByIndex(1);
- armature->getAnimation()->setAnimationScale(0.5);
- armature->setAnchorPoint(ccp(0.5, 0.5));
- armature->setScale(0.6f);
- armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y));
- addChild(armature);
-}
-
-std::string TestCSContertFromDragonBone::title()
-{
- return "Test CocoStudio Data Convert From DragonBones 2.0 ";
-}
-
-
-
-
-
TestPerformance::~TestPerformance()
{
}
@@ -322,7 +295,7 @@ void TestPerformance::update(float delta)
armature->init("Knight_f/Knight");
armature->getAnimation()->playByIndex(0);
armature->setPosition(50 + armatureCount * 2, 150);
- armature->setScale(0.6);
+ armature->setScale(0.6f);
addArmature(armature);
armature->release();
@@ -359,7 +332,7 @@ void TestChangeZorder::onEnter()
++currentTag;
addChild(armature, currentTag, currentTag);
- armature = cocos2d::extension::CCArmature::create("Zombie_f/Zombie");
+ armature = cocos2d::extension::CCArmature::create("Dragon");
armature->getAnimation()->playByIndex(0);
armature->setPosition(ccp(VisibleRect::center().x , VisibleRect::center().y-100));
++currentTag;
@@ -460,7 +433,7 @@ void TestParticleDisplay::onEnter()
bone->changeDisplayByIndex(0, true);
bone->setIgnoreMovementBoneData(true);
bone->setZOrder(100);
- bone->setScale(1.2);
+ bone->setScale(1.2f);
armature->addBone(bone, "bady-a3");
bone = cocos2d::extension::CCBone::create("p2");
@@ -468,7 +441,7 @@ void TestParticleDisplay::onEnter()
bone->changeDisplayByIndex(0, true);
bone->setIgnoreMovementBoneData(true);
bone->setZOrder(100);
- bone->setScale(1.2);
+ bone->setScale(1.2f);
armature->addBone(bone, "bady-a30");
}
std::string TestParticleDisplay::title()
@@ -505,7 +478,7 @@ void TestUseMutiplePicture::onEnter()
armature = cocos2d::extension::CCArmature::create("Knight_f/Knight");
armature->getAnimation()->playByIndex(0);
armature->setPosition(ccp(VisibleRect::left().x+70, VisibleRect::left().y));
- armature->setScale(1.2);
+ armature->setScale(1.2f);
addChild(armature);
std::string weapon[] = {"weapon_f-sword.png", "weapon_f-sword2.png", "weapon_f-sword3.png", "weapon_f-sword4.png", "weapon_f-sword5.png", "weapon_f-knife.png", "weapon_f-hammer.png"};
@@ -594,10 +567,10 @@ void TestBoundingBox::onEnter()
{
ArmatureTestLayer::onEnter();
- armature = cocos2d::extension::CCArmature::create("Zombie_f/Zombie");
+ armature = cocos2d::extension::CCArmature::create("Cowboy");
armature->getAnimation()->playByIndex(0);
armature->setPosition(VisibleRect::center());
- armature->setScale(0.6);
+ armature->setScale(0.2f);
addChild(armature);
}
std::string TestBoundingBox::title()
@@ -622,10 +595,10 @@ void TestAnchorPoint::onEnter()
for (int i = 0; i<5; i++)
{
- cocos2d::extension::CCArmature *armature = cocos2d::extension::CCArmature::create("Zombie_f/Zombie");
+ cocos2d::extension::CCArmature *armature = cocos2d::extension::CCArmature::create("Cowboy");
armature->getAnimation()->playByIndex(0);
armature->setPosition(VisibleRect::center());
- armature->setScale(0.6);
+ armature->setScale(0.2f);
addChild(armature, 0, i);
}
@@ -650,7 +623,7 @@ void TestArmatureNesting::onEnter()
armature = cocos2d::extension::CCArmature::create("cyborg");
armature->getAnimation()->playByIndex(1);
armature->setPosition(VisibleRect::center());
- armature->setScale(1.2);
+ armature->setScale(1.2f);
armature->getAnimation()->setAnimationScale(0.4f);
addChild(armature);
diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.h b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.h
index 88064b3075..a998d1f990 100644
--- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.h
+++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/ArmatureTest/ArmatureScene.h
@@ -18,10 +18,9 @@ public:
};
enum {
- TEST_DRAGON_BONES_2_0 = 0,
- TEST_COCOSTUDIO_WITH_SKELETON,
+ TEST_COCOSTUDIO_WITH_SKELETON = 0,
TEST_COCOSTUDIO_WITHOUT_SKELETON,
- TEST_COCOSTUDIO_WITH_CONVERT_FROM_DRAGON_BONES_2_0,
+ TEST_DRAGON_BONES_2_0,
TEST_PERFORMANCE,
TEST_CHANGE_ZORDER,
TEST_ANIMATION_EVENT,
@@ -74,11 +73,6 @@ class TestCSWithoutSkeleton : public ArmatureTestLayer
virtual std::string title();
};
-class TestCSContertFromDragonBone : public ArmatureTestLayer
-{
- virtual void onEnter();
- virtual std::string title();
-};
class TestPerformance : public ArmatureTestLayer
{
diff --git a/samples/Cpp/TestCpp/Resources/armature/Dragon.xml b/samples/Cpp/TestCpp/Resources/armature/Dragon.xml
index cce037e12e..661b23009a 100644
--- a/samples/Cpp/TestCpp/Resources/armature/Dragon.xml
+++ b/samples/Cpp/TestCpp/Resources/armature/Dragon.xml
@@ -192,7 +192,7 @@
-
+
diff --git a/samples/Cpp/TestCpp/Resources/armature/Example08.png.REMOVED.git-id b/samples/Cpp/TestCpp/Resources/armature/Example08.png.REMOVED.git-id
deleted file mode 100644
index a85729547d..0000000000
--- a/samples/Cpp/TestCpp/Resources/armature/Example08.png.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-c1643e8570d37021a52c7ab98e933ce1f7ef67a4
\ No newline at end of file
diff --git a/samples/Cpp/TestCpp/Resources/armature/Example08.xml b/samples/Cpp/TestCpp/Resources/armature/Example08.xml
deleted file mode 100644
index fb91072328..0000000000
--- a/samples/Cpp/TestCpp/Resources/armature/Example08.xml
+++ /dev/null
@@ -1,671 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/samples/Cpp/TestCpp/Resources/armature/zamboni.json.REMOVED.git-id b/samples/Cpp/TestCpp/Resources/armature/zamboni.json.REMOVED.git-id
deleted file mode 100644
index 2624242891..0000000000
--- a/samples/Cpp/TestCpp/Resources/armature/zamboni.json.REMOVED.git-id
+++ /dev/null
@@ -1 +0,0 @@
-0ea77d3208689fa8ec88d25447c7d4ad4e576dec
\ No newline at end of file
diff --git a/samples/Cpp/TestCpp/Resources/hd/armature/Cowboy0.png.REMOVED.git-id b/samples/Cpp/TestCpp/Resources/hd/armature/Cowboy0.png.REMOVED.git-id
new file mode 100644
index 0000000000..1ab13aff50
--- /dev/null
+++ b/samples/Cpp/TestCpp/Resources/hd/armature/Cowboy0.png.REMOVED.git-id
@@ -0,0 +1 @@
+06fb5524ddc56e1aaa5872fae8b646a97345f6fe
\ No newline at end of file
diff --git a/samples/Cpp/TestCpp/Resources/hd/armature/Dragon.png.REMOVED.git-id b/samples/Cpp/TestCpp/Resources/hd/armature/Dragon.png.REMOVED.git-id
new file mode 100644
index 0000000000..b9eaf3b45c
--- /dev/null
+++ b/samples/Cpp/TestCpp/Resources/hd/armature/Dragon.png.REMOVED.git-id
@@ -0,0 +1 @@
+b3722fe7346fd4c7d697d59c67881fc5bd23f093
\ No newline at end of file
diff --git a/samples/Cpp/TestCpp/Resources/hd/armature/TestBone0.png.REMOVED.git-id b/samples/Cpp/TestCpp/Resources/hd/armature/TestBone0.png.REMOVED.git-id
new file mode 100644
index 0000000000..1ab13aff50
--- /dev/null
+++ b/samples/Cpp/TestCpp/Resources/hd/armature/TestBone0.png.REMOVED.git-id
@@ -0,0 +1 @@
+06fb5524ddc56e1aaa5872fae8b646a97345f6fe
\ No newline at end of file
diff --git a/samples/Cpp/TestCpp/Resources/hd/armature/weapon.png.REMOVED.git-id b/samples/Cpp/TestCpp/Resources/hd/armature/weapon.png.REMOVED.git-id
new file mode 100644
index 0000000000..54a23316b4
--- /dev/null
+++ b/samples/Cpp/TestCpp/Resources/hd/armature/weapon.png.REMOVED.git-id
@@ -0,0 +1 @@
+14e32519407e2d33461100c302413f3d1f2fd540
\ No newline at end of file