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 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') 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); -- cgit v1.2.3 From 694f6c11d11be695f1d95ec7478e1b9ca5811a0d Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Wed, 17 Aug 2022 12:21:01 -0700 Subject: SL-17699 Add upport for materials to texture picker. MAke sure the default (index 0) option is selected and update filters accordingly at startup --- indra/newview/lltexturectrl.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index a0d4667827..d9ecfbc81d 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -420,11 +420,13 @@ BOOL LLFloaterTexturePicker::postBuild() mFilterEdit = getChild("inventory search editor"); mFilterEdit->setCommitCallback(boost::bind(&LLFloaterTexturePicker::onFilterEdit, this, _2)); + mInventoryPanel = getChild("inventory panel"); + mTextureMaterialsCombo = getChild("textures_material_combo"); mTextureMaterialsCombo->setCommitCallback(onSelectTextureMaterials, this); - mTextureMaterialsCombo->selectByValue(0); - mInventoryPanel = getChild("inventory panel"); + // set the combo box to the first entry in the list (currently textures and materials) + mTextureMaterialsCombo->selectByValue(0); mModeSelector = getChild("mode_selection"); mModeSelector->setCommitCallback(onModeSelect, this); @@ -432,12 +434,12 @@ BOOL LLFloaterTexturePicker::postBuild() if(mInventoryPanel) { - U32 filter_types = 0x0; - filter_types |= 0x1 << LLInventoryType::IT_TEXTURE; - filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT; + // to avoid having to make an assumption about which option is + // selected at startup, we call the same function that is triggered + // when a texture/materials/both choice is made and let it take care + // of setting the filters + onSelectTextureMaterials(0, this); - mInventoryPanel->setFilterTypes(filter_types); - //mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss. mInventoryPanel->setFilterPermMask(mImmediateFilterPermMask); mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterTexturePicker::onSelectionChange, this, _1, _2)); mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); -- cgit v1.2.3 From 59884327e29133afad7bb87852c83691f175922d Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Fri, 19 Aug 2022 13:14:51 -0700 Subject: https://jira.secondlife.com/browse/SL-17699 Integrate GLTF materials with build floater texture tab: First pass - some edge cases remaining. User can now edit an object or set of objects, choose a material and have it apply as expected --- indra/newview/lltexturectrl.cpp | 71 +++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 10 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index d9ecfbc81d..1d3c61c21e 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1533,9 +1533,9 @@ void LLTextureCtrl::onFloaterClose() void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id) { - LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); - if( floaterp && getEnabled()) + if( floaterp && getEnabled()) { if (op == TEXTURE_CANCEL) mViewModel->resetDirty(); @@ -1556,15 +1556,64 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id) } else { - mImageItemID = floaterp->findItemID(floaterp->getAssetID(), FALSE); - LL_DEBUGS() << "mImageItemID: " << mImageItemID << LL_ENDL; - mImageAssetID = floaterp->getAssetID(); - LL_DEBUGS() << "mImageAssetID: " << mImageAssetID << LL_ENDL; + mImageItemID = floaterp->findItemID(floaterp->getAssetID(), FALSE); + LL_DEBUGS() << "mImageItemID: " << mImageItemID << LL_ENDL; + mImageAssetID = floaterp->getAssetID(); + LL_DEBUGS() << "mImageAssetID: " << mImageAssetID << LL_ENDL; } if (op == TEXTURE_SELECT && mOnSelectCallback) { - mOnSelectCallback( this, LLSD() ); + // determine if the selected item in inventory is a material + // by finding the item in inventory and inspecting its (IT_) type + LLUUID item_id = floaterp->findItemID(floaterp->getAssetID(), FALSE); + LLInventoryItem* item = gInventory.getItem(item_id); + if (item) + { + if (item->getInventoryType() == LLInventoryType::IT_MATERIAL) + { + // ask the selection manager for the list of selected objects + // to which the material will be applied. + LLObjectSelectionHandle selectedObjectsHandle = LLSelectMgr::getInstance()->getSelection(); + if (selectedObjectsHandle.notNull()) + { + LLObjectSelection* selectedObjects = selectedObjectsHandle.get(); + if (!selectedObjects->isEmpty()) + { + // we have a selection - iterate over it + for (LLObjectSelection::valid_iterator obj_iter = selectedObjects->valid_begin(); + obj_iter != selectedObjects->valid_end(); + ++obj_iter) + { + LLSelectNode* object = *obj_iter; + LLViewerObject* viewer_object = object->getObject(); + if (viewer_object) + { + // the asset ID of the material we want to apply + // the the selected objects + LLUUID asset_id = item->getAssetUUID(); + + // iterate over the faces in the object + // TODO: consider the case where user has + // selected only certain faces + S32 num_faces = viewer_object->getNumTEs(); + for (S32 face = 0; face < num_faces; face++) + { + viewer_object->setRenderMaterialID(face, asset_id); + dialog_refresh_all(); + } + viewer_object->sendTEUpdate(); + } + } + } + } + } + } + else + // original behavior for textures, not materials + { + mOnSelectCallback(this, LLSD()); + } } else if (op == TEXTURE_CANCEL && mOnCancelCallback) { @@ -1575,8 +1624,10 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id) // If the "no_commit_on_selection" parameter is set // we commit only when user presses OK in the picker // (i.e. op == TEXTURE_SELECT) or texture changes via DnD. - if (mCommitOnSelection || op == TEXTURE_SELECT) - onCommit(); + if (mCommitOnSelection || op == TEXTURE_SELECT) + { + onCommit(); + } } } } @@ -1709,7 +1760,7 @@ void LLTextureCtrl::draw() } else//mImageAssetID == LLUUID::null { - mTexturep = NULL; + mTexturep = NULL; } // Border -- cgit v1.2.3 From 0d217dc73c6530dcbceb306c4609e2d72da6d70b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 20 Aug 2022 01:04:42 +0300 Subject: SL-17653 Local gltf materials #2 --- indra/newview/lltexturectrl.cpp | 133 ++++++++++++++++++++++++++++++++++------ 1 file changed, 115 insertions(+), 18 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 1d3c61c21e..a9a8d84ab5 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -41,12 +41,15 @@ #include "llfolderviewmodel.h" #include "llinventory.h" #include "llinventoryfunctions.h" +#include "llinventoryicon.h" #include "llinventorymodelbackgroundfetch.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" #include "lllineeditor.h" +#include "llmaterialeditor.h" #include "llui.h" #include "llviewerinventory.h" +#include "llviewermenufile.h" // LLFilePickerReplyThread #include "llpermissions.h" #include "llsaleinfo.h" #include "llassetstorage.h" @@ -69,12 +72,14 @@ #include "llradiogroup.h" #include "llfloaterreg.h" #include "lllocalbitmaps.h" +#include "lllocalgltfmaterials.h" #include "llerror.h" #include "llavatarappearancedefines.h" -static const S32 LOCAL_TRACKING_ID_COLUMN = 1; +static const S32 LOCAL_ICON_ID_COLUMN = 0; +static const S32 LOCAL_TRACKING_ID_COLUMN = 2; //static const char CURRENT_IMAGE_NAME[] = "Current Texture"; //static const char WHITE_IMAGE_NAME[] = "Blank Texture"; @@ -472,7 +477,9 @@ BOOL LLFloaterTexturePicker::postBuild() mLocalScrollCtrl = getChild("l_name_list"); mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit, this); + mLocalScrollCtrl->clearRows(); LLLocalBitmapMgr::getInstance()->feedScrollList(mLocalScrollCtrl); + LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(mLocalScrollCtrl); mNoCopyTextureSelected = FALSE; @@ -749,8 +756,21 @@ void LLFloaterTexturePicker::onBtnSelect(void* userdata) { if (self->mLocalScrollCtrl->getVisible() && !self->mLocalScrollCtrl->getAllSelected().empty()) { + std::string icon_name = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_ICON_ID_COLUMN)->getValue().asString(); LLUUID temp_id = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID(); - local_id = LLLocalBitmapMgr::getInstance()->getWorldID(temp_id); + + std::string mat_icon_name = LLInventoryIcon::getIconName( + LLAssetType::AT_MATERIAL, + LLInventoryType::IT_NONE); + + if (mat_icon_name == icon_name) + { + local_id = LLLocalGLTFMaterialMgr::getInstance()->getWorldID(temp_id); + } + else + { + local_id = LLLocalBitmapMgr::getInstance()->getWorldID(temp_id); + } } } @@ -898,11 +918,9 @@ void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata) // static void LLFloaterTexturePicker::onBtnAdd(void* userdata) { - if (LLLocalBitmapMgr::getInstance()->addUnit() == true) - { - LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; - LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl); - } + LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)userdata; + + LLFilePickerReplyThread::startPicker(boost::bind(&onPickerCallback, _1, self->getHandle()), LLFilePicker::FFLOAD_ALL, true); } // static @@ -913,22 +931,37 @@ void LLFloaterTexturePicker::onBtnRemove(void* userdata) if (!selected_items.empty()) { + std::string mat_icon_name = LLInventoryIcon::getIconName( + LLAssetType::AT_MATERIAL, + LLInventoryType::IT_NONE); + for(std::vector::iterator iter = selected_items.begin(); iter != selected_items.end(); iter++) { LLScrollListItem* list_item = *iter; if (list_item) { - LLUUID tracking_id = list_item->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID(); - LLLocalBitmapMgr::getInstance()->delUnit(tracking_id); + std::string icon_name = list_item->getColumn(LOCAL_ICON_ID_COLUMN)->getValue().asString(); + LLUUID tracking_id = list_item->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID(); + + // todo: works, but need a better way to distinguish material from texture + if (icon_name == mat_icon_name) + { + LLLocalGLTFMaterialMgr::getInstance()->delUnit(tracking_id); + } + else + { + LLLocalBitmapMgr::getInstance()->delUnit(tracking_id); + } } } self->getChild("l_rem_btn")->setEnabled(false); self->getChild("l_upl_btn")->setEnabled(false); + self->mLocalScrollCtrl->clearRows(); LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl); + LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl); } - } // static @@ -944,15 +977,34 @@ void LLFloaterTexturePicker::onBtnUpload(void* userdata) /* currently only allows uploading one by one, picks the first item from the selection list. (not the vector!) in the future, it might be a good idea to check the vector size and if more than one units is selected - opt for multi-image upload. */ - + + std::string icon_name = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_ICON_ID_COLUMN)->getValue().asString(); LLUUID tracking_id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel(LOCAL_TRACKING_ID_COLUMN); - std::string filename = LLLocalBitmapMgr::getInstance()->getFilename(tracking_id); - if (!filename.empty()) - { - LLFloaterReg::showInstance("upload_image", LLSD(filename)); - } + std::string mat_icon_name = LLInventoryIcon::getIconName( + LLAssetType::AT_MATERIAL, + LLInventoryType::IT_NONE); + if (mat_icon_name == icon_name) + { + std::string filename = LLLocalGLTFMaterialMgr::getInstance()->getFilename(tracking_id); + if (!filename.empty()) + { + LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); + if (me) + { + me->loadMaterialFromFile(filename); + } + } + } + else + { + std::string filename = LLLocalBitmapMgr::getInstance()->getFilename(tracking_id); + if (!filename.empty()) + { + LLFloaterReg::showInstance("upload_image", LLSD(filename)); + } + } } //static @@ -968,8 +1020,23 @@ void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl* ctrl, void* userdata) if (has_selection) { - LLUUID tracking_id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel(LOCAL_TRACKING_ID_COLUMN); - LLUUID inworld_id = LLLocalBitmapMgr::getInstance()->getWorldID(tracking_id); + std::string icon_name = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_ICON_ID_COLUMN)->getValue().asString(); + LLUUID tracking_id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel(LOCAL_TRACKING_ID_COLUMN); + LLUUID inworld_id; + + std::string mat_icon_name = LLInventoryIcon::getIconName( + LLAssetType::AT_MATERIAL, + LLInventoryType::IT_NONE); + + if (icon_name == mat_icon_name) + { + inworld_id = LLLocalGLTFMaterialMgr::getInstance()->getWorldID(tracking_id); + } + else + { + inworld_id = LLLocalBitmapMgr::getInstance()->getWorldID(tracking_id); + } + if (self->mSetImageAssetIDCallback) { self->mSetImageAssetIDCallback(inworld_id); @@ -1202,6 +1269,36 @@ void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled) onModeSelect(0, this); } +void LLFloaterTexturePicker::onPickerCallback(const std::vector& filenames, LLHandle handle) +{ + std::vector::const_iterator iter = filenames.begin(); + while (iter != filenames.end()) + { + if (!iter->empty()) + { + std::string temp_exten = gDirUtilp->getExtension(*iter); + if (temp_exten == "gltf" || temp_exten == "glb") + { + LLLocalGLTFMaterialMgr::getInstance()->addUnit(*iter); + } + else + { + LLLocalBitmapMgr::getInstance()->addUnit(*iter); + } + } + iter++; + } + + // Todo: this should referesh all pickers, not just a current one + if (!handle.isDead()) + { + LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)handle.get(); + self->mLocalScrollCtrl->clearRows(); + LLLocalBitmapMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl); + LLLocalGLTFMaterialMgr::getInstance()->feedScrollList(self->mLocalScrollCtrl); + } +} + void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te ) { LLUUID inventory_item_id = findItemID(te.getID(), TRUE); -- cgit v1.2.3 From 8a91c1394745a28cb78e7432eaa481b6cedd7408 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 22 Aug 2022 22:11:58 +0300 Subject: SL-17653 Local gltf materials #3 --- indra/newview/lltexturectrl.cpp | 53 +++++++++++++---------------------------- 1 file changed, 16 insertions(+), 37 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index a9a8d84ab5..2757f54ea9 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -78,15 +78,6 @@ #include "llavatarappearancedefines.h" -static const S32 LOCAL_ICON_ID_COLUMN = 0; -static const S32 LOCAL_TRACKING_ID_COLUMN = 2; - -//static const char CURRENT_IMAGE_NAME[] = "Current Texture"; -//static const char WHITE_IMAGE_NAME[] = "Blank Texture"; -//static const char NO_IMAGE_NAME[] = "None"; - - - //static bool get_is_predefined_texture(LLUUID asset_id) { @@ -756,14 +747,11 @@ void LLFloaterTexturePicker::onBtnSelect(void* userdata) { if (self->mLocalScrollCtrl->getVisible() && !self->mLocalScrollCtrl->getAllSelected().empty()) { - std::string icon_name = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_ICON_ID_COLUMN)->getValue().asString(); - LLUUID temp_id = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID(); + LLSD data = self->mLocalScrollCtrl->getFirstSelected()->getValue(); + LLUUID temp_id = data["id"]; + S32 asset_type = data["type"].asInteger(); - std::string mat_icon_name = LLInventoryIcon::getIconName( - LLAssetType::AT_MATERIAL, - LLInventoryType::IT_NONE); - - if (mat_icon_name == icon_name) + if (LLAssetType::AT_MATERIAL == asset_type) { local_id = LLLocalGLTFMaterialMgr::getInstance()->getWorldID(temp_id); } @@ -931,9 +919,6 @@ void LLFloaterTexturePicker::onBtnRemove(void* userdata) if (!selected_items.empty()) { - std::string mat_icon_name = LLInventoryIcon::getIconName( - LLAssetType::AT_MATERIAL, - LLInventoryType::IT_NONE); for(std::vector::iterator iter = selected_items.begin(); iter != selected_items.end(); iter++) @@ -941,11 +926,11 @@ void LLFloaterTexturePicker::onBtnRemove(void* userdata) LLScrollListItem* list_item = *iter; if (list_item) { - std::string icon_name = list_item->getColumn(LOCAL_ICON_ID_COLUMN)->getValue().asString(); - LLUUID tracking_id = list_item->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID(); + LLSD data = self->mLocalScrollCtrl->getFirstSelected()->getValue(); + LLUUID tracking_id = data["id"]; + S32 asset_type = data["type"].asInteger(); - // todo: works, but need a better way to distinguish material from texture - if (icon_name == mat_icon_name) + if (LLAssetType::AT_MATERIAL == asset_type) { LLLocalGLTFMaterialMgr::getInstance()->delUnit(tracking_id); } @@ -978,14 +963,11 @@ void LLFloaterTexturePicker::onBtnUpload(void* userdata) /* currently only allows uploading one by one, picks the first item from the selection list. (not the vector!) in the future, it might be a good idea to check the vector size and if more than one units is selected - opt for multi-image upload. */ - std::string icon_name = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_ICON_ID_COLUMN)->getValue().asString(); - LLUUID tracking_id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel(LOCAL_TRACKING_ID_COLUMN); - - std::string mat_icon_name = LLInventoryIcon::getIconName( - LLAssetType::AT_MATERIAL, - LLInventoryType::IT_NONE); + LLSD data = self->mLocalScrollCtrl->getFirstSelected()->getValue(); + LLUUID tracking_id = data["id"]; + S32 asset_type = data["type"].asInteger(); - if (mat_icon_name == icon_name) + if (LLAssetType::AT_MATERIAL == asset_type) { std::string filename = LLLocalGLTFMaterialMgr::getInstance()->getFilename(tracking_id); if (!filename.empty()) @@ -1020,15 +1002,12 @@ void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl* ctrl, void* userdata) if (has_selection) { - std::string icon_name = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_ICON_ID_COLUMN)->getValue().asString(); - LLUUID tracking_id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel(LOCAL_TRACKING_ID_COLUMN); + LLSD data = self->mLocalScrollCtrl->getFirstSelected()->getValue(); + LLUUID tracking_id = data["id"]; + S32 asset_type = data["type"].asInteger(); LLUUID inworld_id; - std::string mat_icon_name = LLInventoryIcon::getIconName( - LLAssetType::AT_MATERIAL, - LLInventoryType::IT_NONE); - - if (icon_name == mat_icon_name) + if (LLAssetType::AT_MATERIAL == asset_type) { inworld_id = LLLocalGLTFMaterialMgr::getInstance()->getWorldID(tracking_id); } -- cgit v1.2.3