mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 03:22:39 +08:00
Fix color overwriting issue when sprite frame change (#2857)
* Fix color overwriting issue when sprite frame change * Fix _localMatDirty type alter issue
This commit is contained in:
@@ -2942,7 +2942,8 @@ var Node = cc.Class({
|
||||
this._worldMatrix = mathPools.mat4.get();
|
||||
}
|
||||
|
||||
this._localMatDirty = this._worldMatDirty = true;
|
||||
this._localMatDirty = LocalDirtyFlag.ALL;
|
||||
this._worldMatDirty = true;
|
||||
|
||||
this._renderFlag |= RenderFlow.FLAG_TRANSFORM;
|
||||
if (this._renderComponent) {
|
||||
|
||||
@@ -107,7 +107,7 @@ let RenderComponent = cc.Class({
|
||||
},
|
||||
|
||||
disableRender () {
|
||||
this.node._renderFlag &= ~(RenderFlow.FLAG_RENDER | cc.RenderFlow.FLAG_CUSTOM_IA_RENDER | RenderFlow.FLAG_UPDATE_RENDER_DATA | RenderFlow.FLAG_COLOR);
|
||||
this.node._renderFlag &= ~(RenderFlow.FLAG_RENDER | RenderFlow.FLAG_CUSTOM_IA_RENDER | RenderFlow.FLAG_UPDATE_RENDER_DATA | RenderFlow.FLAG_COLOR);
|
||||
},
|
||||
|
||||
requestRenderData () {
|
||||
|
||||
@@ -542,15 +542,16 @@ var Sprite = cc.Class({
|
||||
if (this._state === State.GRAY) {
|
||||
if (!this._graySpriteMaterial) {
|
||||
this._graySpriteMaterial = new GraySpriteMaterial();
|
||||
this.node._renderFlag |= RenderFlow.FLAG_COLOR;
|
||||
}
|
||||
material = this._graySpriteMaterial;
|
||||
}
|
||||
else {
|
||||
if (!this._spriteMaterial) {
|
||||
this._spriteMaterial = new SpriteMaterial();
|
||||
this.node._renderFlag |= RenderFlow.FLAG_COLOR;
|
||||
}
|
||||
material = this._spriteMaterial;
|
||||
material.color = this.node.color;
|
||||
}
|
||||
// TODO: old texture in material have been released by loader
|
||||
material.texture = texture;
|
||||
|
||||
Reference in New Issue
Block a user