From 935b0f006b7849d89d23c04689f01d66a41935b3 Mon Sep 17 00:00:00 2001 From: XiaoFeng Date: Thu, 20 Aug 2015 10:55:30 +0800 Subject: [PATCH 1/3] Fix https://github.com/cocos2d/cocos2d-x/issues/10205 --- .../editor-support/cocostudio/CCSGUIReader.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCSGUIReader.cpp b/cocos/editor-support/cocostudio/CCSGUIReader.cpp index e7701289f8..863349ab91 100644 --- a/cocos/editor-support/cocostudio/CCSGUIReader.cpp +++ b/cocos/editor-support/cocostudio/CCSGUIReader.cpp @@ -764,7 +764,11 @@ void WidgetPropertiesReader0250::setPropsForButtonFromJsonDictionary(Widget*widg bool fn = DICTOOL->checkObjectExist_json(options, "fontName"); if (fn) { - button->setTitleFontName(DICTOOL->getStringValue_json(options, "fontName")); + const char * szTemp = DICTOOL->getStringValue_json(options, "fontName"); + if (szTemp && *szTemp) + button->setTitleFontName(szTemp); + else + button->setTitleFontName(std::string("")); } setColorPropsForWidgetFromJsonDictionary(widget,options); } @@ -882,7 +886,11 @@ void WidgetPropertiesReader0250::setPropsForLabelFromJsonDictionary(Widget*widge bool fn = DICTOOL->checkObjectExist_json(options, "fontName"); if (fn) { - label->setFontName(DICTOOL->getStringValue_json(options, "fontName")); + const char * szTemp = DICTOOL->getStringValue_json(options, "fontName"); + if (szTemp && *szTemp) + label->setFontName(szTemp); + else + label->setFontName(std::string("")); } bool aw = DICTOOL->checkObjectExist_json(options, "areaWidth"); bool ah = DICTOOL->checkObjectExist_json(options, "areaHeight"); @@ -1105,7 +1113,11 @@ void WidgetPropertiesReader0250::setPropsForTextFieldFromJsonDictionary(Widget*w bool fn = DICTOOL->checkObjectExist_json(options, "fontName"); if (fn) { - textField->setFontName(DICTOOL->getStringValue_json(options, "fontName")); + const char * szTemp = DICTOOL->getStringValue_json(options, "fontName"); + if (szTemp && *szTemp) + textField->setFontName(szTemp); + else + textField->setFontName(std::string("")); } bool tsw = DICTOOL->checkObjectExist_json(options, "touchSizeWidth"); bool tsh = DICTOOL->checkObjectExist_json(options, "touchSizeHeight"); From 93f026f8e6077c922f2d5d978329d77734d33158 Mon Sep 17 00:00:00 2001 From: XiaoFeng Date: Thu, 20 Aug 2015 11:18:59 +0800 Subject: [PATCH 2/3] Fix https://github.com/cocos2d/cocos2d-x/issues/9488 --- cocos/editor-support/cocostudio/CCBone.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCBone.cpp b/cocos/editor-support/cocostudio/CCBone.cpp index 4b217141b5..a13469cc8e 100644 --- a/cocos/editor-support/cocostudio/CCBone.cpp +++ b/cocos/editor-support/cocostudio/CCBone.cpp @@ -257,13 +257,15 @@ void Bone::setBlendFunc(const BlendFunc& blendFunc) void Bone::updateDisplayedColor(const Color3B &parentColor) { - _realColor = Color3B(255, 255, 255); + // remove comment mark for next line when use in studio +// _realColor = Color3B(255, 255, 255); Node::updateDisplayedColor(parentColor); } void Bone::updateDisplayedOpacity(GLubyte parentOpacity) { - _realOpacity = 255; + // remove comment mark for next line when use in studio +// _realOpacity = 255; Node::updateDisplayedOpacity(parentOpacity); } From 6bdb5431f1bf2c6c4a5cf81826f3947c1c814a40 Mon Sep 17 00:00:00 2001 From: XiaoFeng Date: Thu, 20 Aug 2015 13:33:48 +0800 Subject: [PATCH 3/3] Update code, using condition macro to determine studio or user project --- cocos/editor-support/cocostudio/CCBone.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCBone.cpp b/cocos/editor-support/cocostudio/CCBone.cpp index a13469cc8e..45ac09416b 100644 --- a/cocos/editor-support/cocostudio/CCBone.cpp +++ b/cocos/editor-support/cocostudio/CCBone.cpp @@ -257,15 +257,17 @@ void Bone::setBlendFunc(const BlendFunc& blendFunc) void Bone::updateDisplayedColor(const Color3B &parentColor) { - // remove comment mark for next line when use in studio -// _realColor = Color3B(255, 255, 255); +#ifdef CC_STUDIO_ENABLED_VIEW + _realColor = Color3B(255, 255, 255); +#endif // CC_STUDIO_ENABLED_VIEW Node::updateDisplayedColor(parentColor); } void Bone::updateDisplayedOpacity(GLubyte parentOpacity) { - // remove comment mark for next line when use in studio -// _realOpacity = 255; +#ifdef CC_STUDIO_ENABLED_VIEW + _realOpacity = 255; +#endif // CC_STUDIO_ENABLED_VIEW Node::updateDisplayedOpacity(parentOpacity); }