summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2025-10-10 10:46:07 -0700
committerRider Linden <rider@lindenlab.com>2025-10-10 10:46:07 -0700
commitc21fda0b79c2e18c0dccf9e88524a716b57b94bf (patch)
treed4500ea28b20dcb0aa274b3bbc0ad10585634193
parent5306ad767bc1cc768145074aac25944c6059b3c2 (diff)
Allow the viewer to relaunch the external editor. It will reuse the LiveFile unless the file name has changed.
-rw-r--r--indra/newview/CMakeLists.txt3
-rw-r--r--indra/newview/llpreviewscript.cpp22
2 files changed, 17 insertions, 8 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 87e350a69d..5a49b43367 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1653,7 +1653,8 @@ set_source_files_properties(${viewer_SHADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
list(APPEND viewer_SOURCE_FILES ${viewer_SHADER_FILES})
-
+# note that the scripts which publish these files are sensitive to the file
+# extensions. Be cautious about adding new file types here.
set(viewer_APPSETTINGS_FILES
app_settings/anim.ini
app_settings/autoreplace.xml
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index bd1f68da33..b3e53df6d8 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -1113,11 +1113,11 @@ void LLScriptEdCore::doSave( bool close_after_save )
void LLScriptEdCore::openInExternalEditor()
{
- if (mContainer->mLiveFile)
- {
- // If already open in an external editor, just return
- return;
- }
+ //if (mContainer->mLiveFile)
+ //{
+ // // If already open in an external editor, just return
+ // return;
+ //}
// Generate a suitable filename
std::string script_name = mScriptName;
@@ -1141,9 +1141,17 @@ void LLScriptEdCore::openInExternalEditor()
writeToFile(filename);
}
+ if (mContainer->mLiveFile && mContainer->mLiveFile->filename() != filename)
+ { // The name may have changed if we changed the type of scipt being edited.
+ delete mContainer->mLiveFile;
+ mContainer->mLiveFile = NULL;
+ }
// Start watching file changes.
- mContainer->mLiveFile = new LLLiveLSLFile(filename, boost::bind(&LLScriptEdContainer::onExternalChange, mContainer, _1));
- mContainer->mLiveFile->addToEventTimer();
+ if (!mContainer->mLiveFile)
+ {
+ mContainer->mLiveFile = new LLLiveLSLFile(filename, boost::bind(&LLScriptEdContainer::onExternalChange, mContainer, _1));
+ mContainer->mLiveFile->addToEventTimer();
+ }
mContainer->startWebsocketServer();
// Open it in external editor.