From 33116b8adac6eec07c5badc08d7d66ca1283686a Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Fri, 24 Jun 2022 14:09:25 +0300
Subject: SL-17650 Add Material as a filter option to Inventory filter floater

---
 indra/newview/llinventoryfilter.cpp                | 12 ++++++
 indra/newview/llpanelmaininventory.cpp             |  9 +++++
 .../xui/en/floater_inventory_view_finder.xml       | 43 +++++++++++++++-------
 indra/newview/skins/default/xui/en/strings.xml     |  1 +
 4 files changed, 52 insertions(+), 13 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 707ff2b7b6..f7dc493109 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -1306,6 +1306,18 @@ const std::string& LLInventoryFilter::getFilterText()
 		filtered_by_all_types = FALSE;
 	}
 
+	if (isFilterObjectTypesWith(LLInventoryType::IT_MATERIAL))
+	{
+		filtered_types +=  LLTrans::getString("Materials");
+		filtered_by_type = TRUE;
+		num_filter_types++;
+	}
+	else
+	{
+		not_filtered_types +=  LLTrans::getString("Materials");
+		filtered_by_all_types = FALSE;
+	}
+
 	if (isFilterObjectTypesWith(LLInventoryType::IT_NOTECARD))
 	{
 		filtered_types +=  LLTrans::getString("Notecards");
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 89256b40c4..49562da3f7 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -919,6 +919,7 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
 	getChild<LLUICtrl>("check_clothing")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_WEARABLE));
 	getChild<LLUICtrl>("check_gesture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_GESTURE));
 	getChild<LLUICtrl>("check_landmark")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LANDMARK));
+	getChild<LLUICtrl>("check_material")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_MATERIAL));
 	getChild<LLUICtrl>("check_notecard")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_NOTECARD));
 	getChild<LLUICtrl>("check_object")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_OBJECT));
 	getChild<LLUICtrl>("check_script")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LSL));
@@ -975,6 +976,12 @@ void LLFloaterInventoryFinder::draw()
 		filtered_by_all_types = FALSE;
 	}
 
+	if (!getChild<LLUICtrl>("check_material")->getValue())
+	{
+		filter &= ~(0x1 << LLInventoryType::IT_MATERIAL);
+		filtered_by_all_types = FALSE;
+	}
+
 	if (!getChild<LLUICtrl>("check_notecard")->getValue())
 	{
 		filter &= ~(0x1 << LLInventoryType::IT_NOTECARD);
@@ -1129,6 +1136,7 @@ void LLFloaterInventoryFinder::selectAllTypes(void* user_data)
 	self->getChild<LLUICtrl>("check_clothing")->setValue(TRUE);
 	self->getChild<LLUICtrl>("check_gesture")->setValue(TRUE);
 	self->getChild<LLUICtrl>("check_landmark")->setValue(TRUE);
+	self->getChild<LLUICtrl>("check_material")->setValue(TRUE);
 	self->getChild<LLUICtrl>("check_notecard")->setValue(TRUE);
 	self->getChild<LLUICtrl>("check_object")->setValue(TRUE);
 	self->getChild<LLUICtrl>("check_script")->setValue(TRUE);
@@ -1149,6 +1157,7 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data)
 	self->getChild<LLUICtrl>("check_clothing")->setValue(FALSE);
 	self->getChild<LLUICtrl>("check_gesture")->setValue(FALSE);
 	self->getChild<LLUICtrl>("check_landmark")->setValue(FALSE);
+	self->getChild<LLUICtrl>("check_material")->setValue(FALSE);
 	self->getChild<LLUICtrl>("check_notecard")->setValue(FALSE);
 	self->getChild<LLUICtrl>("check_object")->setValue(FALSE);
 	self->getChild<LLUICtrl>("check_script")->setValue(FALSE);
diff --git a/indra/newview/skins/default/xui/en/floater_inventory_view_finder.xml b/indra/newview/skins/default/xui/en/floater_inventory_view_finder.xml
index d783d1e23c..e91efb89b2 100644
--- a/indra/newview/skins/default/xui/en/floater_inventory_view_finder.xml
+++ b/indra/newview/skins/default/xui/en/floater_inventory_view_finder.xml
@@ -2,7 +2,7 @@
 <floater
  legacy_header_height="18"
  can_minimize="false"
- height="466"
+ height="486"
  layout="topleft"
  name="Inventory Finder"
  help_topic="inventory_finder"
@@ -93,6 +93,23 @@
      name="check_landmark"
      top_delta="0"
      width="126" />
+    <icon
+     height="16"
+     image_name="Inv_Material"
+     layout="topleft"
+     left="8"
+     mouse_opaque="true"
+     name="icon_material"
+     top="122"
+     width="16" />
+    <check_box
+     height="16"
+     label="Materials"
+     layout="topleft"
+     left_pad="2"
+     name="check_material"
+     top_delta="0"
+     width="126" />
     <icon
      height="16"
      image_name="Inv_Notecard"
@@ -100,7 +117,7 @@
      left="8"
      mouse_opaque="true"
      name="icon_notecard"
-     top="122"
+     top="142"
      width="16" />
     <check_box
      height="16"
@@ -117,7 +134,7 @@
      left="8"
      mouse_opaque="true"
      name="icon_object"
-     top="142"
+     top="162"
      width="16" />
     <check_box
      height="16"
@@ -134,7 +151,7 @@
      left="8"
      mouse_opaque="true"
      name="icon_script"
-     top="162"
+     top="182"
      width="16" />
     <check_box
      height="16"
@@ -151,7 +168,7 @@
      left="8"
      mouse_opaque="true"
      name="icon_sound"
-     top="182"
+     top="202"
      width="16" />
     <check_box
      height="16"
@@ -168,7 +185,7 @@
      left="8"
      mouse_opaque="true"
      name="icon_texture"
-     top="202"
+     top="222"
      width="16" />
     <check_box
      height="16"
@@ -185,7 +202,7 @@
      left="8"
      mouse_opaque="true"
      name="icon_snapshot"
-     top="222"
+     top="242"
      width="16" />
     <check_box
      height="16"
@@ -202,7 +219,7 @@
      left="8"
      mouse_opaque="true"
      name="icon_settings"
-     top="242"
+     top="262"
      width="16" />
     <check_box
      height="16"
@@ -220,7 +237,7 @@
      layout="topleft"
      left="8"
      name="All"
-     top="262"
+     top="282"
      width="100" />
     <button
      height="20"
@@ -274,7 +291,7 @@
      width="260"/>
     <check_box
      height="16"
-     top="352"
+     top="372"
      label="Since Logoff"
      layout="topleft"
      left_delta="0"
@@ -290,7 +307,7 @@
      layout="topleft"
      left_delta="0"
      name="- OR -"
-     top="370"
+     top="390"
      width="144">
         - OR -
     </text>
@@ -298,7 +315,7 @@
      height="16"
      layout="topleft"
      name="date_search_direction"
-     top="388"
+     top="408"
      left="8"
      width="270">
      <radio_item
@@ -368,6 +385,6 @@
      layout="topleft"
      name="Close"
      right="-6"
-     top="434"
+     top="454"
      width="76" />
 </floater>
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 0866f29355..e1678f418f 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2414,6 +2414,7 @@ If you continue to receive this message, please contact Second Life support for
 	<string name="Clothing"      value=" Clothing," />
 	<string name="Gestures"      value=" Gestures," />
 	<string name="Landmarks"     value=" Landmarks," />
+	<string name="Materials"     value=" Materials," />
 	<string name="Notecards"     value=" Notecards," />
 	<string name="Objects"       value=" Objects," />
 	<string name="Scripts"       value=" Scripts," />
-- 
cgit v1.2.3