fix blend serialization for sprite

This commit is contained in:
Huabing.Xu
2016-03-01 11:27:51 +08:00
parent 3e39f1280e
commit ae1d0cea71
+9 -3
View File
@@ -75,7 +75,7 @@ var Sprite = cc.Class({
},
ctor: function() {
this._blendFunc = cc.BlendFunc.ALPHA_NON_PREMULTIPLIED;
this._blendFunc = new cc.BlendFunc(this._srcBlendFactor, this._dstBlendFactor);
},
properties: {
@@ -92,6 +92,8 @@ var Sprite = cc.Class({
_fillStart: 0,
_fillRange: 0,
_isTrimmedMode: true,
_srcBlendFactor: BlendFactor.SRC_ALPHA,
_dstBlendFactor: BlendFactor.ONE_MINUS_SRC_ALPHA,
/**
* The Sprite Atlas.
* @property _atlas
@@ -215,9 +217,10 @@ var Sprite = cc.Class({
*/
srcBlendFactor: {
get: function() {
return this._blendFunc.src;
return this._srcBlendFactor;
},
set: function(value) {
this._srcBlendFactor = value;
this._blendFunc.src = value;
this._sgNode.setBlendFunc(this._blendFunc);
},
@@ -232,9 +235,10 @@ var Sprite = cc.Class({
*/
dstBlendFactor: {
get: function() {
return this._blendFunc.dst;
return this._dstBlendFactor;
},
set: function(value) {
this._dstBlendFactor = value;
this._blendFunc.dst = value;
this._sgNode.setBlendFunc(this._blendFunc);
},
@@ -567,6 +571,8 @@ var Sprite = cc.Class({
sgNode.setFillStart(this._fillStart);
sgNode.setFillRange(this._fillRange);
sgNode.enableTrimmedContentSize(this._isTrimmedMode);
this._blendFunc.src = this._srcBlendFactor;
this._blendFunc.dst = this._dstBlendFactor;
sgNode.setBlendFunc(this._blendFunc);
},