From 7f88aedbc3b53496bc99d8e0e64a818c7a3f6d6f Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Fri, 24 Jan 2025 00:26:00 +0100 Subject: #3423 Add Lua as Compile Target in Viewer Script Editor --- indra/newview/llcompilequeue.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'indra/newview/llcompilequeue.cpp') diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 552ea75559..32d0f3fa1b 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -122,9 +122,9 @@ namespace class LLQueuedScriptAssetUpload : public LLScriptAssetUpload { public: - LLQueuedScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLUUID assetId, TargetType_t targetType, + LLQueuedScriptAssetUpload(LLUUID taskId, LLUUID itemId, LLUUID assetId, std::string compileTarget, bool isRunning, std::string scriptName, LLUUID queueId, LLUUID exerienceId, taskUploadFinish_f finish) : - LLScriptAssetUpload(taskId, itemId, targetType, isRunning, + LLScriptAssetUpload(taskId, itemId, compileTarget, isRunning, exerienceId, std::string(), finish, nullptr), mScriptName(scriptName), mQueueId(queueId) @@ -183,9 +183,7 @@ struct LLScriptQueueData // Default constructor LLFloaterScriptQueue::LLFloaterScriptQueue(const LLSD& key) : - LLFloater(key), - mDone(false), - mMono(false) + LLFloater(key) { } @@ -197,7 +195,7 @@ LLFloaterScriptQueue::~LLFloaterScriptQueue() bool LLFloaterScriptQueue::postBuild() { - childSetAction("close",onCloseBtn,this); + childSetAction("close", onCloseBtn, this); getChildView("close")->setEnabled(false); setVisible(true); return true; @@ -222,8 +220,8 @@ bool LLFloaterScriptQueue::start() LLStringUtil::format_map_t args; args["[START]"] = mStartString; - args["[COUNT]"] = llformat ("%d", mObjectList.size()); - buffer = getString ("Starting", args); + args["[COUNT]"] = llformat("%d", mObjectList.size()); + buffer = getString("Starting", args); getChild("queue output")->addSimpleElement(buffer, ADD_BOTTOM); @@ -276,8 +274,8 @@ bool LLFloaterCompileQueue::hasExperience( const LLUUID& id ) const return mExperienceIds.find(id) != mExperienceIds.end(); } -// //Attempt to record this asset ID. If it can not be inserted into the set -// //then it has already been processed so return false. +// Attempt to record this asset ID. If it can not be inserted into the set +// then it has already been processed so return false. void LLFloaterCompileQueue::handleHTTPResponse(std::string pumpName, const LLSD &expresult) { @@ -359,7 +357,7 @@ bool LLFloaterCompileQueue::processScript(LLHandle hfloat LLCheckedHandle floater(hfloater); // Dereferencing floater may fail. If they do they throw LLExeceptionStaleHandle. // which is caught in objectScriptProcessingQueueCoro - bool monocompile = floater->mMono; + std::string compile_target = floater->mCompileTarget; // Initial test to see if we can (or should) attempt to compile the script. LLInventoryItem *item = dynamic_cast(inventory); @@ -470,7 +468,7 @@ bool LLFloaterCompileQueue::processScript(LLHandle hfloat LLResourceUploadInfo::ptr_t uploadInfo(new LLQueuedScriptAssetUpload(object->getID(), inventory->getUUID(), assetId, - monocompile ? LLScriptAssetUpload::MONO : LLScriptAssetUpload::LSL2, + compile_target, true, inventory->getName(), LLUUID(), -- cgit v1.3 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(-) (limited to 'indra/newview/llcompilequeue.cpp') 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]) +