diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-09-09 20:59:21 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-09-09 21:17:00 +0300 |
commit | ca629c362c5ed248547f9df057703079c95331e7 (patch) | |
tree | 4fa6ee83c6baf1c02af1557d14bfed256e032efe /indra/llprimitive | |
parent | e7373ff2f52f375ba9b6ffbf4d3b9f1996d2007e (diff) |
SL-15965 Support wider range of parsing errors
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/lldaeloader.cpp | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index dcf3b5fa0e..73a0b3d673 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -153,7 +153,8 @@ LLModel::EModelStatus load_face_from_dom_triangles( std::vector<LLVolumeFace>& face_list, std::vector<std::string>& materials, domTrianglesRef& tri, - bool &generated_additional_faces) + bool &generated_additional_faces, + LLSD& log_msg) { LLVolumeFace face; std::vector<LLVolumeFace::VertexData> verts; @@ -173,12 +174,18 @@ LLModel::EModelStatus load_face_from_dom_triangles( if ( !get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source)) { + LLSD args; + args["Message"] = "ParsingErrorBadElement"; + log_msg.append(args); return LLModel::BAD_ELEMENT; } if (!pos_source || !pos_source->getFloat_array()) { LL_WARNS() << "Unable to process mesh without position data; invalid model; invalid model." << LL_ENDL; + LLSD args; + args["Message"] = "ParsingErrorPositionInvalidModel"; + log_msg.append(args); return LLModel::BAD_ELEMENT; } @@ -381,6 +388,10 @@ LLModel::EModelStatus load_face_from_dom_polylist( if (!get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source)) { + LL_WARNS() << "Bad element." << LL_ENDL; + LLSD args; + args["Message"] = "ParsingErrorBadElement"; + log_msg.append(args); return LLModel::BAD_ELEMENT; } @@ -432,6 +443,9 @@ LLModel::EModelStatus load_face_from_dom_polylist( if (!cv.getPosition().isFinite3()) { LL_WARNS() << "Found NaN while loading position data from DAE-Model, invalid model." << LL_ENDL; + LLSD args; + args["Message"] = "PositionNaN"; + log_msg.append(args); return LLModel::BAD_ELEMENT; } } @@ -464,6 +478,10 @@ LLModel::EModelStatus load_face_from_dom_polylist( if (!cv.getNormal().isFinite3()) { LL_WARNS() << "Found NaN while loading normals from DAE-Model, invalid model." << LL_ENDL; + LLSD args; + args["Message"] = "NormalsNaN"; + log_msg.append(args); + return LLModel::BAD_ELEMENT; } } @@ -928,6 +946,9 @@ bool LLDAELoader::OpenFile(const std::string& filename) if (!dom) { LL_INFOS() <<" Error with dae - traditionally indicates a corrupt file."<<LL_ENDL; + LLSD args; + args["Message"] = "ParsingErrorCorrupt"; + mWarningsArray.append(args); setLoadState( ERROR_PARSING ); return false; } @@ -955,6 +976,9 @@ bool LLDAELoader::OpenFile(const std::string& filename) if (!doc) { LL_WARNS() << "can't find internal doc" << LL_ENDL; + LLSD args; + args["Message"] = "ParsingErrorNoDoc"; + mWarningsArray.append(args); return false; } @@ -962,6 +986,9 @@ bool LLDAELoader::OpenFile(const std::string& filename) if (!root) { LL_WARNS() << "document has no root" << LL_ENDL; + LLSD args; + args["Message"] = "ParsingErrorNoRoot"; + mWarningsArray.append(args); return false; } @@ -977,6 +1004,9 @@ bool LLDAELoader::OpenFile(const std::string& filename) if (!result) { LL_INFOS() << "Could not verify controller" << LL_ENDL; + LLSD args; + args["Message"] = "ParsingErrorBadElement"; + mWarningsArray.append(args); setLoadState( ERROR_PARSING ); return true; } @@ -1110,6 +1140,9 @@ bool LLDAELoader::OpenFile(const std::string& filename) if (!scene) { LL_WARNS() << "document has no visual_scene" << LL_ENDL; + LLSD args; + args["Message"] = "ParsingErrorNoScene"; + mWarningsArray.append(args); setLoadState( ERROR_PARSING ); return true; } @@ -1118,11 +1151,14 @@ bool LLDAELoader::OpenFile(const std::string& filename) bool badElement = false; - processElement( scene, badElement, &dae ); + processElement( scene, badElement, &dae); if ( badElement ) { LL_INFOS()<<"Scene could not be parsed"<<LL_ENDL; + LLSD args; + args["Message"] = "ParsingErrorCantParseScene"; + mWarningsArray.append(args); setLoadState( ERROR_PARSING ); } @@ -1961,7 +1997,7 @@ daeElement* LLDAELoader::getChildFromElement( daeElement* pElement, std::string return NULL; } -void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* dae ) +void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* dae) { LLMatrix4 saved_transform; bool pushed_mat = false; @@ -2055,6 +2091,11 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da if (mTransform.determinant() < 0) { //negative scales are not supported LL_INFOS() << "Negative scale detected, unsupported transform. domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL; + LLSD args; + args["Message"] = "NegativeScaleTrans"; + args["LABEL"] = getElementLabel(instance_geo); + mWarningsArray.append(args); + badElement = true; } @@ -2078,6 +2119,10 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da if (transformation.determinant() < 0) { //negative scales are not supported LL_INFOS() << "Negative scale detected, unsupported post-normalization transform. domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL; + LLSD args; + args["Message"] = "NegativeScaleNormTrans"; + args["LABEL"] = getElementLabel(instance_geo); + mWarningsArray.append(args); badElement = true; } @@ -2119,6 +2164,9 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da else { LL_INFOS()<<"Unable to resolve geometry URL."<<LL_ENDL; + LLSD args; + args["Message"] = "CantResolveGeometryUrl"; + mWarningsArray.append(args); badElement = true; } @@ -2411,7 +2459,7 @@ bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh, LLSD& { domTrianglesRef& tri = tris.get(i); - status = load_face_from_dom_triangles(pModel->getVolumeFaces(), pModel->getMaterialList(), tri, pModel->mHasGeneratedFaces); + status = load_face_from_dom_triangles(pModel->getVolumeFaces(), pModel->getMaterialList(), tri, pModel->mHasGeneratedFaces, log_msg); pModel->mStatus = status; if(status != LLModel::NO_ERRORS) { |