summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturectrl.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2023-10-08 21:07:07 +0800
committerErik Kundiman <erik@megapahit.org>2023-10-08 21:07:07 +0800
commitf88c30e4eef6353564e4c19f2829ef3713a8a973 (patch)
tree4b88df999b52d3c888f3512b047d9482beeb1693 /indra/newview/lltexturectrl.cpp
parent1c51cc63ffb8d93a0cdacef7cb2966d245d843de (diff)
parenteab9396579842ae0202bfa3318ffc527e7ee6d1a (diff)
Merge remote-tracking branch 'secondlife/DRTVWR-559' into DRTVWR-559
Diffstat (limited to 'indra/newview/lltexturectrl.cpp')
-rw-r--r--indra/newview/lltexturectrl.cpp52
1 files changed, 45 insertions, 7 deletions
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 8a8abc222f..4e5dcf5fca 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -213,15 +213,38 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti
mModeSelector->selectByValue(0);
onModeSelect(0,this);
}
-
- LLUUID item_id = findItemID(mImageAssetID, FALSE);
+
+ LLUUID item_id;
+ LLFolderView* root_folder = mInventoryPanel->getRootFolder();
+ if (root_folder && root_folder->getCurSelectedItem())
+ {
+ LLFolderViewItem* last_selected = root_folder->getCurSelectedItem();
+ LLFolderViewModelItemInventory* inv_view = static_cast<LLFolderViewModelItemInventory*>(last_selected->getViewModelItem());
+
+ LLInventoryItem* itemp = gInventory.getItem(inv_view->getUUID());
+
+ if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL
+ && mImageAssetID == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID
+ && itemp && itemp->getAssetUUID().isNull())
+ {
+ item_id = inv_view->getUUID();
+ }
+ else if (itemp && itemp->getAssetUUID() == mImageAssetID)
+ {
+ item_id = inv_view->getUUID();
+ }
+ }
+ if (item_id.isNull())
+ {
+ item_id = findItemID(mImageAssetID, FALSE);
+ }
if (item_id.isNull())
{
mInventoryPanel->getRootFolder()->clearSelection();
}
else
{
- LLInventoryItem* itemp = gInventory.getItem(image_id);
+ LLInventoryItem* itemp = gInventory.getItem(item_id);
if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
{
// no copy texture
@@ -741,14 +764,22 @@ void LLFloaterTexturePicker::draw()
const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library)
{
- if (asset_id.isNull())
+ LLUUID loockup_id = asset_id;
+ if (loockup_id.isNull())
{
- return LLUUID::null;
+ if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL)
+ {
+ loockup_id = LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID;
+ }
+ else
+ {
+ return LLUUID::null;
+ }
}
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
- LLAssetIDMatches asset_id_matches(asset_id);
+ LLAssetIDMatches asset_id_matches(loockup_id);
gInventory.collectDescendentsIf(LLUUID::null,
cats,
items,
@@ -816,7 +847,14 @@ void LLFloaterTexturePicker::commitCallback(LLTextureCtrl::ETexturePickOp op)
LLFolderViewModelItemInventory* inv_view = static_cast<LLFolderViewModelItemInventory*>(last_selected->getViewModelItem());
LLInventoryItem* itemp = gInventory.getItem(inv_view->getUUID());
- if (itemp && itemp->getAssetUUID() == mImageAssetID)
+
+ if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL
+ && mImageAssetID == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID
+ && itemp && itemp->getAssetUUID().isNull())
+ {
+ inventory_id = inv_view->getUUID();
+ }
+ else if (itemp && itemp->getAssetUUID() == mImageAssetID)
{
inventory_id = inv_view->getUUID();
}