Browse Source

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

Mr.doob 11 years ago
parent
commit
f4cf8d741e
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/scenes/Scene.js

+ 6 - 0
src/scenes/Scene.js

@@ -53,6 +53,9 @@ THREE.Scene.prototype.__addObject = function ( object ) {
 
 
 	}
 	}
 
 
+	this.dispatchEvent( { type: 'objectAdded', object: object } );
+	object.dispatchEvent( { type: 'addedToScene', scene: this } );
+
 	for ( var c = 0; c < object.children.length; c ++ ) {
 	for ( var c = 0; c < object.children.length; c ++ ) {
 
 
 		this.__addObject( object.children[ c ] );
 		this.__addObject( object.children[ c ] );
@@ -99,6 +102,9 @@ THREE.Scene.prototype.__removeObject = function ( object ) {
 
 
 	}
 	}
 
 
+	this.dispatchEvent( { type: 'objectRemoved', object: object } );
+	object.dispatchEvent( { type: 'removedFromScene', scene: this } );
+
 	for ( var c = 0; c < object.children.length; c ++ ) {
 	for ( var c = 0; c < object.children.length; c ++ ) {
 
 
 		this.__removeObject( object.children[ c ] );
 		this.__removeObject( object.children[ c ] );