Browse Source

Editor/App: Passing scene to scripts.

Mr.doob 10 years ago
parent
commit
b9f0c866db
2 changed files with 3 additions and 3 deletions
  1. 2 2
      editor/js/libs/app.js
  2. 1 1
      editor/js/libs/ui.editor.js

+ 2 - 2
editor/js/libs/app.js

@@ -41,7 +41,7 @@ var APP = {
 
 					var script = sources[ i ];
 
-					script.compiled = new Function( 'event', script.source ).bind( object );
+					script.compiled = new Function( 'scene', 'event', script.source ).bind( object );
 
 					scripts[ script.event ].push( script.compiled );
 
@@ -68,7 +68,7 @@ var APP = {
 
 			for ( var i = 0, l = array.length; i < l; i ++ ) {
 
-				array[ i ]( event );
+				array[ i ]( scene, event );
 
 			}
 

+ 1 - 1
editor/js/libs/ui.editor.js

@@ -29,7 +29,7 @@ UI.ScriptEditor = function () {
 
 			try {
 
-				( new Function( 'event', source ).bind( object.clone() ) )( {} );
+				( new Function( 'scene', 'event', source ).bind( object.clone() ) )( new THREE.Scene(), {} );
 
 				textarea.dom.classList.add( 'success' );
 				textarea.dom.classList.remove( 'fail' );