浏览代码

Merge pull request #20873 from mcneel/wip/3DMLoader

3DMLoader: Added checks for null geometry and material
Mr.doob 4 年之前
父节点
当前提交
ed6928f596
共有 1 个文件被更改,包括 7 次插入2 次删除
  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 ( Array.isArray( geometry ) === false || geometry.length > 0 ) {
 
 			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.' );
+
 		}
 
 	}