Skip to content

Commit

Permalink
Merge pull request cocos#33 from 2youyou2/v2.3.0-fixed-bugs
Browse files Browse the repository at this point in the history
fixed bugs
  • Loading branch information
2youyou2 committed Jul 12, 2019
2 parents 26ef8fc + ace0841 commit 039ed38
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
4 changes: 4 additions & 0 deletions cocos2d/core/components/CCMotionStreak.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ var MotionStreak = cc.Class({
if (CC_EDITOR) {
cc.engine.repaintInEditMode();
}
},

update (dt) {
this._assembler.update(this, dt);
}
});

Expand Down
11 changes: 4 additions & 7 deletions cocos2d/core/components/CCRenderComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,7 @@ let RenderComponent = cc.Class({
this.setVertsDirty(true);
Assembler.init(this);

if (CC_JSB) {
this._updateColor();
}
else {
this.node._renderFlag |= RenderFlow.FLAG_OPACITY;
}
this._updateColor();
},

__preload () {
Expand All @@ -104,7 +99,7 @@ let RenderComponent = cc.Class({
this.node.on(cc.Node.EventType.ANCHOR_CHANGED, this._onNodeSizeDirty, this);
this.node.on(cc.Node.EventType.COLOR_CHANGED, this._updateColor, this);

this.node._renderFlag |= RenderFlow.FLAG_RENDER | RenderFlow.FLAG_UPDATE_RENDER_DATA;
this.node._renderFlag |= RenderFlow.FLAG_RENDER | RenderFlow.FLAG_UPDATE_RENDER_DATA | RenderFlow.FLAG_OPACITY;
},

onDisable () {
Expand Down Expand Up @@ -214,6 +209,8 @@ let RenderComponent = cc.Class({
if (this._assembler.updateColor) {
this._assembler.updateColor(this);
}

this.node._renderFlag &= ~RenderFlow.FLAG_OPACITY;
}
});

Expand Down
4 changes: 3 additions & 1 deletion cocos2d/core/renderer/render-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ _proto._opacity = function (node) {
_batcher.parentOpacityDirty++;

let comp = node._renderComponent;
if (comp && comp._updateColor) comp._updateColor();
if (comp) {
comp._updateColor();
}

node._renderFlag &= ~OPACITY;
this._next._func(node);
Expand Down
5 changes: 0 additions & 5 deletions cocos2d/core/renderer/webgl/assemblers/motion-streak.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ export default class MotionStreakAssembler extends Assembler2D {
this._renderData.createFlexData(0, 16, (16 - 2) * 3);
}

updateRenderData (comp) {
let dt = cc.director.getDeltaTime();
this.update(comp, dt);
}

update (comp, dt) {
if (CC_EDITOR && !comp.preview) return;

Expand Down

0 comments on commit 039ed38

Please sign in to comment.