summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2023-09-13 20:19:04 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2023-09-13 20:19:04 +0300
commita93e6c12fbf8a0b05bd2db820a41aa2e1182c143 (patch)
tree87ca81b149c8e0ad8cf0b6ed536ee5a1376cb5c2 /indra/newview
parent5b09d6372ff0900f67714af61bea100ee9a6d87b (diff)
autorun selected script after login
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llluamanager.cpp19
-rw-r--r--indra/newview/llluamanager.h2
-rw-r--r--indra/newview/llstartup.cpp3
4 files changed, 35 insertions, 0 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 816b7b7c92..cc9740d934 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -17063,6 +17063,17 @@
<key>Value</key>
<integer>3</integer>
</map>
+ <key>AutorunLuaScriptName</key>
+ <map>
+ <key>Comment</key>
+ <string>Script name to autorun after login.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>String</string>
+ <key>Value</key>
+ <string>default.lua</string>
+ </map>
<key>ResetUIScaleOnFirstRun</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llluamanager.cpp b/indra/newview/llluamanager.cpp
index edfd5c3cad..df5011597b 100644
--- a/indra/newview/llluamanager.cpp
+++ b/indra/newview/llluamanager.cpp
@@ -253,3 +253,22 @@ void LLLUAmanager::runScriptLine(const std::string &cmd, script_finished_fn cb)
}
});
}
+
+void LLLUAmanager::runScriptOnLogin()
+{
+ std::string filename = gSavedSettings.getString("AutorunLuaScriptName");
+ if (filename.empty())
+ {
+ LL_INFOS() << "Script name wasn't set." << LL_ENDL;
+ return;
+ }
+
+ filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename);
+ if (!gDirUtilp->fileExists(filename))
+ {
+ LL_INFOS() << filename << " was not found." << LL_ENDL;
+ return;
+ }
+
+ runScriptFile(filename);
+}
diff --git a/indra/newview/llluamanager.h b/indra/newview/llluamanager.h
index 5bdf58bd3d..4581c33ff2 100644
--- a/indra/newview/llluamanager.h
+++ b/indra/newview/llluamanager.h
@@ -34,6 +34,8 @@ public:
static void runScriptFile(const std::string &filename, script_finished_fn cb = script_finished_fn());
static void runScriptLine(const std::string &cmd, script_finished_fn cb = script_finished_fn());
+
+ static void runScriptOnLogin();
};
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 1b0a814c45..748c79f9d6 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -207,6 +207,7 @@
#include "llstacktrace.h"
#include "threadpool.h"
+#include "llluamanager.h"
#include "llperfstats.h"
@@ -2361,6 +2362,8 @@ bool idle_startup()
LLPerfStats::StatsRecorder::setAutotuneInit();
+ LLLUAmanager::runScriptOnLogin();
+
return TRUE;
}