Merge pull request #71 from knoxHuang/master

fix create sprite can not add atlas
This commit is contained in:
Jare Guo
2015-12-17 22:44:05 +08:00
+5 -8
View File
@@ -77,9 +77,6 @@ var SpriteRenderer = cc.Class({
if (force) {
this._sgNode._scale9Image = null;
}
// Set atlas
this._applyAtlas(value);
}
this._applySprite(this._sgNode, lastSprite);
// color cleared after reset texture, should reapply color
@@ -445,13 +442,9 @@ var SpriteRenderer = cc.Class({
_applyAtlas: CC_EDITOR && function ( sprite ) {
// Set atlas
if (sprite._atlasUuid !== undefined) {
if (sprite._atlasUuid) {
var self = this;
cc.AssetLibrary.loadAsset(sprite._atlasUuid, function(err, asset) {
if (!asset) {
self._atlas = null;
return;
}
self._atlas = asset;
});
} else {
@@ -500,6 +493,10 @@ var SpriteRenderer = cc.Class({
this._applyCapInset(sgNode);
this._applySpriteSize(sgNode);
}
if (CC_EDITOR) {
// Set atlas
this._applyAtlas(this._sprite);
}
},
_createSgNode: function () {