mirror of https://github.com/axmolengine/axmol.git
Merge pull request #6714 from Dhilan007/v3_nodefix
Fix a bug that if a node changes parent, parent's matrix will not update to reflect this change.
This commit is contained in:
commit
0171e27747
|
@ -815,6 +815,8 @@
|
|||
3EA0FB5E191B92F100B170C8 /* cocosvideo.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */; };
|
||||
3EA0FB66191B933000B170C8 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; };
|
||||
3EA0FB72191C844400B170C8 /* UIVideoPlayerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EA0FB70191C844400B170C8 /* UIVideoPlayerTest.cpp */; };
|
||||
59620E8F1921E5CF002021B6 /* Bug-Child.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59620E8D1921E5CF002021B6 /* Bug-Child.cpp */; };
|
||||
59620E901921E5CF002021B6 /* Bug-Child.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59620E8D1921E5CF002021B6 /* Bug-Child.cpp */; };
|
||||
A05FCACA177C124500BE600E /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64822165F391E007D4F18 /* Cocoa.framework */; };
|
||||
A07A521E1783A1D20073F6A7 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C6482E165F399D007D4F18 /* libz.dylib */; };
|
||||
A07A521F1783A1D20073F6A7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64832165F3AFD007D4F18 /* Foundation.framework */; };
|
||||
|
@ -1852,6 +1854,8 @@
|
|||
3EA0FB70191C844400B170C8 /* UIVideoPlayerTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIVideoPlayerTest.cpp; sourceTree = "<group>"; };
|
||||
3EA0FB71191C844400B170C8 /* UIVideoPlayerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIVideoPlayerTest.h; sourceTree = "<group>"; };
|
||||
46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = cocos2d_libs.xcodeproj; sourceTree = "<group>"; };
|
||||
59620E8D1921E5CF002021B6 /* Bug-Child.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "Bug-Child.cpp"; sourceTree = "<group>"; };
|
||||
59620E8E1921E5CF002021B6 /* Bug-Child.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bug-Child.h"; sourceTree = "<group>"; };
|
||||
70A7F72D191D3E4900F0F206 /* shaderTest.psh.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = shaderTest.psh.h; sourceTree = "<group>"; };
|
||||
70A7F730191D421B00F0F206 /* ShaderTest.vsh.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShaderTest.vsh.h; sourceTree = "<group>"; };
|
||||
A035A71117822E9E00987F6C /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
|
||||
|
@ -2425,6 +2429,8 @@
|
|||
1AC3598B18CECF0B00F37B72 /* Bug-914.h */,
|
||||
1AC3598C18CECF0B00F37B72 /* BugsTest.cpp */,
|
||||
1AC3598D18CECF0B00F37B72 /* BugsTest.h */,
|
||||
59620E8D1921E5CF002021B6 /* Bug-Child.cpp */,
|
||||
59620E8E1921E5CF002021B6 /* Bug-Child.h */,
|
||||
);
|
||||
path = BugsTest;
|
||||
sourceTree = "<group>";
|
||||
|
@ -4588,6 +4594,7 @@
|
|||
1AC35C3118CECF0C00F37B72 /* PerformanceRendererTest.cpp in Sources */,
|
||||
1AC35C4518CECF0C00F37B72 /* SceneTest.cpp in Sources */,
|
||||
1AC35B6F18CECF0C00F37B72 /* MenuTestLayer.cpp in Sources */,
|
||||
59620E8F1921E5CF002021B6 /* Bug-Child.cpp in Sources */,
|
||||
29080DCD191B595E0066F8DF /* UIScrollViewTest_Editor.cpp in Sources */,
|
||||
1AC35B5118CECF0C00F37B72 /* ClippingNodeTest.cpp in Sources */,
|
||||
1AC35C1318CECF0C00F37B72 /* LayerTest.cpp in Sources */,
|
||||
|
@ -4880,6 +4887,7 @@
|
|||
1AC35B3018CECF0C00F37B72 /* Box2dView.cpp in Sources */,
|
||||
29080DAE191B595E0066F8DF /* UIImageViewTest.cpp in Sources */,
|
||||
1AC35C1018CECF0C00F37B72 /* LabelTest.cpp in Sources */,
|
||||
59620E901921E5CF002021B6 /* Bug-Child.cpp in Sources */,
|
||||
29080DC8191B595E0066F8DF /* UISceneManager.cpp in Sources */,
|
||||
1AC35C6A18CECF0C00F37B72 /* VisibleRect.cpp in Sources */,
|
||||
1AC35C4018CECF0C00F37B72 /* ReleasePoolTest.cpp in Sources */,
|
||||
|
|
|
@ -915,6 +915,7 @@ void Node::detachChild(Node *child, ssize_t childIndex, bool doCleanup)
|
|||
// helper used by reorderChild & add
|
||||
void Node::insertChild(Node* child, int z)
|
||||
{
|
||||
_transformUpdated = true;
|
||||
_reorderChildDirty = true;
|
||||
_children.pushBack(child);
|
||||
child->_setLocalZOrder(z);
|
||||
|
|
|
@ -31,6 +31,7 @@ Classes/BugsTest/Bug-886.cpp \
|
|||
Classes/BugsTest/Bug-899.cpp \
|
||||
Classes/BugsTest/Bug-914.cpp \
|
||||
Classes/BugsTest/BugsTest.cpp \
|
||||
Classes/BugsTest/Bug-Child.cpp \
|
||||
Classes/BugsTest/Bug-458/Bug-458.cpp \
|
||||
Classes/BugsTest/Bug-458/QuestionContainerSprite.cpp \
|
||||
Classes/ChipmunkTest/ChipmunkTest.cpp \
|
||||
|
|
|
@ -35,6 +35,7 @@ set(SAMPLE_SRC
|
|||
Classes/BugsTest/Bug-899.cpp
|
||||
Classes/BugsTest/Bug-914.cpp
|
||||
Classes/BugsTest/BugsTest.cpp
|
||||
Classes/BugsTest/Bug-Child.cpp
|
||||
Classes/ChipmunkTest/ChipmunkTest.cpp
|
||||
Classes/ClickAndMoveTest/ClickAndMoveTest.cpp
|
||||
Classes/ClippingNodeTest/ClippingNodeTest.cpp
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
//
|
||||
// Bug-Child.cpp
|
||||
// cocos2d_tests
|
||||
//
|
||||
// Created by NiTe Luo on 5/12/14.
|
||||
//
|
||||
//
|
||||
|
||||
#include "Bug-Child.h"
|
||||
|
||||
Scene* BugChild::scene()
|
||||
{
|
||||
// 'scene' is an autorelease object.
|
||||
auto scene = Scene::create();
|
||||
// 'layer' is an autorelease object.
|
||||
auto layer = BugChild::create();
|
||||
|
||||
// add layer as a child to scene
|
||||
scene->addChild(layer);
|
||||
|
||||
// return the scene
|
||||
return scene;
|
||||
}
|
||||
|
||||
bool BugChild::init()
|
||||
{
|
||||
if (BugsTestBaseLayer::init())
|
||||
{
|
||||
auto size = Director::getInstance()->getWinSize();
|
||||
|
||||
// create and initialize a Label
|
||||
auto item1 = MenuItemFont::create("Switch Child", CC_CALLBACK_1(BugChild::switchChild, this));
|
||||
|
||||
menu = Menu::create(item1, nullptr);
|
||||
|
||||
menu->alignItemsVertically();
|
||||
menu->setPosition(size.width/2, 100);
|
||||
addChild(menu);
|
||||
|
||||
parent1 = Sprite::create("Images/grossini.png");
|
||||
parent1->setPosition(size.width/4, size.height/2);
|
||||
addChild(parent1);
|
||||
|
||||
parent2 = Sprite::create("Images/grossinis_sister1.png");
|
||||
parent2->setPosition(size.width*3/4, size.height/2);
|
||||
addChild(parent2);
|
||||
|
||||
child = Sprite::create("Images/grossinis_sister2.png");
|
||||
child->setPosition(20, 20);
|
||||
child->retain();
|
||||
parent1->addChild(child);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void BugChild::switchChild(Ref *sender)
|
||||
{
|
||||
if(parent1->getChildrenCount() > 0)
|
||||
{
|
||||
parent1->removeChild(child, false);
|
||||
parent2->addChild(child);
|
||||
CCLOG("Child attached to parent2");
|
||||
}
|
||||
else
|
||||
{
|
||||
parent2->removeChild(child, false);
|
||||
parent1->addChild(child);
|
||||
CCLOG("Child attached to parent1");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
//
|
||||
// Bug-Child.h
|
||||
// cocos2d_tests
|
||||
//
|
||||
// Created by NiTe Luo on 5/12/14.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef __Bug_Child__
|
||||
#define __Bug_Child__
|
||||
|
||||
#include "BugsTest.h"
|
||||
|
||||
class BugChild : public BugsTestBaseLayer
|
||||
{
|
||||
public:
|
||||
static Scene* scene();
|
||||
virtual bool init();
|
||||
|
||||
void switchChild(Ref* sender);
|
||||
|
||||
CREATE_FUNC(BugChild);
|
||||
|
||||
protected:
|
||||
|
||||
Sprite* parent1;
|
||||
Sprite* parent2;
|
||||
|
||||
Sprite* child;
|
||||
|
||||
Menu* menu;
|
||||
};
|
||||
|
||||
#endif /* defined(__Bug_Child__) */
|
|
@ -8,6 +8,7 @@
|
|||
#include "Bug-914.h"
|
||||
#include "Bug-1159.h"
|
||||
#include "Bug-1174.h"
|
||||
#include "Bug-Child.h"
|
||||
|
||||
#define TEST_BUG(__bug__) \
|
||||
{ \
|
||||
|
@ -31,6 +32,7 @@ struct {
|
|||
const char *test_name;
|
||||
std::function<void(Ref*)> callback;
|
||||
} g_bugs[] = {
|
||||
{ "Bug-Child", [](Ref* sender){Director::getInstance()->replaceScene(BugChild::scene());} },
|
||||
{ "Bug-350", [](Ref* sender){ TEST_BUG(350)} },
|
||||
{ "Bug-422", [](Ref* sender){ TEST_BUG(422)} },
|
||||
{ "Bug-458", [](Ref* sender){ TEST_BUG(458)} },
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
|
@ -32,8 +32,8 @@
|
|||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -141,6 +141,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\external\websockets\prebuilt\win32\*.*" "$(Ou
|
|||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Classes\BaseTest.cpp" />
|
||||
<ClCompile Include="..\Classes\BugsTest\Bug-Child.cpp" />
|
||||
<ClCompile Include="..\Classes\ChipmunkTest\ChipmunkTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ClippingNodeTest\ClippingNodeTest.cpp" />
|
||||
<ClCompile Include="..\Classes\ConfigurationTest\ConfigurationTest.cpp" />
|
||||
|
@ -320,6 +321,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\external\websockets\prebuilt\win32\*.*" "$(Ou
|
|||
<ClInclude Include="..\Classes\Box2DTestBed\Tests\Mobile.h" />
|
||||
<ClInclude Include="..\Classes\Box2DTestBed\Tests\MobileBalanced.h" />
|
||||
<ClInclude Include="..\Classes\Box2DTestBed\Tests\MotorJoint.h" />
|
||||
<ClInclude Include="..\Classes\BugsTest\Bug-Child.h" />
|
||||
<ClInclude Include="..\Classes\ChipmunkTest\ChipmunkTest.h" />
|
||||
<ClInclude Include="..\Classes\ClippingNodeTest\ClippingNodeTest.h" />
|
||||
<ClInclude Include="..\Classes\ConfigurationTest\ConfigurationTest.h" />
|
||||
|
|
|
@ -849,6 +849,9 @@
|
|||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIWidgetAddNodeTest\UIWidgetAddNodeTest_Editor.cpp">
|
||||
<Filter>Classes\UITest\CocostudioGUISceneTest\UIWidgetAddNodeTest</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\BugsTest\Bug-Child.cpp">
|
||||
<Filter>Classes\BugsTest</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="main.h">
|
||||
|
@ -1565,5 +1568,8 @@
|
|||
<ClInclude Include="..\Classes\UITest\CocoStudioGUITest\UIWidgetAddNodeTest\UIWidgetAddNodeTest_Editor.h">
|
||||
<Filter>Classes\UITest\CocostudioGUISceneTest\UIWidgetAddNodeTest</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\BugsTest\Bug-Child.h">
|
||||
<Filter>Classes\BugsTest</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue