From a93e6c12fbf8a0b05bd2db820a41aa2e1182c143 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 13 Sep 2023 20:19:04 +0300 Subject: autorun selected script after login --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llluamanager.cpp | 19 +++++++++++++++++++ indra/newview/llluamanager.h | 2 ++ indra/newview/llstartup.cpp | 3 +++ 4 files changed, 35 insertions(+) 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 @@ Value 3 + AutorunLuaScriptName + + Comment + Script name to autorun after login. + Persist + 1 + Type + String + Value + default.lua + ResetUIScaleOnFirstRun Comment 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; } -- cgit v1.2.3