|
@@ -388,18 +388,12 @@ var Viewport = function ( editor ) {
|
|
|
|
|
|
signals.objectAdded.add( function ( object ) {
|
|
|
|
|
|
- var materialsNeedUpdate = false;
|
|
|
-
|
|
|
object.traverse( function ( child ) {
|
|
|
|
|
|
- if ( child instanceof THREE.Light ) materialsNeedUpdate = true;
|
|
|
-
|
|
|
objects.push( child );
|
|
|
|
|
|
} );
|
|
|
|
|
|
- if ( materialsNeedUpdate === true ) updateMaterials();
|
|
|
-
|
|
|
} );
|
|
|
|
|
|
signals.objectChanged.add( function ( object ) {
|
|
@@ -429,18 +423,12 @@ var Viewport = function ( editor ) {
|
|
|
|
|
|
signals.objectRemoved.add( function ( object ) {
|
|
|
|
|
|
- var materialsNeedUpdate = false;
|
|
|
-
|
|
|
object.traverse( function ( child ) {
|
|
|
|
|
|
- if ( child instanceof THREE.Light ) materialsNeedUpdate = true;
|
|
|
-
|
|
|
objects.splice( objects.indexOf( child ), 1 );
|
|
|
|
|
|
} );
|
|
|
|
|
|
- if ( materialsNeedUpdate === true ) updateMaterials();
|
|
|
-
|
|
|
} );
|
|
|
|
|
|
signals.helperAdded.add( function ( object ) {
|
|
@@ -479,8 +467,6 @@ var Viewport = function ( editor ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- updateMaterials();
|
|
|
-
|
|
|
oldFogType = fogType;
|
|
|
|
|
|
}
|
|
@@ -537,30 +523,6 @@ var Viewport = function ( editor ) {
|
|
|
|
|
|
//
|
|
|
|
|
|
- function updateMaterials() {
|
|
|
-
|
|
|
- editor.scene.traverse( function ( node ) {
|
|
|
-
|
|
|
- if ( node.material ) {
|
|
|
-
|
|
|
- node.material.needsUpdate = true;
|
|
|
-
|
|
|
- if ( node.material instanceof THREE.MeshFaceMaterial ) {
|
|
|
-
|
|
|
- for ( var i = 0; i < node.material.materials.length; i ++ ) {
|
|
|
-
|
|
|
- node.material.materials[ i ].needsUpdate = true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- } );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
function updateFog( root ) {
|
|
|
|
|
|
if ( root.fog ) {
|