From da1983fbdfa5a41fa6ba1d6fbefa073a53c4a282 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Wed, 12 Aug 2026 20:16:59 +0300 Subject: #5574 Filter incompatible scripts by metadata --- indra/newview/llcompilequeue.cpp | 41 ++++++++-------------- .../skins/default/xui/en/floater_script_queue.xml | 4 +-- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index e0f464168c..ba19135fce 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -52,7 +52,6 @@ #include "lldir.h" #include "llnotificationsutil.h" #include "llviewerstats.h" -#include "llfilesystem.h" #include "lluictrlfactory.h" #include "lltrans.h" @@ -61,7 +60,6 @@ #include "llviewerassetupload.h" #include "llcorehttputil.h" -#include "llpreviewscript.h" namespace { @@ -463,31 +461,22 @@ bool LLFloaterCompileQueue::processScript(LLHandle hfloat LLUUID assetId = result["asset_id"]; - // Check if this is a SLua script that shouldn't be recompiled to Mono/LSL - if (compile_target == "mono" || compile_target == "lsl2") - { - // Read the script from cache to check its type - LLFileSystem file(assetId, LLAssetType::AT_LSL_TEXT, LLFileSystem::READ); - if (file.getSize() > 0) - { - S32 file_length = file.getSize(); - std::vector buffer(file_length + 1); - file.read((U8*)&buffer[0], file_length); - buffer[file_length] = 0; - std::string script_text(&buffer[0]); + const bool script_is_lua = item->getInventorySubType() == SST_LUA; + const bool target_is_lua = compile_target == "luau"; + const bool incompatible_language = target_is_lua != script_is_lua; - if (is_lua_script(script_text)) - { - // This is a SLua script - skip it with a warning - LLStringUtil::format_map_t args; - args["[SCRIPT_NAME]"] = inventory->getName(); - args["[TARGET]"] = (compile_target == "mono") ? "Mono" : "LSL"; - std::string buffer = floater->getString("SkippingSluaScript", args); - floater->addStringMessage(buffer); - LL_INFOS("SCRIPTQ") << "Skipping SLua script: " << inventory->getName() << LL_ENDL; - return true; - } - } + // Lua and LSL use different source languages, so do not send an incompatible + // script to the compiler. The inventory subtype identifies the source language. + if (incompatible_language) + { + LLStringUtil::format_map_t args; + args["[SCRIPT_NAME]"] = inventory->getName(); + args["[TARGET]"] = compile_target; + std::string buffer = floater->getString("SkippingIncompatibleScript", args); + floater->addStringMessage(buffer); + LL_INFOS("SCRIPTQ") << "Skipping incompatible script: " << inventory->getName() + << " (target " << compile_target << ")" << LL_ENDL; + return true; } std::string url = object->getRegion()->getCapability("UpdateScriptTask"); diff --git a/indra/newview/skins/default/xui/en/floater_script_queue.xml b/indra/newview/skins/default/xui/en/floater_script_queue.xml index e272d3073a..181d08c67b 100644 --- a/indra/newview/skins/default/xui/en/floater_script_queue.xml +++ b/indra/newview/skins/default/xui/en/floater_script_queue.xml @@ -38,8 +38,8 @@ Loading inventory for: [OBJECT_NAME] - Skipping SLua script "[SCRIPT_NAME]" (cannot recompile to [TARGET]) + name="SkippingIncompatibleScript"> + Skipping script "[SCRIPT_NAME]" (cannot recompile to [TARGET])