From c068e60aa624d26cee651541b42c8a837974f69d Mon Sep 17 00:00:00 2001 From: pipu Date: Mon, 23 Mar 2015 13:37:24 +0800 Subject: [PATCH] Reconstruct ColorFrame. --- .../ActionTimeline/CCActionTimelineCache.cpp | 2 -- .../cocostudio/ActionTimeline/CCFrame.cpp | 12 ++---------- .../cocostudio/ActionTimeline/CCFrame.h | 5 ----- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp index 23fef4f2ba..d6b9ed2d73 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp @@ -350,12 +350,10 @@ Frame* ActionTimelineCache::loadColorFrame(const rapidjson::Value& json) { ColorFrame* frame = ColorFrame::create(); - GLubyte alpha = (GLubyte)DICTOOL->getIntValue_json(json, ALPHA); GLubyte red = (GLubyte)DICTOOL->getIntValue_json(json, RED); GLubyte green = (GLubyte)DICTOOL->getIntValue_json(json, GREEN); GLubyte blue = (GLubyte)DICTOOL->getIntValue_json(json, BLUE); - frame->setAlpha(alpha); frame->setColor(Color3B(red, green, blue)); return frame; diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp index 44b5c08002..4c80abdc2c 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.cpp @@ -595,20 +595,16 @@ ColorFrame* ColorFrame::create() } ColorFrame::ColorFrame() - : _alpha(255) - , _color(Color3B(255, 255, 255)) +: _color(Color3B(255, 255, 255)) { } void ColorFrame::onEnter(Frame *nextFrame, int currentFrameIndex) { - _node->setOpacity(_alpha); _node->setColor(_color); if(_tween) { - _betweenAlpha = static_cast(nextFrame)->_alpha - _alpha; - const Color3B& color = static_cast(nextFrame)->_color; _betweenRed = color.r - _color.r; _betweenGreen = color.g - _color.g; @@ -618,16 +614,13 @@ void ColorFrame::onEnter(Frame *nextFrame, int currentFrameIndex) void ColorFrame::apply(float percent) { - if (_tween && (_betweenAlpha !=0 || _betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0)) + if (_tween && (_betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0)) { - GLubyte alpha = _alpha + _betweenAlpha * percent; - Color3B color; color.r = _color.r+ _betweenRed * percent; color.g = _color.g+ _betweenGreen * percent; color.b = _color.b+ _betweenBlue * percent; - _node->setOpacity(alpha); _node->setColor(color); } } @@ -635,7 +628,6 @@ void ColorFrame::apply(float percent) Frame* ColorFrame::clone() { ColorFrame* frame = ColorFrame::create(); - frame->setAlpha(_alpha); frame->setColor(_color); frame->cloneProperty(this); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h index 53aa8559ca..7d3606494c 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCFrame.h @@ -299,17 +299,12 @@ public: virtual void apply(float percent) override; virtual Frame* clone() override; - inline void setAlpha(GLubyte alpha) { _alpha = alpha; } - inline GLubyte getAlpha() const { return _alpha; } - inline void setColor(const cocos2d::Color3B& color) { _color = color; } inline cocos2d::Color3B getColor() const { return _color; } protected: - GLubyte _alpha; cocos2d::Color3B _color; - int _betweenAlpha; int _betweenRed; int _betweenGreen; int _betweenBlue;