From ddaa0e186501b77876c9d8afe7e13885c41c76f1 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Mon, 12 Oct 2015 19:35:08 +0300 Subject: MAINT-5678 FIXED Materials with spaces in name import with truncated names --- indra/llprimitive/lldaeloader.cpp | 57 ++++++++++++++++++++++++++++++++------- indra/llprimitive/lldaeloader.h | 9 ++++--- 2 files changed, 53 insertions(+), 13 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index c1b74b1fd7..d884c30d61 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -821,7 +821,8 @@ LLDAELoader::LLDAELoader( opaque_userdata, jointMap, jointsFromNodes), -mGeneratedModelLimit(modelLimit) +mGeneratedModelLimit(modelLimit), +mForceIdNaming(false) { } @@ -944,6 +945,32 @@ bool LLDAELoader::OpenFile(const std::string& filename) mTransform.condition(); + mForceIdNaming = false; + std::vector checkNames; + for (daeInt idx = 0; idx < count; ++idx) + { + domMesh* mesh = NULL; + db->getElement((daeElement**)&mesh, idx, NULL, COLLADA_TYPE_MESH); + + if (mesh) + { + std::string name = getLodlessLabel(mesh, false); + + std::vector::iterator it; + it = std::find(checkNames.begin(), checkNames.end(), name); + if (it != checkNames.end()) + { + LL_WARNS() << "document has duplicate names, using IDs instead" << LL_ENDL; + mForceIdNaming = true; + break; + } + else + { + checkNames.push_back(name); + } + } + } + U32 submodel_limit = count > 0 ? mGeneratedModelLimit/count : 0; for (daeInt idx = 0; idx < count; ++idx) { //build map of domEntities to LLModel @@ -1944,7 +1971,7 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da if (model->mLabel.empty()) { - label = getLodlessLabel(instance_geo); + label = getLodlessLabel(instance_geo, mForceIdNaming); llassert(!label.empty()); @@ -2159,12 +2186,17 @@ LLImportMaterial LLDAELoader::profileToMaterial(domProfile_COMMON* material, DAE return mat; } -// try to get a decent label for this element std::string LLDAELoader::getElementLabel(daeElement *element) +{ + return getElementLabel(element, mForceIdNaming); +} + +// try to get a decent label for this element +std::string LLDAELoader::getElementLabel(daeElement *element, bool forceIdNaming) { // if we have a name attribute, use it std::string name = element->getAttribute("name"); - if (name.length()) + if (name.length() && !forceIdNaming) { return name; } @@ -2187,7 +2219,7 @@ std::string LLDAELoader::getElementLabel(daeElement *element) // if parent has a name or ID, use it std::string name = parent->getAttribute("name"); - if (!name.length()) + if (!name.length() || forceIdNaming) { name = std::string(parent->getID()); } @@ -2230,9 +2262,9 @@ size_t LLDAELoader::getSuffixPosition(std::string label) } // static -std::string LLDAELoader::getLodlessLabel(daeElement *element) +std::string LLDAELoader::getLodlessLabel(daeElement *element, bool forceIdNaming) { - std::string label = getElementLabel(element); + std::string label = getElementLabel(element, forceIdNaming); size_t ext_pos = getSuffixPosition(label); if (ext_pos != -1) { @@ -2303,8 +2335,13 @@ bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh) return (status == LLModel::NO_ERRORS); } -//static LLModel* LLDAELoader::loadModelFromDomMesh(domMesh *mesh) +{ + return loadModelFromDomMesh(mesh, mForceIdNaming); +} + +//static +LLModel* LLDAELoader::loadModelFromDomMesh(domMesh *mesh, bool forceIdNaming) { LLVolumeParams volume_params; volume_params.setType(LL_PCODE_PROFILE_SQUARE, LL_PCODE_PATH_LINE); @@ -2312,7 +2349,7 @@ LLModel* LLDAELoader::loadModelFromDomMesh(domMesh *mesh) createVolumeFacesFromDomMesh(ret, mesh); if (ret->mLabel.empty()) { - ret->mLabel = getElementLabel(mesh); + ret->mLabel = getElementLabel(mesh, forceIdNaming); } return ret; } @@ -2330,7 +2367,7 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector& mo LLModel* ret = new LLModel(volume_params, 0.f); - std::string model_name = getLodlessLabel(mesh); + std::string model_name = getLodlessLabel(mesh, mForceIdNaming); ret->mLabel = model_name + lod_suffix[mLod]; llassert(!ret->mLabel.empty()); diff --git a/indra/llprimitive/lldaeloader.h b/indra/llprimitive/lldaeloader.h index 7d91a6063b..3ababd3156 100644 --- a/indra/llprimitive/lldaeloader.h +++ b/indra/llprimitive/lldaeloader.h @@ -89,19 +89,22 @@ protected: static bool addVolumeFacesFromDomMesh(LLModel* model, domMesh* mesh); static bool createVolumeFacesFromDomMesh(LLModel* model, domMesh *mesh); - static LLModel* loadModelFromDomMesh(domMesh* mesh); + static LLModel* loadModelFromDomMesh(domMesh* mesh, bool forceIdNaming); + LLModel* loadModelFromDomMesh(domMesh* mesh); // Loads a mesh breaking it into one or more models as necessary // to get around volume face limitations while retaining >8 materials // bool loadModelsFromDomMesh(domMesh* mesh, std::vector& models_out, U32 submodel_limit); - static std::string getElementLabel(daeElement *element); + static std::string getElementLabel(daeElement *element, bool forceIdNaming); + std::string getElementLabel(daeElement *element); static size_t getSuffixPosition(std::string label); - static std::string getLodlessLabel(daeElement *element); + static std::string getLodlessLabel(daeElement *element, bool forceIdNaming = false); private: U32 mGeneratedModelLimit; // Attempt to limit amount of generated submodels + bool mForceIdNaming; }; #endif // LL_LLDAELLOADER_H -- cgit v1.2.3 From 29391cbab3f5fd78a5a94aa6514bb1c2ebdbe0ed Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 30 Oct 2015 17:08:22 -0400 Subject: MAINT-5807 WIP - initialize some uninitialized members of LLModelLoader. --- indra/llprimitive/llmodelloader.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index 81d92d151b..f86eceb98d 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -116,6 +116,7 @@ LLModelLoader::LLModelLoader( , LLThread("Model Loader") , mFilename(filename) , mLod(lod) +, mTrySLM(false) , mFirstTransform(TRUE) , mNumOfFetchingTextures(0) , mLoadCallback(load_cb) @@ -123,6 +124,9 @@ LLModelLoader::LLModelLoader( , mTextureLoadFunc(texture_load_func) , mStateCallback(state_cb) , mOpaqueData(opaque_userdata) +, mRigParityWithScene(false) +, mRigValidJointUpload(false) +, mLegacyRigValid(false) , mNoNormalize(false) , mNoOptimize(false) , mCacheOnlyHitIfRigged(false) -- cgit v1.2.3 From 049c795b1276202a844ea54c9129515238127b3c Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Wed, 11 Nov 2015 17:59:14 +0200 Subject: Backed out changeset: a79540758404 Need backed out this changes because it influence on material update see: MAINT-5818 Also this lead to the following: UserA and UserB logged in same location. UserA edit normal/specular map texture offsets while UserB is not observe this changes. --- indra/llprimitive/llprimitive.cpp | 4 ++-- indra/llprimitive/llprimitive.h | 2 +- indra/llprimitive/llprimtexturelist.cpp | 11 ++--------- indra/llprimitive/llprimtexturelist.h | 2 +- indra/llprimitive/lltextureentry.cpp | 4 ---- indra/llprimitive/lltextureentry.h | 4 ---- 6 files changed, 6 insertions(+), 21 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 9eff74f1e8..186716609c 100755 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -317,9 +317,9 @@ S32 LLPrimitive::setTEMaterialID(const U8 index, const LLMaterialID& pMaterialID return mTextureList.setMaterialID(index, pMaterialID); } -S32 LLPrimitive::setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer) +S32 LLPrimitive::setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams) { - return mTextureList.setMaterialParams(index, pMaterialParams, isInitFromServer); + return mTextureList.setMaterialParams(index, pMaterialParams); } LLMaterialPtr LLPrimitive::getTEMaterialParams(const U8 index) diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 54870fbb10..19d9d52817 100755 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -384,7 +384,7 @@ public: virtual S32 setTEMediaFlags(const U8 te, const U8 flags); virtual S32 setTEGlow(const U8 te, const F32 glow); virtual S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID); - virtual S32 setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer); + virtual S32 setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams); virtual BOOL setMaterial(const U8 material); // returns TRUE if material changed virtual void setTESelected(const U8 te, bool sel); diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp index 6aae2f97c6..f4f08248b8 100755 --- a/indra/llprimitive/llprimtexturelist.cpp +++ b/indra/llprimitive/llprimtexturelist.cpp @@ -368,18 +368,11 @@ S32 LLPrimTextureList::setMaterialID(const U8 index, const LLMaterialID& pMateri return TEM_CHANGE_NONE; } -S32 LLPrimTextureList::setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer) +S32 LLPrimTextureList::setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams) { if (index < mEntryList.size()) { - if (!isInitFromServer && mEntryList[index]->isMatParamsInitFromServer()) - { - return TEM_CHANGE_NONE; - } - else - { - return mEntryList[index]->setMaterialParams(pMaterialParams); - } + return mEntryList[index]->setMaterialParams(pMaterialParams); } return TEM_CHANGE_NONE; } diff --git a/indra/llprimitive/llprimtexturelist.h b/indra/llprimitive/llprimtexturelist.h index 63e6372405..49c636e40f 100755 --- a/indra/llprimitive/llprimtexturelist.h +++ b/indra/llprimitive/llprimtexturelist.h @@ -105,7 +105,7 @@ public: S32 setMediaFlags(const U8 index, const U8 media_flags); S32 setGlow(const U8 index, const F32 glow); S32 setMaterialID(const U8 index, const LLMaterialID& pMaterialID); - S32 setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer); + S32 setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams); LLMaterialPtr getMaterialParams(const U8 index); diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index 6020031099..284dfc15f4 100755 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -63,7 +63,6 @@ LLTextureEntry::LLTextureEntry() : mMediaEntry(NULL) , mSelected(false) , mMaterialUpdatePending(false) - , mInitMatParamsFromServer(false) { init(LLUUID::null,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE); } @@ -72,7 +71,6 @@ LLTextureEntry::LLTextureEntry(const LLUUID& tex_id) : mMediaEntry(NULL) , mSelected(false) , mMaterialUpdatePending(false) - , mInitMatParamsFromServer(false) { init(tex_id,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE); } @@ -81,7 +79,6 @@ LLTextureEntry::LLTextureEntry(const LLTextureEntry &rhs) : mMediaEntry(NULL) , mSelected(false) , mMaterialUpdatePending(false) - , mInitMatParamsFromServer(false) { mID = rhs.mID; mScaleS = rhs.mScaleS; @@ -565,7 +562,6 @@ S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams) mMaterialUpdatePending = true; } mMaterial = pMaterialParams; - this->mInitMatParamsFromServer = TRUE; return TEM_CHANGE_TEXTURE; } diff --git a/indra/llprimitive/lltextureentry.h b/indra/llprimitive/lltextureentry.h index 81e2e8a5a2..a40c3988f2 100755 --- a/indra/llprimitive/lltextureentry.h +++ b/indra/llprimitive/lltextureentry.h @@ -160,8 +160,6 @@ public: const LLMaterialID& getMaterialID() const { return mMaterialID; }; const LLMaterialPtr getMaterialParams() const { return mMaterial; }; - bool isMatParamsInitFromServer() const { return mInitMatParamsFromServer; }; - // *NOTE: it is possible for hasMedia() to return true, but getMediaData() to return NULL. // CONVERSELY, it is also possible for hasMedia() to return false, but getMediaData() // to NOT return NULL. @@ -219,8 +217,6 @@ protected: bool mMaterialUpdatePending; LLMaterialID mMaterialID; LLMaterialPtr mMaterial; - bool mInitMatParamsFromServer; // Flag to identification when material paramas initialized from - // Note the media data is not sent via the same message structure as the rest of the TE LLMediaEntry* mMediaEntry; // The media data for the face -- cgit v1.2.3 From 080e26eba4f6f16eba6ac52727155720614da4ff Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 11 Nov 2015 19:37:36 +0200 Subject: MAINT-5728 fix for dae uploading crash --- indra/llprimitive/lldaeloader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index d884c30d61..afc88fc861 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -1605,9 +1605,9 @@ void LLDAELoader::processChildJoints( domNode* pParentNode ) //----------------------------------------------------------------------------- bool LLDAELoader::isNodeAJoint( domNode* pNode ) { - if ( !pNode ) + if ( !pNode || !pNode->getName() ) { - LL_INFOS()<<"Created node is NULL"<