mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Merge pull request #2647 from pandamicro/next
Improve Node/Component _id management
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -219,7 +219,7 @@ var BaseNode = cc.Class({
|
||||
|
||||
_id: {
|
||||
default: '',
|
||||
editorOnly: true
|
||||
serializable: false
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user