Browse Source

Added checks for null geometry and material

Luis Fraguada 4 years ago
parent
commit
919658316e
1 changed files with 7 additions and 2 deletions
  1. 7 2
      examples/jsm/loaders/3DMLoader.js

+ 7 - 2
examples/jsm/loaders/3DMLoader.js

@@ -325,7 +325,8 @@ Rhino3dmLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 					} else {
 
-						var _object = this._createObject( obj, null );
+						var material = this._createMaterial( );
+						var _object = this._createObject( obj, material );
 
 					}
 
@@ -1241,7 +1242,7 @@ Rhino3dmLoader.Rhino3dmWorker = function () {
 
 		}
 
-		if ( geometry ) {
+		if ( ( geometry && ! Array.isArray( geometry ) ) || ( Array.isArray( geometry ) && geometry.length ) ) {
 
 			var attributes = extractProperties( _attributes );
 			attributes.geometry = extractProperties( _geometry );
@@ -1266,6 +1267,10 @@ Rhino3dmLoader.Rhino3dmWorker = function () {
 
 			return { geometry, attributes, objectType };
 
+		} else {
+
+			console.warn( 'THREE.3DMLoader: Object has no mesh geometry. Consider opening this in Rhino, using a shaded display mode, and exporting again.' );
+
 		}
 
 	}