From f842aeac30c1b3abad76201d5c5f9318fd0c960e Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Wed, 17 Aug 2022 10:29:33 -0700 Subject: SL-17699 Add upport for materials to texture picker. A work in progress but I am about to make some larger changes to inventory code so I wanted to secure this first --- indra/newview/lltexturectrl.cpp | 43 ++++++++++++++++++++-- indra/newview/lltexturectrl.h | 3 ++ .../skins/default/xui/en/floater_texture_ctrl.xml | 30 +++++++++++++-- 3 files changed, 69 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index e8ff14daac..a0d4667827 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -417,8 +417,12 @@ BOOL LLFloaterTexturePicker::postBuild() childSetCommitCallback("show_folders_check", onShowFolders, this); getChildView("show_folders_check")->setVisible( FALSE); - mFilterEdit = getChild("inventory search editor"); - mFilterEdit->setCommitCallback(boost::bind(&LLFloaterTexturePicker::onFilterEdit, this, _2)); + mFilterEdit = getChild("inventory search editor"); + mFilterEdit->setCommitCallback(boost::bind(&LLFloaterTexturePicker::onFilterEdit, this, _2)); + + mTextureMaterialsCombo = getChild("textures_material_combo"); + mTextureMaterialsCombo->setCommitCallback(onSelectTextureMaterials, this); + mTextureMaterialsCombo->selectByValue(0); mInventoryPanel = getChild("inventory panel"); @@ -430,7 +434,7 @@ BOOL LLFloaterTexturePicker::postBuild() { U32 filter_types = 0x0; filter_types |= 0x1 << LLInventoryType::IT_TEXTURE; - filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT; + filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT; mInventoryPanel->setFilterTypes(filter_types); //mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss. @@ -817,6 +821,7 @@ void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata) self->getChild("Blank")->setVisible(index == 0 ? TRUE : FALSE); self->getChild("None")->setVisible(index == 0 ? TRUE : FALSE); self->getChild("Pipette")->setVisible(index == 0 ? TRUE : FALSE); + self->getChild("textures_material_combo")->setVisible(index == 0 ? TRUE : FALSE); self->getChild("inventory search editor")->setVisible(index == 0 ? TRUE : FALSE); self->getChild("inventory panel")->setVisible(index == 0 ? TRUE : FALSE); @@ -1136,6 +1141,38 @@ void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string ) mInventoryPanel->setFilterSubString(search_string); } +void LLFloaterTexturePicker::onSelectTextureMaterials(LLUICtrl* ctrl, void *userdata) +{ + LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)userdata; + int index = self->mTextureMaterialsCombo->getValue().asInteger(); + + // IMPORTANT: make sure these match the entries in floater_texture_ctrl.xml + // for the textures_material_combo combo box + const int textures_and_materials = 0; + const int textures_only = 1; + const int materials_only = 2; + + U32 filter_types = 0x0; + + if (index == textures_and_materials) + { + filter_types |= 0x1 << LLInventoryType::IT_TEXTURE; + filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT; + filter_types |= 0x1 << LLInventoryType::IT_MATERIAL; + } + else if (index == textures_only) + { + filter_types |= 0x1 << LLInventoryType::IT_TEXTURE; + filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT; + } + else if (index == materials_only) + { + filter_types |= 0x1 << LLInventoryType::IT_MATERIAL; + } + + self->mInventoryPanel->setFilterTypes(filter_types); +} + void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled) { mModeSelector->setEnabledByValue(1, enabled); diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index a234124c08..cfd5c4bd29 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -340,6 +340,8 @@ public: static void onBakeTextureSelect(LLUICtrl* ctrl, void *userdata); static void onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *userdata); + static void onSelectTextureMaterials(LLUICtrl* ctrl, void *userdata); + void setLocalTextureEnabled(BOOL enabled); void setBakeTextureEnabled(BOOL enabled); @@ -365,6 +367,7 @@ protected: BOOL mActive; LLFilterEditor* mFilterEdit; + LLComboBox* mTextureMaterialsCombo; LLInventoryPanel* mInventoryPanel; PermissionMask mImmediateFilterPermMask; PermissionMask mDnDFilterPermMask; diff --git a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml index 3a66911389..7d23034a09 100644 --- a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml +++ b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml @@ -137,7 +137,29 @@ value="Preview Disabled" word_wrap="true" visible="false" - width="87" /> + width="87" /> + + + + + -