diff options
-rw-r--r-- | indra/newview/gltf/llgltfloader.cpp | 46 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_model_preview.xml | 13 |
2 files changed, 48 insertions, 11 deletions
diff --git a/indra/newview/gltf/llgltfloader.cpp b/indra/newview/gltf/llgltfloader.cpp index 8fe5a8f2fb..d0a0a0b541 100644 --- a/indra/newview/gltf/llgltfloader.cpp +++ b/indra/newview/gltf/llgltfloader.cpp @@ -302,6 +302,10 @@ bool LLGLTFLoader::parseMeshes() else { LL_WARNS("GLTF_IMPORT") << "No scenes defined in GLTF file" << LL_ENDL; + + LLSD args; + args["Message"] = "NoScenesFound"; + mWarningsArray.append(args); return false; } @@ -398,8 +402,16 @@ void LLGLTFLoader::processNodeHierarchy(S32 node_idx, std::map<std::string, S32> else if (node.mMesh >= 0) { // Log invalid mesh reference - LL_WARNS("GLTF_IMPORT") << "Node " << node_idx << " references invalid mesh " << node.mMesh + LL_WARNS("GLTF_IMPORT") << "Node " << node_idx << " (" << node.mName + << ") references invalid mesh " << node.mMesh << " (total meshes: " << mGLTFAsset.mMeshes.size() << ")" << LL_ENDL; + + LLSD args; + args["Message"] = "InvalidMeshReference"; + args["NODE_NAME"] = node.mName; + args["MESH_INDEX"] = node.mMesh; + args["TOTAL_MESHES"] = static_cast<S32>(mGLTFAsset.mMeshes.size()); + mWarningsArray.append(args); } // Process all children recursively @@ -510,8 +522,9 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const LL::GLTF::Mesh& } } - for (const LL::GLTF::Primitive& prim : mesh.mPrimitives) + for (size_t prim_idx = 0; prim_idx < mesh.mPrimitives.size(); ++prim_idx) { + const LL::GLTF::Primitive& prim = mesh.mPrimitives[prim_idx]; // Unfortunately, SLM does not support 32 bit indices. Filter out anything that goes beyond 16 bit. if (prim.getVertexCount() < USHRT_MAX) { @@ -566,7 +579,14 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const LL::GLTF::Mesh& impMat.mDiffuseMapFilename = filename; impMat.mDiffuseMapLabel = material->mName.empty() ? filename : material->mName; - LL_INFOS("GLTF_IMPORT") << "Found texture: " << impMat.mDiffuseMapFilename << LL_ENDL; + LL_INFOS("GLTF_IMPORT") << "Found texture: " << impMat.mDiffuseMapFilename + << " for material: " << material->mName << LL_ENDL; + + LLSD args; + args["Message"] = "TextureFound"; + args["TEXTURE_NAME"] = impMat.mDiffuseMapFilename; + args["MATERIAL_NAME"] = material->mName; + mWarningsArray.append(args); // If the image has a texture loaded already, use it if (image.mTexture.notNull()) @@ -663,10 +683,15 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const LL::GLTF::Mesh& if (prim.getIndexCount() % 3 != 0) { - LL_WARNS("GLTF_IMPORT") << "Invalid primitive: index count " << prim.getIndexCount() - << " is not divisible by 3. GLTF files must contain triangulated geometry." << LL_ENDL; + LL_WARNS("GLTF_IMPORT") << "Mesh '" << mesh.mName << "' primitive " << prim_idx + << ": Invalid index count " << prim.getIndexCount() + << " (not divisible by 3). GLTF files must contain triangulated geometry." << LL_ENDL; + LLSD args; args["Message"] = "InvalidGeometryNonTriangulated"; + args["MESH_NAME"] = mesh.mName; + args["PRIMITIVE_INDEX"] = static_cast<S32>(prim_idx); + args["INDEX_COUNT"] = static_cast<S32>(prim.getIndexCount()); mWarningsArray.append(args); continue; // Skip this primitive } @@ -818,10 +843,17 @@ bool LLGLTFLoader::populateModelFromMesh(LLModel* pModel, const LL::GLTF::Mesh& pModel->getMaterialList().push_back(materialName); mats[materialName] = impMat; } - else { - LL_INFOS("GLTF_IMPORT") << "Unable to process mesh due to 16-bit index limits" << LL_ENDL; + else + { + LL_INFOS("GLTF_IMPORT") << "Unable to process mesh '" << mesh.mName + << "' primitive " << prim_idx + << " due to 16-bit index limits. Vertex count: " + << prim.getVertexCount() << " exceeds limit: " << USHRT_MAX << LL_ENDL; LLSD args; args["Message"] = "ErrorIndexLimit"; + args["MESH_NAME"] = mesh.mName.empty() ? ("mesh_" + std::to_string(&mesh - &mGLTFAsset.mMeshes[0])) : mesh.mName; + args["VERTEX_COUNT"] = static_cast<S32>(prim.getVertexCount()); + args["LIMIT"] = USHRT_MAX; mWarningsArray.append(args); return false; } diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index 1c4a857dab..d9a344ba41 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -61,10 +61,15 @@ <string name="ParsingErrorNoRoot">Document has no root</string> <string name="ParsingErrorNoScene">Document has no visual_scene</string> <string name="ParsingErrorPositionInvalidModel">Unable to process mesh without position data. Invalid model.</string> - <string name="InvalidGeometryNonTriangulated">Invalid geometry: GLTF files must contain triangulated meshes only.</string> - <string name="IgnoredExtension">Model uses unsupported extension: [EXT], related material properties are ignored.</string> - <string name="UnsupportedExtension">Unable to load a model, unsupported extension: [EXT]</string> - <string name="ErrorIndexLimit">Unable to process mesh due to 16-bit index limits</string> + + <!-- GLTF specific messages --> + <string name="NoScenesFound">No scenes defined in GLTF file</string> + <string name="InvalidMeshReference">Node [NODE_NAME] references invalid mesh [MESH_INDEX] (total meshes: [TOTAL_MESHES])</string> + <string name="InvalidGeometryNonTriangulated">Mesh [MESH_NAME] primitive [PRIMITIVE_INDEX]: Invalid geometry with [INDEX_COUNT] indices (must be triangulated)</string> + <string name="ErrorIndexLimit">Mesh [MESH_NAME]: Vertex count [VERTEX_COUNT] exceeds 16-bit limit of [LIMIT]</string> + <string name="TextureFound">Found texture: [TEXTURE_NAME] for material: [MATERIAL_NAME]</string> + <string name="IgnoredExtension">Model uses unsupported extension: [EXT], related material properties are ignored</string> + <string name="UnsupportedExtension">Unable to load model, unsupported extension: [EXT]</string> <panel follows="top|left" |