summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llcompilequeue.cpp28
-rw-r--r--indra/newview/llpreviewscript.cpp2
-rw-r--r--indra/newview/llpreviewscript.h2
-rw-r--r--indra/newview/skins/default/xui/en/floater_script_queue.xml4
4 files changed, 35 insertions, 1 deletions
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<LLFloaterCompileQueue> 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<char> 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]
</floater.string>
+ <floater.string
+ name="SkippingSluaScript">
+ Skipping SLua script "[SCRIPT_NAME]" (cannot recompile to [TARGET])
+ </floater.string>
<button
follows="right|bottom"
height="24"