From 7e37e97cee0fc30af56297089eeecb8ca807d9c2 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Wed, 4 Feb 2026 14:12:38 +0200 Subject: #5359 Skip SLua scripts during bulk LSL recompile --- indra/newview/llcompilequeue.cpp | 28 ++++++++++++++++++++++ indra/newview/llpreviewscript.cpp | 2 +- indra/newview/llpreviewscript.h | 2 ++ .../skins/default/xui/en/floater_script_queue.xml | 4 ++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 993b30a014..e0f464168c 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -61,6 +61,7 @@ #include "llviewerassetupload.h" #include "llcorehttputil.h" +#include "llpreviewscript.h" namespace { @@ -462,6 +463,33 @@ 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]); + + 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; + } + } + } + std::string url = object->getRegion()->getCapability("UpdateScriptTask"); { diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 3eadca7a40..da788775f1 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -125,7 +125,7 @@ static bool have_lua_enabled(const LLUUID& object_id) // TEMPORARY: Quick check to see if the code is Lua // since we don't have another way to determine the language yet -static bool is_lua_script(const std::string& code) +bool is_lua_script(const std::string& code) { // Check for LSL's signature "default" state pattern std::regex lsl_pattern("\\s*default\\s*\\{"); diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 922a0f2a38..a85837065e 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -56,6 +56,8 @@ class LLFloaterExperienceProfile; class LLScriptMovedObserver; class LLScriptEditorWSServer; +bool is_lua_script(const std::string& code); + class LLLiveLSLFile : public LLLiveFile { public: 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 a98437ab1d..e272d3073a 100644 --- a/indra/newview/skins/default/xui/en/floater_script_queue.xml +++ b/indra/newview/skins/default/xui/en/floater_script_queue.xml @@ -37,6 +37,10 @@ name="LoadingObjInv"> Loading inventory for: [OBJECT_NAME] + + Skipping SLua script "[SCRIPT_NAME]" (cannot recompile to [TARGET]) +