From ca5fdc31683b3a9512b3eb0993d59258250a5e5e Mon Sep 17 00:00:00 2001 From: pandamicro Date: Wed, 19 Sep 2018 19:27:09 +0800 Subject: [PATCH] Add 3d Node.isNode (#3283) --- cocos/scene-graph/node.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cocos/scene-graph/node.js b/cocos/scene-graph/node.js index 5d506771bd..4f1f26ce94 100644 --- a/cocos/scene-graph/node.js +++ b/cocos/scene-graph/node.js @@ -34,6 +34,11 @@ export default class Node extends BaseNode { @property _hasChanged = false; // has the transform changed in this frame? + // is node but not scene + static isNode (obj) { + return obj instanceof Node && (obj.constructor === Node || !(obj instanceof cc.Scene)); + } + constructor (name) { super(name); EventTarget.call(this);