From aa6f2ec4b60f08314a36925897deb06a534e76c8 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 20 Aug 2015 11:27:01 +0800 Subject: [PATCH 1/2] fix object size error while data is error --- .../WidgetReader/GameMapReader/GameMapReader.cpp | 3 +++ .../cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp index 476fa9b59e..f75e4780f5 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp @@ -235,7 +235,10 @@ namespace cocostudio tmx = TMXTiledMap::create(path); if (tmx) { + //先保存资源的尺寸,等编辑器的数据设置完成后,再刷回资源尺寸,防止数据中尺寸和资源部匹配 + Size fileSize = tmx->getContentSize(); setPropsWithFlatBuffers(tmx, (Table*)gameMapOptions); + tmx->setContentSize(fileSize); } } else diff --git a/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp index 830a6a0d9f..269dfe462c 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp @@ -167,6 +167,8 @@ namespace cocostudio Sprite *sprite = static_cast(node); auto options = (SpriteOptions*)spriteOptions; + auto nodeReader = NodeReader::getInstance(); + nodeReader->setPropsWithFlatBuffers(node, (Table*)(options->nodeOptions())); auto fileNameData = options->fileNameData(); @@ -242,11 +244,6 @@ namespace cocostudio sprite->setBlendFunc(blendFunc); } - - auto nodeReader = NodeReader::getInstance(); - nodeReader->setPropsWithFlatBuffers(node, (Table*)(options->nodeOptions())); - - auto nodeOptions = options->nodeOptions(); GLubyte alpha = (GLubyte)nodeOptions->color()->a(); From 788be3016a7c8e18d5279a0aef72da0b7531e172 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 20 Aug 2015 18:04:49 +0800 Subject: [PATCH 2/2] update annotation --- .../cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp index f75e4780f5..b367709f92 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp @@ -235,7 +235,7 @@ namespace cocostudio tmx = TMXTiledMap::create(path); if (tmx) { - //先保存资源的尺寸,等编辑器的数据设置完成后,再刷回资源尺寸,防止数据中尺寸和资源部匹配 + //prevent that editor's data does not match in size and resources Size fileSize = tmx->getContentSize(); setPropsWithFlatBuffers(tmx, (Table*)gameMapOptions); tmx->setContentSize(fileSize);