|
@@ -305,7 +305,37 @@ THREE.Object3D.prototype = {
|
|
|
|
|
|
},
|
|
|
|
|
|
- getChildByName: function ( name, recursive ) {
|
|
|
+ getObjectById: function ( id, recursive ) {
|
|
|
+
|
|
|
+ for ( var i = 0, l = this.children.length; i < l; i ++ ) {
|
|
|
+
|
|
|
+ var child = this.children[ i ];
|
|
|
+
|
|
|
+ if ( child.id === id ) {
|
|
|
+
|
|
|
+ return child;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( recursive === true ) {
|
|
|
+
|
|
|
+ child = child.getObjectById( id, recursive );
|
|
|
+
|
|
|
+ if ( child !== undefined ) {
|
|
|
+
|
|
|
+ return child;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return undefined;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ getObjectByName: function ( name, recursive ) {
|
|
|
|
|
|
for ( var i = 0, l = this.children.length; i < l; i ++ ) {
|
|
|
|
|
@@ -319,7 +349,7 @@ THREE.Object3D.prototype = {
|
|
|
|
|
|
if ( recursive === true ) {
|
|
|
|
|
|
- child = child.getChildByName( name, recursive );
|
|
|
+ child = child.getObjectByName( name, recursive );
|
|
|
|
|
|
if ( child !== undefined ) {
|
|
|
|
|
@@ -335,6 +365,13 @@ THREE.Object3D.prototype = {
|
|
|
|
|
|
},
|
|
|
|
|
|
+ getChildByName: function ( name, recursive ) {
|
|
|
+
|
|
|
+ console.warn( 'DEPRECATED: Object3D\'s .getChildByName() has been renamed to .getObjectByName().' );
|
|
|
+ return this.getObjectByName( name, recursive );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
getDescendants: function ( array ) {
|
|
|
|
|
|
if ( array === undefined ) array = [];
|