From db3af67aeb9cd6a3c39f5fc101c7243ccbf0f218 Mon Sep 17 00:00:00 2001
From: cinder <cinder@cinderblocks.biz>
Date: Fri, 18 Nov 2022 10:57:50 -0600
Subject: [PATCH] Fix enabling RestoreToWorld

---
 indra/newview/alviewermenu.cpp                |  9 +++++++--
 .../skins/default/xui/en/menu_inventory.xml   | 20 +++++++++----------
 .../skins/default/xui/en/menu_object.xml      | 12 +++--------
 3 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/indra/newview/alviewermenu.cpp b/indra/newview/alviewermenu.cpp
index 333af8e8bc8..23018b8f867 100644
--- a/indra/newview/alviewermenu.cpp
+++ b/indra/newview/alviewermenu.cpp
@@ -227,7 +227,11 @@ namespace
 		return true;
 	}
 
-	bool is_powerful_wizard()
+    bool is_powerful_wizard() {
+	    return gSavedSettings.getBOOL("AlchemyPowerfulWizard");
+    }
+
+	bool is_powerful_wizard_object()
 	{
 		LLViewerObject* objpos = LLSelectMgr::getInstanceFast()->getSelection()->getFirstRootObject();
 		if (objpos)
@@ -324,7 +328,8 @@ namespace
 void ALViewerMenu::initialize_menus()
 {
 	LLUICtrl::EnableCallbackRegistry::Registrar& enable = LLUICtrl::EnableCallbackRegistry::currentRegistrar();
-	enable.add("Alchemy.PowerfulWizard", [](LLUICtrl* ctrl, const LLSD& param) { return is_powerful_wizard(); });
+    enable.add("Alchemy.PowerfulWizard", [](LLUICtrl* ctrl, const LLSD& param) { return is_powerful_wizard(); });
+	enable.add("Alchemy.PowerfulWizardObject", [](LLUICtrl* ctrl, const LLSD& param) { return is_powerful_wizard_object(); });
 	enable.add("Avatar.EnableManageEstate", [](LLUICtrl* ctrl, const LLSD& param) { return can_manage_avatar_estate(); });
 	enable.add("Avatar.EnableTeleportTo", [](LLUICtrl* ctrl, const LLSD& param) { return can_teleport_to(); });
 	enable.add("Object.EnableEditParticles", [](LLUICtrl* ctrl, const LLSD& param) { return enable_edit_particle_source(); });
diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml
index d39e201c0c1..120ed761556 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory.xml
@@ -666,6 +666,16 @@
     <menu_item_separator
      layout="topleft" 
      name="Paste Separator" />
+    <menu_item_call
+     label="Restore to Last Position"
+     layout="topleft"
+     name="Restore to Last Position">
+    <menu_item_call.on_click
+     function="Inventory.DoToSelected"
+     parameter="restoreToWorld" />
+    <menu_item_call.on_enable
+     function="Alchemy.PowerfulWizard" />
+	</menu_item_call>
     <menu_item_call
      label="Delete"
      layout="topleft"
@@ -827,16 +837,6 @@
      layout="topleft" 
      name="Wearable And Object Separator"/>
 	<menu_item_call
-     label="Restore to Last Position"
-     layout="topleft"
-     name="Restore to Last Position">
-        <menu_item_call.on_click
-         function="Inventory.DoToSelected"
-         parameter="restoreToWorld" />
-        <menu_item_call.on_enable
-         function="Alchemy.PowerfulWizard" />
-    </menu_item_call>
-    <menu_item_call
      label="Wear"
      layout="topleft"
      name="Wearable And Object Wear">
diff --git a/indra/newview/skins/default/xui/en/menu_object.xml b/indra/newview/skins/default/xui/en/menu_object.xml
index c791acca18c..1530a59caaf 100644
--- a/indra/newview/skins/default/xui/en/menu_object.xml
+++ b/indra/newview/skins/default/xui/en/menu_object.xml
@@ -102,9 +102,7 @@
 		  <menu_item_call.on_click
 			  function="Object.AlchemyExplode" />
 		  <menu_item_call.on_enable
-			  function="Alchemy.PowerfulWizard" />
-		  <menu_item_call.on_visible
-			  function="Alchemy.PowerfulWizard" />
+			  function="Alchemy.PowerfulWizardObject" />
 	  </menu_item_call>
 	  <menu_item_call
 		  label="Destroy"
@@ -112,9 +110,7 @@
 		  <menu_item_call.on_click
 			  function="Object.AlchemyDestroy" />
 		  <menu_item_call.on_enable
-			  function="Alchemy.PowerfulWizard" />
-		  <menu_item_call.on_visible
-			  function="Alchemy.PowerfulWizard" />
+			  function="Alchemy.PowerfulWizardObject" />
 	  </menu_item_call>
 	  <menu_item_call
 		  label="Force Delete"
@@ -122,9 +118,7 @@
 		  <menu_item_call.on_click
 			  function="Object.AlchemyForceDelete" />
 		  <menu_item_call.on_enable
-			  function="Alchemy.PowerfulWizard" />
-		  <menu_item_call.on_visible
-			  function="Alchemy.PowerfulWizard" />
+			  function="Alchemy.PowerfulWizardObject" />
 	  </menu_item_call>
   </context_menu>
   <menu_item_call
-- 
GitLab