From 4f9f7de33b1a589b37a36acee1b009832d429a90 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 24 Aug 2022 19:35:18 +0300 Subject: SL-17653 File filter for local materials and textures in texture picker --- indra/newview/llfilepicker.cpp | 7 +++++++ indra/newview/llfilepicker.h | 3 ++- indra/newview/lltexturectrl.cpp | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 3c5ac963f6..1dd9a43b72 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -61,6 +61,7 @@ LLFilePicker LLFilePicker::sInstance; #define RAW_FILTER L"RAW files (*.raw)\0*.raw\0" #define MODEL_FILTER L"Model files (*.dae)\0*.dae\0" #define MATERIAL_FILTER L"GLTF Files (*.gltf; *.glb)\0*.gltf;*.glb\0" +#define MATERIAL_TEXTURES_FILTER L"GLTF Import (*.gltf; *.glb; *.tga; *.bmp; *.jpg; *.jpeg; *.png)\0*.gltf;*.glb;*.tga;*.bmp;*.jpg;*.jpeg;*.png\0" #define SCRIPT_FILTER L"Script files (*.lsl)\0*.lsl\0" #define DICTIONARY_FILTER L"Dictionary files (*.dic; *.xcu)\0*.dic;*.xcu\0" #endif @@ -220,6 +221,12 @@ BOOL LLFilePicker::setupFilter(ELoadFilter filter) mOFN.lpstrFilter = MATERIAL_FILTER \ L"\0"; break; + case FFLOAD_MATERIAL_TEXTURE: + mOFN.lpstrFilter = MATERIAL_TEXTURES_FILTER \ + MATERIAL_FILTER \ + IMAGE_FILTER \ + L"\0"; + break; case FFLOAD_SCRIPT: mOFN.lpstrFilter = SCRIPT_FILTER \ L"\0"; diff --git a/indra/newview/llfilepicker.h b/indra/newview/llfilepicker.h index cb57c8437d..a03f3f6711 100644 --- a/indra/newview/llfilepicker.h +++ b/indra/newview/llfilepicker.h @@ -87,7 +87,8 @@ public: FFLOAD_DICTIONARY = 12, FFLOAD_DIRECTORY = 13, // To call from lldirpicker. FFLOAD_EXE = 14, // Note: EXE will be treated as ALL on Windows and Linux but not on Darwin - FFLOAD_MATERIAL = 15 + FFLOAD_MATERIAL = 15, + FFLOAD_MATERIAL_TEXTURE = 16, }; enum ESaveFilter diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 2757f54ea9..2c7cb6a2c3 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -908,7 +908,11 @@ void LLFloaterTexturePicker::onBtnAdd(void* userdata) { LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)userdata; - LLFilePickerReplyThread::startPicker(boost::bind(&onPickerCallback, _1, self->getHandle()), LLFilePicker::FFLOAD_ALL, true); + // todo: there will be changes to texture picker to forbid + // selection of materials in some cases, like landmarks, once + // it gets implemented, update code to select FLOAD_* filter + // based on picker's material/texture mode. + LLFilePickerReplyThread::startPicker(boost::bind(&onPickerCallback, _1, self->getHandle()), LLFilePicker::FFLOAD_MATERIAL_TEXTURE, true); } // static -- cgit v1.2.3