mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Merge pull request #358 from jareguo/master
disallow to modify scene hierarchy when editing animation
This commit is contained in:
@@ -124,6 +124,11 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{
|
||||
if (this._parent === value) {
|
||||
return;
|
||||
}
|
||||
if (CC_EDITOR && !cc.engine.isPlaying) {
|
||||
if (_Scene.DetectConflict.beforeAddChild(this)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var node = this._sgNode;
|
||||
if (node.parent) {
|
||||
node.parent.removeChild(node, false);
|
||||
|
||||
@@ -107,7 +107,7 @@ var TestScript = cc.Class({
|
||||
}
|
||||
});
|
||||
|
||||
// polyfills to test engine extends
|
||||
// mocks to test engine extends
|
||||
|
||||
cc.engine = new (cc.Class({
|
||||
extends: cc.EventTarget,
|
||||
@@ -121,6 +121,20 @@ cc.engine = new (cc.Class({
|
||||
}
|
||||
}))();
|
||||
|
||||
(function () {
|
||||
function beFalse () {
|
||||
return false;
|
||||
}
|
||||
|
||||
window._Scene = window._Scene || {};
|
||||
_Scene.DetectConflict = {
|
||||
beforeAddChild: beFalse,
|
||||
afterAddChild: beFalse,
|
||||
checkConflict_Layout: beFalse,
|
||||
checkConflict_Widget: beFalse,
|
||||
};
|
||||
})();
|
||||
|
||||
Editor.log = cc.log;
|
||||
Editor.warn = cc.warn;
|
||||
Editor.error = cc.error;
|
||||
|
||||
Reference in New Issue
Block a user