mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-03 17:42:41 +08:00
move code to onRestore
This commit is contained in:
@@ -2460,15 +2460,6 @@ var Node = cc.Class({
|
||||
var self = this;
|
||||
var sgNode = self._sgNode;
|
||||
|
||||
// `active` must synchronize to component
|
||||
for (var i=0; i<this._components.length; i++) {
|
||||
var comp = this._components[i];
|
||||
if (!comp || !comp._sgNode) {
|
||||
continue;
|
||||
}
|
||||
comp._sgNode.visible = this.active;
|
||||
}
|
||||
|
||||
sgNode.setPosition(self._position);
|
||||
sgNode.setRotationX(self._rotationX);
|
||||
sgNode.setRotationY(self._rotationY);
|
||||
@@ -2514,6 +2505,15 @@ var Node = cc.Class({
|
||||
_removeSgNode: SgHelper.removeSgNode,
|
||||
|
||||
onRestore: CC_EDITOR && function () {
|
||||
// `active` must synchronize to component
|
||||
for (var i=0; i<this._components.length; i++) {
|
||||
var comp = this._components[i];
|
||||
if (!comp || !comp._sgNode) {
|
||||
continue;
|
||||
}
|
||||
comp._sgNode.visible = this.active;
|
||||
}
|
||||
|
||||
this._updateDummySgNode();
|
||||
|
||||
var sizeProvider = this._sizeProvider;
|
||||
|
||||
Reference in New Issue
Block a user