提交 d7757f56 编写于 作者: M Mr.doob

Merge branch 'patch-1' of https://github.com/Wilt/three.js into dev

......@@ -377,33 +377,24 @@ THREE.Object3D.prototype = {
getObjectById: function ( id, recursive ) {
if ( this.id === id ) return this;
return this.getObjectByProperty('id', id, recursive);
for ( var i = 0, l = this.children.length; i < l; i ++ ) {
var child = this.children[ i ];
var object = child.getObjectById( id, recursive );
if ( object !== undefined ) {
return object;
}
},
}
getObjectByName: function ( name, recursive ) {
return undefined;
return this.getObjectByProperty('name', name, recursive);
},
getObjectByProperty: function ( name, value, recursive ) {
getObjectByName: function ( name, recursive ) {
if ( this.name === name ) return this;
if ( this[name] === value ) return this;
for ( var i = 0, l = this.children.length; i < l; i ++ ) {
var child = this.children[ i ];
var object = child.getObjectByName( name, recursive );
var object = child.getObjectByProperty( name, value, recursive );
if ( object !== undefined ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册