mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Development component menu
This commit is contained in:
@@ -678,6 +678,12 @@ var Component = cc.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_instantiate: function () {
|
||||
var clone = cc.instantiate._clone(this, this);
|
||||
clone.node = null;
|
||||
return clone;
|
||||
},
|
||||
|
||||
// Scheduler
|
||||
|
||||
isRunning: function () {
|
||||
|
||||
@@ -143,7 +143,7 @@ var enumerateObject = function (obj, parent) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (clone instanceof cc._BaseNode && CC_EDITOR) {
|
||||
if (clone instanceof cc._BaseNode && clone instanceof cc.Component && CC_EDITOR) {
|
||||
clone._id = '';
|
||||
}
|
||||
}
|
||||
@@ -219,16 +219,23 @@ function instantiateObj (obj, parent, ownerObj, ownerKey) {
|
||||
var ctor = obj.constructor;
|
||||
if (cc.Class._isCCClass(ctor)) {
|
||||
if (parent) {
|
||||
if (obj instanceof cc._BaseNode) {
|
||||
if (!obj.isChildOf(parent)) {
|
||||
// should not clone other nodes if not descendant
|
||||
if (parent instanceof cc.Component) {
|
||||
if (obj instanceof cc._BaseNode || obj instanceof cc.Component) {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
else if (obj instanceof cc.Component) {
|
||||
if (!obj.node.isChildOf(parent)) {
|
||||
// should not clone other component if not descendant
|
||||
return obj;
|
||||
else if (parent instanceof cc._BaseNode) {
|
||||
if (obj instanceof cc._BaseNode) {
|
||||
if (!obj.isChildOf(parent)) {
|
||||
// should not clone other nodes if not descendant
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
else if (obj instanceof cc.Component) {
|
||||
if (!obj.node.isChildOf(parent)) {
|
||||
// should not clone other component if not descendant
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user