diff options
| author | Erik Kundiman <erik@megapahit.org> | 2026-09-01 18:35:23 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2026-09-04 21:58:53 +0800 |
| commit | 00bb3bb6f07660bd914d29a1389342bb3060d254 (patch) | |
| tree | 431f574922494d2201718f13085f17bc6bd7fb42 /indra/newview/llviewermenu.cpp | |
| parent | a8636720129952c10cf49ab80da21bf8b340b96c (diff) | |
| parent | 4ef9f8f14b35ed388c294d53767a0dca0e890924 (diff) | |
Merge remote-tracking branch 'secondlife/release/26.4' into 26.4
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
| -rw-r--r-- | indra/newview/llviewermenu.cpp | 217 |
1 files changed, 172 insertions, 45 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 60ac866b7d..d726091f79 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -79,6 +79,7 @@ #include "llfloatersearch.h" #include "llfloaterscriptdebug.h" #include "llfloatersnapshot.h" +#include "llscripteditorws.h" #include "llfloatertools.h" #include "llfloaterworldmap.h" #include "llfloaterbuildoptions.h" @@ -127,6 +128,7 @@ #include "llviewernetwork.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" +#include "llviewerregion.h" #include "llviewerstats.h" #include "llviewerstatsrecorder.h" #include "llvlcomposition.h" @@ -2310,7 +2312,7 @@ class LLAdvancedDropPacket : public view_listener_t { bool handleEvent(const LLSD& userdata) { - gMessageSystem->mPacketRing.dropPackets(1); + gMessageSystem->dropPackets(1); return true; } }; @@ -3723,7 +3725,7 @@ class LLAvatarSetImpostorMode : public view_listener_t return false; } - LLVOAvatar::cullAvatarsByPixelArea(); + LLVOAvatar::setCullNeedsUpdate(); return true; } // handleEvent() }; @@ -4102,17 +4104,6 @@ bool enable_estate_eject_ban(const LLSD& avatar_id) return region->getOwner() == gAgent.getID() || region->isEstateManager(); } -bool my_profile_visible() -{ - LLFloater* floaterp = LLAvatarActions::getProfileFloater(gAgentID); - return floaterp && floaterp->isInVisibleChain(); -} - -bool picks_tab_visible() -{ - return my_profile_visible() && LLAvatarActions::isPickTabSelected(gAgentID); -} - bool enable_freeze_eject(const LLSD& avatar_id) { // Use avatar_id if available, otherwise default to right-click avatar @@ -5210,6 +5201,31 @@ static void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) derez_objects(dest, dest_id, first_region, error, NULL); } +bool save_object_back_to_contents(LLViewerObject* object, const LLUUID& source_task_id) +{ + if (!object || source_task_id.isNull()) + { + return false; + } + + LLViewerRegion* first_region = object->getRegion(); + if (!first_region) + { + return false; + } + + std::vector<LLViewerObjectPtr> objects; + objects.push_back(object); + + std::string error; + derez_objects(DRD_SAVE_INTO_TASK_INVENTORY, source_task_id, first_region, error, &objects); + if (!error.empty()) + { + return false; + } + return true; +} + static void derez_objects_separate(EDeRezDestination dest, const LLUUID &dest_id) { std::vector<LLViewerObjectPtr> derez_object_list; @@ -5257,6 +5273,27 @@ void handle_link_objects() } } +void handle_unlink_objects() +{ + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) + { + LLPanel* visited_panel = LLFloaterSidePanelContainer::getPanel("places", "Teleport History"); + if (visited_panel && visited_panel->isInVisibleChain()) + { + LLFloaterReg::hideInstance("places"); + } + else + { + LLFloaterReg::toggleInstanceOrBringToFront("places"); + LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "open_teleport_history_tab")); + } + } + else + { + LLSelectMgr::getInstance()->unlinkObjects(); + } +} + // You can return an object to its owner if it is on your land. class LLObjectReturn : public view_listener_t { @@ -5784,10 +5821,13 @@ class LLToolsSaveToObjectInventory : public view_listener_t bool handleEvent(const LLSD& userdata) { LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); - if(node && (node->mValid) && (!node->mFromTaskID.isNull())) + if (node && node->mValid && !node->mFromTaskID.isNull()) { - // *TODO: check to see if the fromtaskid object exists. - derez_objects(DRD_SAVE_INTO_TASK_INVENTORY, node->mFromTaskID); + LLViewerObject* object = node->getObject(); + if (object) + { + save_object_back_to_contents(object, node->mFromTaskID); + } } return true; } @@ -5870,6 +5910,47 @@ class LLToolsCheckSelectionLODMode : public view_listener_t }; +class LLToolsCheckScriptEditorServer : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLScriptEditorWSServer::ptr_t server = LLScriptEditorWSServer::getServer(); + return server && server->isRunning(); + } +}; + +class LLToolsEnableScriptEditorServer : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + return LLScriptEditorWSServer::isEnabled(); + } +}; + +class LLToolsToggleScriptEditorServer : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLScriptEditorWSServer::ptr_t server = LLScriptEditorWSServer::getServer(); + if (server && server->isRunning()) + { + LLWebsocketMgr::instance().stopServer(LLScriptEditorWSServer::DEFAULT_SERVER_NAME); + } + else + { + if (LLScriptEditorWSServer::isTightIntegration()) + { + LLScriptEditorWSServer::launchVSCode(); + } + else + { + LLScriptEditorWSServer::ensureServerRunning(); + } + } + return true; + } +}; + // Round the position of all root objects to the grid class LLToolsSnapObjectXY : public view_listener_t { @@ -6825,7 +6906,7 @@ class LLAvatarTogglePicks : public view_listener_t instance->setFocus(true); LLAvatarActions::showPicks(gAgent.getID()); } - else if (picks_tab_visible()) + else if (LLAvatarActions::myPicksTabVisible()) { instance->closeFloater(); } @@ -8166,13 +8247,13 @@ class LLToolsSelectedScriptAction : public view_listener_t bool handleEvent(const LLSD& userdata) { std::string action = userdata.asString(); - bool mono = false; + std::string target = "lsl2"; std::string msg, name; std::string title; if (action == "compile mono") { name = "compile_queue"; - mono = true; + target = "mono"; msg = "Recompile"; title = LLTrans::getString("CompileQueueTitle"); } @@ -8182,6 +8263,20 @@ class LLToolsSelectedScriptAction : public view_listener_t msg = "Recompile"; title = LLTrans::getString("CompileQueueTitle"); } + else if (action == "compile lua") + { + name = "compile_queue"; + target = "luau"; + msg = "Recompile"; + title = LLTrans::getString("CompileQueueTitle"); + } + else if (action == "compile lsl-luau") + { + name = "compile_queue"; + target = "lsl-luau"; + msg = "Recompile"; + title = LLTrans::getString("CompileQueueTitle"); + } else if (action == "reset") { name = "reset_queue"; @@ -8205,7 +8300,7 @@ class LLToolsSelectedScriptAction : public view_listener_t LLFloaterScriptQueue* queue =LLFloaterReg::getTypedInstance<LLFloaterScriptQueue>(name, LLSD(id)); if (queue) { - queue->setMono(mono); + queue->setCompileTarget(target); if (queue_actions(queue, msg)) { queue->setTitle(title); @@ -8604,6 +8699,27 @@ class LLEditableSelectedMono : public view_listener_t } }; +static bool is_lua_scripts_enabled() +{ + LLViewerRegion* region = gAgent.getRegion(); + if (!region || region->getCapability("UpdateScriptTask").empty() || !region->simulatorFeaturesReceived()) + { + return false; + } + + LLSD simulator_features; + region->getSimulatorFeatures(simulator_features); + return simulator_features["LuaScriptsEnabled"].asBoolean(); +} + +class LLEditableSelectedLua : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + return is_editable_selected() && is_lua_scripts_enabled(); + } +}; + bool enable_object_take_copy() { bool all_valid = false; @@ -8690,15 +8806,6 @@ class LLToolsEnableSaveToObjectInventory : public view_listener_t } }; -class LLToggleHowTo : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - LLFloaterReg::toggleInstanceOrBringToFront("guidebook"); - return true; - } -}; - class LLViewEnableMouselook : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -9836,6 +9943,16 @@ void handle_flush_name_caches() if (gCacheName) gCacheName->clear(); } +bool is_master_audio_muted() +{ + return LLAppViewer::instance()->getMasterSystemAudioMute(); +} + +void toggle_master_audio() +{ + LLAppViewer::instance()->setMasterSystemAudioMute(!is_master_audio_muted()); +} + class LLUploadCostCalculator : public view_listener_t { std::string mCostStr; @@ -9957,6 +10074,23 @@ void show_topinfobar_context_menu(LLView* ctrl, S32 x, S32 y) LLMenuGL::showPopup(ctrl, show_topbarinfo_context_menu, x, y); } +static void register_agent_ui_callbacks() +{ + // These functions are used by menu and commands, they need to persist for the lifetime of the application + // Note: executes before LLToolBar::createButton and before menu builds + LLUICtrl::EnableCallbackRegistry::Registrar& global_enable = LLUICtrl::EnableCallbackRegistry::defaultRegistrar(); + LLUICtrl::CommitCallbackRegistry::Registrar& global_commit = LLUICtrl::CommitCallbackRegistry::defaultRegistrar(); + global_commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying)); + global_enable.add("Agent.enableFlyLand", boost::bind(&enable_fly_land)); + global_commit.add("Agent.PressMicrophone", boost::bind(&LLAgent::pressMicrophone, _2)); + global_commit.add("Agent.ReleaseMicrophone", boost::bind(&LLAgent::releaseMicrophone, _2)); + global_commit.add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2)); + global_enable.add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2)); + global_enable.add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2)); + global_enable.add("Avatar.IsMyProfileOpen", boost::bind(&LLAvatarActions::myProfileVisible)); + global_enable.add("Avatar.IsPicksTabOpen", boost::bind(&LLAvatarActions::myPicksTabVisible)); +} + void initialize_edit_menu() { view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo"); @@ -10014,6 +10148,8 @@ void initialize_menus() bool mMult; }; + register_agent_ui_callbacks(); + LLUICtrl::EnableCallbackRegistry::Registrar& enable = LLUICtrl::EnableCallbackRegistry::currentRegistrar(); LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar(); @@ -10029,15 +10165,6 @@ void initialize_menus() enable.add("Conversation.IsConversationLoggingAllowed", boost::bind(&LLFloaterIMContainer::isConversationLoggingAllowed)); - // Agent - commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying)); - enable.add("Agent.enableFlyLand", boost::bind(&enable_fly_land)); - commit.add("Agent.PressMicrophone", boost::bind(&LLAgent::pressMicrophone, _2)); - commit.add("Agent.ReleaseMicrophone", boost::bind(&LLAgent::releaseMicrophone, _2)); - commit.add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2)); - enable.add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2)); - enable.add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2)); - // File menu init_menu_file(); @@ -10110,6 +10237,8 @@ void initialize_menus() view_listener_t::addMenu(new LLWorldEnableEnvPreset(), "World.EnableEnvPreset"); view_listener_t::addMenu(new LLWorldCheckBanLines() , "World.CheckBanLines"); view_listener_t::addMenu(new LLWorldShowBanLines() , "World.ShowBanLines"); + commit.add("World.ToggleMasterAudio", boost::bind(&toggle_master_audio)); + enable.add("World.IsMasterAudioMuted", boost::bind(&is_master_audio_muted)); // Tools menu view_listener_t::addMenu(new LLToolsSelectTool(), "Tools.SelectTool"); @@ -10126,7 +10255,7 @@ void initialize_menus() view_listener_t::addMenu(new LLToolsUseSelectionForGrid(), "Tools.UseSelectionForGrid"); view_listener_t::addMenu(new LLToolsSelectNextPartFace(), "Tools.SelectNextPart"); commit.add("Tools.Link", boost::bind(&handle_link_objects)); - commit.add("Tools.Unlink", boost::bind(&LLSelectMgr::unlinkObjects, LLSelectMgr::getInstance())); + commit.add("Tools.Unlink", boost::bind(&handle_unlink_objects)); view_listener_t::addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations"); view_listener_t::addMenu(new LLToolsReleaseKeys(), "Tools.ReleaseKeys"); view_listener_t::addMenu(new LLToolsEnableReleaseKeys(), "Tools.EnableReleaseKeys"); @@ -10153,10 +10282,9 @@ void initialize_menus() view_listener_t::addMenu(new LLToolsEnablePathfindingRebakeRegion(), "Tools.EnablePathfindingRebakeRegion"); view_listener_t::addMenu(new LLToolsCheckSelectionLODMode(), "Tools.ToolsCheckSelectionLODMode"); - // Help menu - // most items use the ShowFloater method - view_listener_t::addMenu(new LLToggleHowTo(), "Help.ToggleHowTo"); - + view_listener_t::addMenu(new LLToolsCheckScriptEditorServer(), "Tools.CheckScriptEditorServer"); + view_listener_t::addMenu(new LLToolsEnableScriptEditorServer(), "Tools.EnableScriptEditorServer"); + view_listener_t::addMenu(new LLToolsToggleScriptEditorServer(), "Tools.ToggleScriptEditorServer"); // Advanced menu view_listener_t::addMenu(new LLAdvancedToggleConsole(), "Advanced.ToggleConsole"); view_listener_t::addMenu(new LLAdvancedCheckConsole(), "Advanced.CheckConsole"); @@ -10414,8 +10542,6 @@ void initialize_menus() view_listener_t::addMenu(new LLAvatarResetSkeletonAndAnimations(), "Avatar.ResetSkeletonAndAnimations"); view_listener_t::addMenu(new LLAvatarResetSelfSkeleton(), "Avatar.ResetSelfSkeleton"); view_listener_t::addMenu(new LLAvatarResetSelfSkeletonAndAnimations(), "Avatar.ResetSelfSkeletonAndAnimations"); - enable.add("Avatar.IsMyProfileOpen", boost::bind(&my_profile_visible)); - enable.add("Avatar.IsPicksTabOpen", boost::bind(&picks_tab_visible)); commit.add("Avatar.OpenMarketplace", boost::bind(&LLWeb::loadURLExternal, gSavedSettings.getString("MarketplaceURL"))); @@ -10537,5 +10663,6 @@ void initialize_menus() view_listener_t::addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD"); view_listener_t::addMenu(new LLEditableSelected(), "EditableSelected"); view_listener_t::addMenu(new LLEditableSelectedMono(), "EditableSelectedMono"); + view_listener_t::addMenu(new LLEditableSelectedLua(), "EditableSelectedLua"); view_listener_t::addMenu(new LLToggleUIHints(), "ToggleUIHints"); } |
