diff options
| author | Andrey Lihatskiy <118752495+marchcat@users.noreply.github.com> | 2026-09-22 19:43:27 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-22 19:43:27 +0300 |
| commit | 5adb44f3e3e1dfafb96251a09055d5684ded57b3 (patch) | |
| tree | 238487031ca8119d6fe7bee4055a53c5ed0d9210 | |
| parent | 9e0178f26972ee8a913b92c99cf069707d3ddc3e (diff) | |
| parent | a1bcdd4180f1e86e0299ac8e5752c08a314a0a36 (diff) | |
Merge pull request #6359 from secondlife/marchcat/6221
Marchcat/6221
| -rw-r--r-- | indra/newview/llpanelcontents.cpp | 37 | ||||
| -rw-r--r-- | indra/newview/llpanelcontents.h | 4 |
2 files changed, 23 insertions, 18 deletions
diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index 43dd1bfe40..d9301d60f8 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -111,6 +111,7 @@ LLPanelContents::LLPanelContents() LLPanelContents::~LLPanelContents() { + mSimulatorFeaturesConnection.disconnect(); // Children all cleaned up by default view destructor. } @@ -119,6 +120,7 @@ void LLPanelContents::getState(LLViewerObject *objectp ) { if( !objectp ) { + mSimulatorFeaturesConnection.disconnect(); mLastScriptObjectID.setNull(); getChildView("button new script")->setEnabled(false); getChildView("button new notecard")->setEnabled(false); @@ -154,11 +156,18 @@ void LLPanelContents::getState(LLViewerObject *objectp ) region->getSimulatorFeatures(simulatorFeatures); lua_region = simulatorFeatures["LuaScriptsEnabled"].asBoolean(); } + mSimulatorFeaturesConnection.disconnect(); + if (region && !region->simulatorFeaturesReceived()) + { + mSimulatorFeaturesConnection = region->setSimulatorFeaturesReceivedCallback( + boost::bind(&LLPanelContents::onSimulatorFeaturesReceived, this, _1)); + } LLComboBox* new_script = getChild<LLComboBox>("button new script"); new_script->setEnabledByValue("lua", lua_region); if (mLastScriptObjectID != objectp->getID() || mLastLuaRegion != lua_region) { - new_script->setValue(lua_region ? "lua" : "lsl"); + mNewScriptIsLua = lua_region; + new_script->setValue(mNewScriptIsLua ? "lua" : "lsl"); } mLastScriptObjectID = objectp->getID(); mLastLuaRegion = lua_region; @@ -187,6 +196,11 @@ void LLPanelContents::getState(LLViewerObject *objectp ) } } +void LLPanelContents::onSimulatorFeaturesReceived(const LLUUID&) +{ + refresh(); +} + void LLPanelContents::onFilterEdit() { const std::string& filter_substring = mFilterEditor->getText(); @@ -277,31 +291,18 @@ void LLPanelContents::onNewScriptFlyoutCommit(LLUICtrl* ctrl) LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(children_ok); if (!object) return; - U8 script_language; const std::string value = ctrl->getValue().asString(); if (value == "lsl") { - script_language = SST_LSL; + mNewScriptIsLua = false; } else if (value == "lua") { - script_language = SST_LUA; - } - else - { - script_language = SST_LSL; - LLViewerRegion* region = object->getRegion(); - if (region && region->simulatorFeaturesReceived()) - { - LLSD simulatorFeatures; - region->getSimulatorFeatures(simulatorFeatures); - if (simulatorFeatures["LuaScriptsEnabled"].asBoolean()) - { - script_language = SST_LUA; - } - } + mNewScriptIsLua = true; } + ctrl->setValue(mNewScriptIsLua ? "lua" : "lsl"); + const U8 script_language = mNewScriptIsLua ? SST_LUA : SST_LSL; std::string vm = (script_language == SST_LUA) ? "luau" : "mono"; LLSD params; diff --git a/indra/newview/llpanelcontents.h b/indra/newview/llpanelcontents.h index d576b72353..e2909d21fc 100644 --- a/indra/newview/llpanelcontents.h +++ b/indra/newview/llpanelcontents.h @@ -35,6 +35,7 @@ #include "llvoinventorylistener.h" #include "llscripteditorws.h" #include "v3math.h" +#include <boost/signals2/connection.hpp> class LLButton; class LLPanelObjectInventory; @@ -79,10 +80,13 @@ public: protected: void getState(LLViewerObject *object); void onFilterEdit(); + void onSimulatorFeaturesReceived(const LLUUID& region_id); bool mDirtyFilter { false }; LLUUID mLastScriptObjectID; bool mLastLuaRegion { false }; + bool mNewScriptIsLua { false }; + boost::signals2::connection mSimulatorFeaturesConnection; public: class LLFilterEditor* mFilterEditor; |
