From 0a60b2eb83404687f06a9d155b756c33e9e62199 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Wed, 23 Mar 2022 12:48:38 -0400
Subject: [PATCH] Add simfeature debug view

---
 indra/newview/alviewermenu.cpp                 | 18 ++++++++++++++++++
 .../skins/default/xui/en/menu_viewer.xml       |  6 ++++++
 2 files changed, 24 insertions(+)

diff --git a/indra/newview/alviewermenu.cpp b/indra/newview/alviewermenu.cpp
index a2a2f1ac57c..333af8e8bc8 100644
--- a/indra/newview/alviewermenu.cpp
+++ b/indra/newview/alviewermenu.cpp
@@ -23,6 +23,8 @@
 // library
 #include "llclipboard.h"
 #include "llfloaterreg.h"
+#include "llsdserialize.h"
+#include "lltrans.h"
 #include "llview.h"
 
 // newview
@@ -301,6 +303,20 @@ namespace
 
 		}
 	}
+
+	void spawn_debug_simfeatures()
+	{
+		if (LLViewerRegion* regionp = gAgent.getRegion())
+		{
+			LLSD sim_features, args;
+			std::stringstream features_str;
+			regionp->getSimulatorFeatures(sim_features);
+			LLSDSerialize::toPrettyXML(sim_features, features_str);
+			args["title"] = llformat("%s - %s", LLTrans::getString("SimulatorFeaturesTitle").c_str(), regionp->getName().c_str());
+			args["data"] = features_str.str();
+			LLFloaterReg::showInstance("generic_text", args);
+		}
+	}
 }
 
 ////////////////////////////////////////////////////////
@@ -318,6 +334,8 @@ void ALViewerMenu::initialize_menus()
 	commit.add("Avatar.ManageEstate", [](LLUICtrl* ctrl, const LLSD& param) { manage_estate(param); });
 	commit.add("Avatar.TeleportTo", [](LLUICtrl* ctrl, const LLSD& param) { teleport_to(); });
 
+	commit.add("Advanced.DebugSimFeatures", [](LLUICtrl* ctrl, const LLSD& param) { spawn_debug_simfeatures(); });
+
 	commit.add("Object.CopyID", [](LLUICtrl* ctrl, const LLSD& param) { object_copy_key(); });
 	commit.add("Object.EditParticles",	[](LLUICtrl* ctrl, const LLSD& param) { edit_particle_source(); });
 	commit.add("Object.AlchemyExplode", [](LLUICtrl* ctrl, const LLSD& param) { object_explode(); });
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 8f5a5a364bd..968305c60f1 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2838,6 +2838,12 @@ function="World.EnvPreset"
                  function="Advanced.DumpInfoToConsole"
                  parameter="capabilities" />
             </menu_item_call>
+            <menu_item_call
+             label="View Simulator Features"
+             name="View Simulator Features">
+                <menu_item_call.on_click
+                 function="Advanced.DebugSimFeatures" />
+            </menu_item_call>
 
             <menu_item_separator/>
 
-- 
GitLab