summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
authorMike <contact@mikelittman.me>2026-10-23 09:49:49 -0400
committerGitHub <noreply@github.com>2026-10-23 21:49:49 +0800
commitf378dc9d6b8f74d34b4dfd3b65cf564c689bdb95 (patch)
tree2043cee9aec99862882a0d5cb2423ad1ccfb02ea /indra/newview/llpreviewscript.cpp
parentadc157b9572574f623e0d7c497ff204da5050a2e (diff)
Add a loopback MCP server for the running viewer (#44)
The server is off by default and listens on 127.0.0.1. It can see and act in the logged-in session, including inventory, object contents, script editing, mesh and material upload, and animated mesh.
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rw-r--r--indra/newview/llpreviewscript.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index ffb748baae..8364b7d964 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -2304,6 +2304,23 @@ void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors)
closeIfNeeded();
}
+void LLLiveLSLEditor::openInExternalEditorWhenReady()
+{
+ if (!mScriptEd)
+ {
+ return;
+ }
+ if (mAssetStatus == PREVIEW_ASSET_LOADED)
+ {
+ if (getIsModifiable())
+ {
+ mScriptEd->openInExternalEditor();
+ }
+ return;
+ }
+ mOpenExternalWhenLoaded = true;
+}
+
void LLLiveLSLEditor::loadAsset()
{
//LL_INFOS() << "LLLiveLSLEditor::loadAsset()" << LL_ENDL;
@@ -2415,6 +2432,11 @@ void LLLiveLSLEditor::onLoadComplete(const LLUUID& asset_id,
instance->mScriptEd->setEnableEditing(true);
instance->mAssetStatus = PREVIEW_ASSET_LOADED;
instance->mScriptEd->setAssetID(asset_id);
+ if (instance->mOpenExternalWhenLoaded && instance->getIsModifiable())
+ {
+ instance->mOpenExternalWhenLoaded = false;
+ instance->mScriptEd->openInExternalEditor();
+ }
}
else
{
@@ -2431,6 +2453,7 @@ void LLLiveLSLEditor::onLoadComplete(const LLUUID& asset_id,
{
LLNotificationsUtil::add("UnableToLoadScript");
}
+ instance->mOpenExternalWhenLoaded = false;
instance->mAssetStatus = PREVIEW_ASSET_ERROR;
}
}