MAINT-7847 The presence of certain Avatars stops local specular textures from "sticking". Yes really.

FIXED. Allows set material explicitly to material manager.
meow-7.2.2
ruslantproductengine 2018-02-14 20:52:31 +02:00
parent cc30a9e2f5
commit 84e5dc37b6
5 changed files with 44 additions and 10 deletions

View File

@ -61,6 +61,11 @@ LLMaterialID::LLMaterialID(const LLMaterialID& pOtherMaterialID)
copyFromOtherMaterialID(pOtherMaterialID);
}
LLMaterialID::LLMaterialID(const LLUUID& lluid)
{
set(lluid.mData);
}
LLMaterialID::~LLMaterialID()
{
}

View File

@ -40,6 +40,7 @@ public:
LLMaterialID(const LLSD::Binary& pMaterialID);
LLMaterialID(const void* pMemory);
LLMaterialID(const LLMaterialID& pOtherMaterialID);
LLMaterialID(const LLUUID& lluid);
~LLMaterialID();
bool operator == (const LLMaterialID& pOtherMaterialID) const;

View File

@ -350,6 +350,25 @@ void LLMaterialMgr::remove(const LLUUID& object_id, const U8 te)
put(object_id, te, LLMaterial::null);
}
void LLMaterialMgr::setLocalMaterial(const LLUUID& region_id, LLMaterialPtr material_ptr)
{
LLUUID uuid;
uuid.generate();
LLMaterialID material_id(uuid);
while (mMaterials.end() != mMaterials.find(material_id))
{ //probability that this loop will executed is very, very low (one in a billion chance)
uuid.generate();
material_id.set(uuid.mData);
}
LL_DEBUGS("Materials") << "region " << region_id << "new local material id " << material_id << LL_ENDL;
mMaterials.insert(std::pair<LLMaterialID, LLMaterialPtr>(material_id, material_ptr));
setMaterialCallbacks(material_id, material_ptr);
mGetPending.erase(pending_material_t(region_id, material_id));
}
const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data)
{
LL_DEBUGS("Materials") << "region " << region_id << " material id " << material_id << LL_ENDL;
@ -362,17 +381,26 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL
itMaterial = ret.first;
}
setMaterialCallbacks(material_id, itMaterial->second);
mGetPending.erase(pending_material_t(region_id, material_id));
return itMaterial->second;
}
void LLMaterialMgr::setMaterialCallbacks(const LLMaterialID& material_id, const LLMaterialPtr material_ptr)
{
TEMaterialPair te_mat_pair;
te_mat_pair.materialID = material_id;
U32 i = 0;
while (i < LLTEContents::MAX_TES)
while (i < LLTEContents::MAX_TES && !mGetTECallbacks.empty())
{
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);
(*itCallbackTE->second)(material_id, material_ptr, te_mat_pair.te);
delete itCallbackTE->second;
mGetTECallbacks.erase(itCallbackTE);
}
@ -381,15 +409,11 @@ const LLMaterialPtr LLMaterialMgr::setMaterial(const LLUUID& region_id, const LL
get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id);
if (itCallback != mGetCallbacks.end())
{
(*itCallback->second)(material_id, itMaterial->second);
(*itCallback->second)(material_id, material_ptr);
delete itCallback->second;
mGetCallbacks.erase(itCallback);
}
mGetPending.erase(pending_material_t(region_id, material_id));
return itMaterial->second;
}
void LLMaterialMgr::onGetResponse(bool success, const LLSD& content, const LLUUID& region_id)

View File

@ -56,6 +56,9 @@ public:
boost::signals2::connection getAll(const LLUUID& region_id, getall_callback_t::slot_type cb);
void put(const LLUUID& object_id, const U8 te, const LLMaterial& material);
void remove(const LLUUID& object_id, const U8 te);
//explicitly add new material to material manager
void setLocalMaterial(const LLUUID& region_id, LLMaterialPtr material_ptr);
private:
void clearGetQueues(const LLUUID& region_id);
@ -63,7 +66,8 @@ private:
bool isGetAllPending(const LLUUID& region_id) const;
void markGetPending(const LLUUID& region_id, const LLMaterialID& material_id);
const LLMaterialPtr setMaterial(const LLUUID& region_id, const LLMaterialID& material_id, const LLSD& material_data);
void setMaterialCallbacks(const LLMaterialID& material_id, const LLMaterialPtr material_ptr);
static void onIdle(void*);
static void CapsRecvForRegion(const LLUUID& regionId, LLUUID regionTest, std::string pumpname);

View File

@ -2198,7 +2198,7 @@ bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture)
//setup new materials
for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it)
{
LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second);
LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), it->second);
LLViewerObject::setTEMaterialParams(it->first, it->second);
}
@ -2301,7 +2301,7 @@ S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialPa
if(new_material) {
pMaterial = new_material;
LLMaterialMgr::getInstance()->put(getID(),te,*pMaterial);
LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), pMaterial);
}
}