Merge pull request #2647 from pandamicro/next

Improve Node/Component _id management
This commit is contained in:
Jare Guo
2018-05-08 19:36:46 +08:00
committed by GitHub
3 changed files with 7 additions and 4 deletions
+6
View File
@@ -578,6 +578,9 @@ var _Deserializer = (function () {
// parse the serialized data as primitive javascript object, so its __id__ will be dereferenced
sources.push('s._deserializePrimitiveObject(o._$erialized,d);');
}
if (cc.js.isChildClassOf(klass, cc._BaseNode) || cc.js.isChildClassOf(klass, cc.Component)) {
sources.push('o._id=d._id;');
}
return Function('s', 'o', 'd', 'k', 't', sources.join(''));
} : function (self, klass) {
var TYPE = Attr.DELIMETER + 'type';
@@ -655,6 +658,9 @@ var _Deserializer = (function () {
// parse the serialized data as primitive javascript object, so its __id__ will be dereferenced
s._deserializePrimitiveObject(o._$erialized,d);
}
if ((o instanceof cc._BaseNode) || (o instanceof cc.Component)) {
o._id = d._id;
}
}
};
-3
View File
@@ -175,9 +175,6 @@ function enumerateCCClass (klass, obj, clone, parent) {
}
}
}
if ((CC_EDITOR || CC_TEST) && (obj instanceof cc._BaseNode || obj instanceof cc.Component)) {
clone._id = '';
}
}
function enumerateObject (obj, clone, parent) {
+1 -1
View File
@@ -219,7 +219,7 @@ var BaseNode = cc.Class({
_id: {
default: '',
editorOnly: true
serializable: false
},
/**