|
@@ -333,12 +333,7 @@ class Object3D extends EventDispatcher {
|
|
|
|
|
|
if ( object && object.isObject3D ) {
|
|
|
|
|
|
- if ( object.parent !== null ) {
|
|
|
-
|
|
|
- object.parent.remove( object );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ object.removeFromParent();
|
|
|
object.parent = this;
|
|
|
this.children.push( object );
|
|
|
|
|
@@ -431,10 +426,18 @@ class Object3D extends EventDispatcher {
|
|
|
|
|
|
object.applyMatrix4( _m1 );
|
|
|
|
|
|
- this.add( object );
|
|
|
+ object.removeFromParent();
|
|
|
+ object.parent = this;
|
|
|
+ this.children.push( object );
|
|
|
|
|
|
object.updateWorldMatrix( false, true );
|
|
|
|
|
|
+ object.dispatchEvent( _addedEvent );
|
|
|
+
|
|
|
+ _childaddedEvent.child = object;
|
|
|
+ this.dispatchEvent( _childaddedEvent );
|
|
|
+ _childaddedEvent.child = null;
|
|
|
+
|
|
|
return this;
|
|
|
|
|
|
}
|