summaryrefslogtreecommitdiff
path: root/indra/newview/llmaterialmgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llmaterialmgr.cpp')
-rw-r--r--indra/newview/llmaterialmgr.cpp104
1 files changed, 87 insertions, 17 deletions
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index 25e92e27d9..e41a46038f 100644
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -93,6 +93,7 @@ LLMaterialsResponder::~LLMaterialsResponder()
void LLMaterialsResponder::result(const LLSD& pContent)
{
+ LL_DEBUGS("Materials") << LL_ENDL;
mCallback(true, pContent);
}
@@ -176,35 +177,88 @@ const LLMaterialPtr LLMaterialMgr::get(const LLUUID& region_id, const LLMaterial
boost::signals2::connection LLMaterialMgr::get(const LLUUID& region_id, const LLMaterialID& material_id, LLMaterialMgr::get_callback_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_t signal;
signal.connect(cb);
signal(material_id, itMaterial->second);
- return boost::signals2::connection();
+ connection = boost::signals2::connection();
}
-
- if (!isGetPending(region_id, material_id))
+ else
{
- get_queue_t::iterator itQueue = mGetQueue.find(region_id);
- if (mGetQueue.end() == itQueue)
+ 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);
+ }
+
+ get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id);
+ if (itCallback == mGetCallbacks.end())
{
- LL_DEBUGS("Materials") << "mGetQueue inserting region "<<region_id<<" material id " << material_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;
+ std::pair<get_callback_map_t::iterator, bool> ret = mGetCallbacks.insert(std::pair<LLMaterialID, get_callback_t*>(material_id, new get_callback_t()));
+ itCallback = ret.first;
}
- itQueue->second.insert(material_id);
- markGetPending(region_id, material_id);
+ connection = itCallback->second->connect(cb);;
}
+
+ return connection;
+}
- get_callback_map_t::iterator itCallback = mGetCallbacks.find(material_id);
- if (itCallback == mGetCallbacks.end())
+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())
{
- std::pair<get_callback_map_t::iterator, bool> ret = mGetCallbacks.insert(std::pair<LLMaterialID, get_callback_t*>(material_id, new get_callback_t()));
- itCallback = ret.first;
+ 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();
}
- return itCallback->second->connect(cb);;
+ 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
@@ -291,6 +345,22 @@ 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;
}
@@ -554,8 +624,8 @@ void LLMaterialMgr::processGetQueue()
postData[MATERIALS_CAP_ZIP_FIELD] = materialBinary;
LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("POST", capURL, boost::bind(&LLMaterialMgr::onGetResponse, this, _1, _2, region_id));
- LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '"<< capURL << " for " << materialSize << " materials."
- << "'\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL;
+ LL_DEBUGS("Materials") << "POSTing to region '" << regionp->getName() << "' at '"<< capURL << " for " << materialsData.size() << " materials."
+ << "\ndata: " << ll_pretty_print_sd(materialsData) << LL_ENDL;
LLHTTPClient::post(capURL, postData, materialsResponder);
}
}