2
0
Эх сурвалжийг харах

This should avoid people adding stuff that it's not an Object3D to the Scene Graph.
Also, checking if the object is already a children is a bit redudant (the next lines code takes care of that indirectly).

Mr.doob 13 жил өмнө
parent
commit
22a7f46460
1 өөрчлөгдсөн 1 нэмэгдсэн , 1 устгасан
  1. 1 1
      src/core/Object3D.js

+ 1 - 1
src/core/Object3D.js

@@ -114,7 +114,7 @@ THREE.Object3D.prototype = {
 
 		}
 
-		if ( this.children.indexOf( object ) === - 1 ) {
+		if ( object instanceof THREE.Object3D ) { // && this.children.indexOf( object ) === - 1
 
 			if ( object.parent !== undefined ) {