diff options
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/lldaeloader.cpp | 61 | ||||
-rw-r--r-- | indra/llprimitive/lldaeloader.h | 9 | ||||
-rw-r--r-- | indra/llprimitive/llmodelloader.cpp | 4 | ||||
-rwxr-xr-x | indra/llprimitive/llprimitive.cpp | 4 | ||||
-rwxr-xr-x | indra/llprimitive/llprimitive.h | 2 | ||||
-rwxr-xr-x | indra/llprimitive/llprimtexturelist.cpp | 11 | ||||
-rwxr-xr-x | indra/llprimitive/llprimtexturelist.h | 2 | ||||
-rwxr-xr-x | indra/llprimitive/lltextureentry.cpp | 4 | ||||
-rwxr-xr-x | indra/llprimitive/lltextureentry.h | 4 |
9 files changed, 65 insertions, 36 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index c1b74b1fd7..afc88fc861 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<std::string> 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<std::string>::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 @@ -1578,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"<<LL_ENDL; + LL_INFOS()<<"Created node is NULL or invalid"<<LL_ENDL; return false; } @@ -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,16 +2335,21 @@ 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); LLModel* ret = new LLModel(volume_params, 0.f); 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<LLModel*>& 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<LLModel*>& 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 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) 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 |