SL-13698 FIXED crash on model upload

master
Mnikolenko Productengine 2020-08-03 19:14:09 +03:00
parent 0570d6d3c1
commit 7a9a114e16
3 changed files with 22 additions and 7 deletions

View File

@ -343,7 +343,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa
return LLModel::NO_ERRORS ;
}
LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& face_list, std::vector<std::string>& materials, domPolylistRef& poly)
LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& face_list, std::vector<std::string>& materials, domPolylistRef& poly, LLSD& log_msg)
{
domPRef p = poly->getP();
domListOfUInts& idx = p->getValue();
@ -403,6 +403,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
LLVolumeFace::VertexMapData::PointMap point_map;
U32 cur_idx = 0;
bool log_tc_msg = true;
for (U32 i = 0; i < vcount.getCount(); ++i)
{ //for each polygon
U32 first_index = 0;
@ -426,8 +427,21 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac
if (tc_source)
{
cv.mTexCoord.setVec(tc[idx[cur_idx+tc_offset]*2+0],
tc[idx[cur_idx+tc_offset]*2+1]);
U64 idx_x = idx[cur_idx + tc_offset] * 2 + 0;
U64 idx_y = idx[cur_idx + tc_offset] * 2 + 1;
if (idx_y < tc.getCount())
{
cv.mTexCoord.setVec(tc[idx_x], tc[idx_y]);
}
else if (log_tc_msg)
{
log_tc_msg = false;
LL_WARNS() << "Texture coordinates data is not complete." << LL_ENDL;
LLSD args;
args["Message"] = "IncompleteTC";
log_msg.append(args);
}
}
if (norm_source)
@ -2362,7 +2376,7 @@ LLColor4 LLDAELoader::getDaeColor(daeElement* element)
return value;
}
bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh)
bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh, LLSD& log_msg)
{
LLModel::EModelStatus status = LLModel::NO_ERRORS;
domTriangles_Array& tris = mesh->getTriangles_array();
@ -2384,7 +2398,7 @@ bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh)
for (U32 i = 0; i < polys.getCount(); ++i)
{
domPolylistRef& poly = polys.get(i);
status = load_face_from_dom_polylist(pModel->getVolumeFaces(), pModel->getMaterialList(), poly);
status = load_face_from_dom_polylist(pModel->getVolumeFaces(), pModel->getMaterialList(), poly, log_msg);
if(status != LLModel::NO_ERRORS)
{
@ -2448,7 +2462,7 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& mo
// Get the whole set of volume faces
//
addVolumeFacesFromDomMesh(ret, mesh);
addVolumeFacesFromDomMesh(ret, mesh, mWarningsArray);
U32 volume_faces = ret->getNumVolumeFaces();

View File

@ -89,7 +89,7 @@ protected:
//Verify that a controller matches vertex counts
bool verifyController( domController* pController );
static bool addVolumeFacesFromDomMesh(LLModel* model, domMesh* mesh);
static bool addVolumeFacesFromDomMesh(LLModel* model, domMesh* mesh, LLSD& log_msg = LLSD());
static bool createVolumeFacesFromDomMesh(LLModel* model, domMesh *mesh);
static LLModel* loadModelFromDomMesh(domMesh* mesh);

View File

@ -45,6 +45,7 @@
<string name="UnrecognizedJoint">Rigged to unrecognized joint name [NAME]</string>
<string name="UnknownJoints">Skinning disabled due to [COUNT] unknown joints</string>
<string name="ModelLoaded">Model [MODEL_NAME] loaded</string>
<string name="IncompleteTC">Texture coordinates data is not complete.</string>
<panel
follows="top|left"