Просмотр исходного кода

Merge pull request #7402 from sebavan/master

Fix obj without groups or name
David Catuhe 5 лет назад
Родитель
Сommit
5349eeee9a
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      loaders/src/OBJ/objFileLoader.ts

+ 3 - 2
loaders/src/OBJ/objFileLoader.ts

@@ -813,14 +813,14 @@ export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
 
                 //If this new material is in the same mesh
 
-                if (!isFirstMaterial) {
+                if (!isFirstMaterial || !hasMeshes) {
                     //Set the data for the previous mesh
                     addPreviousObjMesh();
                     //Create a new mesh
                     var objMesh: MeshObject =
                     //Set the name of the current obj mesh
                     {
-                        name: objMeshName + "_mm" + increment.toString(), //Set the name of the current obj mesh
+                        name: (objMeshName || "mesh") + "_mm" + increment.toString(), //Set the name of the current obj mesh
                         indices: undefined,
                         positions: undefined,
                         normals: undefined,
@@ -831,6 +831,7 @@ export class OBJFileLoader implements ISceneLoaderPluginAsync, ISceneLoaderPlugi
                     increment++;
                     //If meshes are already defined
                     meshesFromObj.push(objMesh);
+                    hasMeshes = true;
                 }
                 //Set the material name if the previous line define a mesh