mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Merge pull request #71 from knoxHuang/master
fix create sprite can not add atlas
This commit is contained in:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user