diff options
-rwxr-xr-x | indra/llprimitive/lltextureentry.cpp | 21 | ||||
-rw-r--r-- | indra/newview/llmaterialmgr.cpp | 61 | ||||
-rw-r--r-- | indra/newview/llmaterialmgr.h | 22 | ||||
-rwxr-xr-x | indra/newview/llselectmgr.cpp | 4 | ||||
-rwxr-xr-x | indra/newview/llviewerobject.cpp | 17 | ||||
-rwxr-xr-x | indra/newview/llvovolume.cpp | 8 |
6 files changed, 31 insertions, 102 deletions
diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index ca57f1edbd..597f078490 100755 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -539,21 +539,28 @@ S32 LLTextureEntry::setGlow(F32 glow) S32 LLTextureEntry::setMaterialID(const LLMaterialID& pMaterialID) { - if (mMaterialID != pMaterialID) + if ( (mMaterialID != pMaterialID) || (mMaterialUpdatePending && !mSelected) ) { - mMaterialID = pMaterialID; - - } - if (mMaterialID.isNull()) + if (mSelected) { - setMaterialParams(NULL); + mMaterialUpdatePending = true; + mMaterialID = pMaterialID; + return TEM_CHANGE_NONE; } + + mMaterialUpdatePending = false; + mMaterialID = pMaterialID; return TEM_CHANGE_TEXTURE; } + return TEM_CHANGE_NONE; +} S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams) { - + if (mSelected) + { + mMaterialUpdatePending = true; + } mMaterial = pMaterialParams; return TEM_CHANGE_TEXTURE; } diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 59e5d05736..f217ff160e 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -217,51 +217,6 @@ boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LL return connection; } -boost::signals2::connection LLMaterialMgr::getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, LLMaterialMgr::get_callback_te_t::slot_type cb) -{ - boost::signals2::connection connection; - - material_map_t::const_iterator itMaterial = mMaterials.find(material_id); - if (itMaterial != mMaterials.end()) - { - LL_DEBUGS("Materials") << "region " << region_id << " found materialid " << material_id << LL_ENDL; - get_callback_te_t signal; - signal.connect(cb); - signal(material_id, itMaterial->second, te); - connection = boost::signals2::connection(); - } - else - { - if (!isGetPending(region_id, material_id)) - { - get_queue_t::iterator itQueue = mGetQueue.find(region_id); - if (mGetQueue.end() == itQueue) - { - LL_DEBUGS("Materials") << "mGetQueue inserting region "<<region_id << LL_ENDL; - std::pair<get_queue_t::iterator, bool> ret = mGetQueue.insert(std::pair<LLUUID, material_queue_t>(region_id, material_queue_t())); - itQueue = ret.first; - } - LL_DEBUGS("Materials") << "adding material id " << material_id << LL_ENDL; - itQueue->second.insert(material_id); - markGetPending(region_id, material_id); - } - - TEMaterialPair te_mat_pair; - te_mat_pair.te = te; - te_mat_pair.materialID = material_id; - - get_callback_te_map_t::iterator itCallback = mGetTECallbacks.find(te_mat_pair); - if (itCallback == mGetTECallbacks.end()) - { - std::pair<get_callback_te_map_t::iterator, bool> ret = mGetTECallbacks.insert(std::pair<TEMaterialPair, get_callback_te_t*>(te_mat_pair, new get_callback_te_t())); - itCallback = ret.first; - } - connection = itCallback->second->connect(cb); - } - - return connection; -} - bool LLMaterialMgr::isGetAllPending(const LLUUID& region_id) const { getall_pending_map_t::const_iterator itPending = mGetAllPending.find(region_id); @@ -346,22 +301,6 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL mGetCallbacks.erase(itCallback); } - TEMaterialPair te_mat_pair; - te_mat_pair.materialID = material_id; - - U32 i = 0; - while (i < LLTEContents::MAX_TES) - { - te_mat_pair.te = i++; - get_callback_te_map_t::iterator itCallbackTE = mGetTECallbacks.find(te_mat_pair); - if (itCallbackTE != mGetTECallbacks.end()) - { - (*itCallbackTE->second)(material_id, itMaterial->second, te_mat_pair.te); - delete itCallbackTE->second; - mGetTECallbacks.erase(itCallbackTE); - } - } - return itMaterial->second; } diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index 922b16f1cf..a6a7a5d1d7 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -44,11 +44,9 @@ public: typedef std::map<LLMaterialID, LLMaterialPtr> material_map_t; typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr)> get_callback_t; - typedef boost::signals2::signal<void (const LLMaterialID&, const LLMaterialPtr, U32 te)> get_callback_te_t; const LLMaterialPtr get(const LLUUID& region_id, const LLMaterialID& material_id); boost::signals2::connection get(const LLUUID& region_id, const LLMaterialID& material_id, get_callback_t::slot_type cb); - boost::signals2::connection getTE(const LLUUID& region_id, const LLMaterialID& material_id, U32 te, get_callback_te_t::slot_type cb); typedef boost::signals2::signal<void (const LLUUID&, const material_map_t&)> getall_callback_t; void getAll(const LLUUID& region_id); @@ -82,26 +80,6 @@ protected: typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t; get_callback_map_t mGetCallbacks; - // struct for TE-specific material ID query - struct TEMaterialPair - { - U32 te; - LLMaterialID materialID; - }; - - // needed for std::map compliance only - // - friend inline bool operator<( - const struct LLMaterialMgr::TEMaterialPair& lhs, - const struct LLMaterialMgr::TEMaterialPair& rhs) - { - return (lhs.materialID < rhs.materialID) ? TRUE : - (lhs.te < rhs.te) ? TRUE : FALSE; - } - - typedef std::map<TEMaterialPair, get_callback_te_t*> get_callback_te_map_t; - get_callback_te_map_t mGetTECallbacks; - typedef std::set<LLUUID> getall_queue_t; getall_queue_t mGetAllQueue; getall_queue_t mGetAllRequested; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 7c9c935a1b..e42d29f7e3 100755 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2059,7 +2059,7 @@ void LLSelectMgr::selectionRemoveMaterial() { LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL; LLMaterialMgr::getInstance()->remove(object->getID(),face); - object->setTEMaterialID(face,LLMaterialID::null); + object->setTEMaterialParams(face, NULL); } return true; } @@ -5865,7 +5865,7 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query) { case LLRender::DIFFUSE_MAP: { - tep->getScale(&s,&t); + tep->getScale(&s,&t); } break; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index f8bc6ef4d3..4e233d479a 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4393,15 +4393,18 @@ S32 LLViewerObject::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID << ", material " << pMaterialID << LL_ENDL; retval = LLPrimitive::setTEMaterialID(te, pMaterialID); - } - // Kitty would like to know if this is necessary? - // Since we should get a setTEMaterialParams that does it anyway? - // - setChanged(TEXTURE); - if (mDrawable.notNull()) + if (retval) { - gPipeline.markTextured(mDrawable); + // Kitty would like to know if this is necessary? + // Since we should get a setTEMaterialParams that does it anyway? + // + setChanged(TEXTURE); + if (mDrawable.notNull()) + { + gPipeline.markTextured(mDrawable); + } } + } return retval; } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 52d05c8030..694ad82914 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1991,15 +1991,17 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) << LL_ENDL; LL_DEBUGS("MaterialTEs") << " " << pMaterialID.asString() << LL_ENDL; - // Use TE-specific version of boost CB hook-up to avoid cross-contaminatin' - LLMaterialMgr::instance().getTE(getRegion()->getRegionID(), pMaterialID, te, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, _3)); + if (res) + { + LLMaterialMgr::instance().get(getRegion()->getRegionID(), pMaterialID, boost::bind(&LLVOVolume::setTEMaterialParamsCallback, this, _1, _2, te)); setChanged(TEXTURE); if (!mDrawable.isNull()) { gPipeline.markTextured(mDrawable); } mFaceMappingChanged = TRUE; - return TEM_CHANGE_TEXTURE; + } + return res; } S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) |