SL-20780 Clean up some dead code.

master
RunitaiLinden 2024-01-09 15:52:33 -06:00
parent 8d16d6e620
commit 983a3c7207
6 changed files with 2 additions and 194 deletions

View File

@ -139,69 +139,18 @@ static bool is_valid_update(const LLSD& data)
}
#endif
class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler
class LLGLTFMaterialOverrideDispatchHandler
{
LOG_CLASS(LLGLTFMaterialOverrideDispatchHandler);
public:
LLGLTFMaterialOverrideDispatchHandler() = default;
~LLGLTFMaterialOverrideDispatchHandler() override = default;
~LLGLTFMaterialOverrideDispatchHandler() = default;
void addCallback(void(*callback)(const LLUUID& object_id, S32 side))
{
mSelectionCallbacks.push_back(callback);
}
bool operator()(const LLDispatcher* dispatcher, const std::string& key, const LLUUID& invoice, const sparam_t& strings) override
{
LL_PROFILE_ZONE_SCOPED;
// receive override data from simulator via LargeGenericMessage
// message should have:
// object_id - UUID of LLViewerObject
// sides - array of S32 indices of texture entries
// gltf_json - array of corresponding Strings of GLTF json for override data
LLSD message;
bool success = true;
#if 0 //deprecated
for(const std::string& llsdRaw : strings)
{
std::istringstream llsdData(llsdRaw);
if (!LLSDSerialize::deserialize(message, llsdData, llsdRaw.length()))
{
LL_WARNS() << "LLGLTFMaterialOverrideDispatchHandler: Attempted to read parameter data into LLSD but failed:" << llsdRaw << LL_ENDL;
success = false;
continue;
}
LLGLTFOverrideCacheEntry object_override;
if (!object_override.fromLLSD(message))
{
// malformed message, nothing we can do to handle it
LL_DEBUGS("GLTF") << "Message without id:" << message << LL_ENDL;
success = false;
continue;
}
// Cache the data
{
LLViewerRegion * region = LLWorld::instance().getRegionFromHandle(object_override.mRegionHandle);
if (region)
{
region->cacheFullUpdateGLTFOverride(object_override);
}
else
{
LL_WARNS("GLTF") << "could not access region for material overrides message cache, region_handle: " << LL_ENDL;
}
}
applyData(object_override);
}
#endif
return success;
}
void doSelectionCallbacks(const LLUUID& object_id, S32 side)
{
for (auto& callback : mSelectionCallbacks)
@ -210,112 +159,6 @@ public:
}
}
void applyData(const LLGLTFOverrideCacheEntry &object_override)
{
// Parse the data
#if 0 // DEPRECATED
LL::WorkQueue::ptr_t main_queue = LL::WorkQueue::getInstance("mainloop");
LL::WorkQueue::ptr_t general_queue = LL::WorkQueue::getInstance("General");
struct ReturnData
{
public:
LLGLTFMaterial mMaterial;
S32 mSide;
bool mSuccess;
};
if (!object_override.mSides.empty())
{
// fromJson() is performance heavy offload to a thread.
main_queue->postTo(
general_queue,
[sides=object_override.mSides]() // Work done on general queue
{
std::vector<ReturnData> results;
results.reserve(sides.size());
// parse json
std::unordered_map<S32, LLSD>::const_iterator iter = sides.begin();
std::unordered_map<S32, LLSD>::const_iterator end = sides.end();
while (iter != end)
{
ReturnData result;
result.mMaterial.applyOverrideLLSD(iter->second);
result.mSuccess = true;
result.mSide = iter->first;
results.push_back(result);
iter++;
}
return results;
},
[object_id=object_override.mObjectId, this](std::vector<ReturnData> results) // Callback to main thread
{
LLViewerObject * obj = gObjectList.findObject(object_id);
if (results.size() > 0 )
{
std::unordered_set<S32> side_set;
for (auto const & result : results)
{
S32 side = result.mSide;
if (result.mSuccess)
{
// copy to heap here because LLTextureEntry is going to take ownership with an LLPointer
LLGLTFMaterial * material = new LLGLTFMaterial(result.mMaterial);
// flag this side to not be nulled out later
side_set.insert(side);
if (obj)
{
obj->setTEGLTFMaterialOverride(side, material);
}
}
// unblock material editor
if (obj && obj->getTE(side) && obj->getTE(side)->isSelected())
{
doSelectionCallbacks(object_id, side);
}
}
if (obj && side_set.size() != obj->getNumTEs())
{ // object exists and at least one texture entry needs to have its override data nulled out
for (int i = 0; i < obj->getNumTEs(); ++i)
{
if (side_set.find(i) == side_set.end())
{
obj->setTEGLTFMaterialOverride(i, nullptr);
if (obj->getTE(i) && obj->getTE(i)->isSelected())
{
doSelectionCallbacks(object_id, i);
}
}
}
}
}
else if (obj)
{ // override list was empty or an error occurred, null out all overrides for this object
for (int i = 0; i < obj->getNumTEs(); ++i)
{
obj->setTEGLTFMaterialOverride(i, nullptr);
if (obj->getTE(i) && obj->getTE(i)->isSelected())
{
doSelectionCallbacks(obj->getID(), i);
}
}
}
});
}
#endif
}
private:
std::vector<void(*)(const LLUUID& object_id, S32 side)> mSelectionCallbacks;
@ -821,12 +664,6 @@ void LLGLTFMaterialList::flushMaterials()
}
}
// static
void LLGLTFMaterialList::registerCallbacks()
{
gGenericDispatcher.addHandler("GLTFMaterialOverride", &handle_gltf_override_message);
}
// static
void LLGLTFMaterialList::modifyMaterialCoro(std::string cap_url, LLSD overrides, void(*done_callback)(bool) )
{
@ -864,7 +701,3 @@ void LLGLTFMaterialList::modifyMaterialCoro(std::string cap_url, LLSD overrides,
}
}
void LLGLTFMaterialList::loadCacheOverrides(const LLGLTFOverrideCacheEntry& override)
{
handle_gltf_override_message.applyData(override);
}

View File

@ -52,8 +52,6 @@ public:
void flushMaterials();
static void registerCallbacks();
// Queue an modification of a material that we want to send to the simulator. Call "flushUpdates" to flush pending updates.
// id - ID of object to modify
// side - TexureEntry index to modify, or -1 for all sides
@ -99,8 +97,6 @@ public:
// any override data that arrived before the object was ready to receive it
void applyQueuedOverrides(LLViewerObject* obj);
static void loadCacheOverrides(const LLGLTFOverrideCacheEntry& override);
// Apply an override update with the given data
void applyOverrideMessage(LLMessageSystem* msg, const std::string& data);

View File

@ -1511,9 +1511,6 @@ bool idle_startup()
gXferManager->registerCallbacks(gMessageSystem);
display_startup();
LLGLTFMaterialList::registerCallbacks();
display_startup();
LLStartUp::initNameCache();
display_startup();

View File

@ -5041,11 +5041,6 @@ void LLViewerObject::updateTEMaterialTextures(U8 te)
LLViewerObject* obj = gObjectList.findObject(id);
if (obj)
{
LLViewerRegion* region = obj->getRegion();
if(region)
{
region->loadCacheMiscExtras(obj->getLocalID());
}
obj->markForUpdate();
}
});

View File

@ -1879,8 +1879,6 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry)
addActiveCacheEntry(entry);
}
loadCacheMiscExtras(entry->getLocalID());
return obj;
}
@ -3655,15 +3653,6 @@ std::string LLViewerRegion::getSimHostName()
return std::string("...");
}
void LLViewerRegion::loadCacheMiscExtras(U32 local_id)
{
auto iter = mImpl->mGLTFOverridesLLSD.find(local_id);
if (iter != mImpl->mGLTFOverridesLLSD.end())
{
LLGLTFMaterialList::loadCacheOverrides(iter->second);
}
}
void LLViewerRegion::applyCacheMiscExtras(LLViewerObject* obj)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;

View File

@ -435,8 +435,6 @@ private:
bool isNonCacheableObjectCreated(U32 local_id);
public:
void loadCacheMiscExtras(U32 local_id);
void applyCacheMiscExtras(LLViewerObject* obj);
struct CompareDistance