From 119b02937ed42502549ba3dab2db48c6edef9425 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 27 Jul 2023 23:20:17 +0300 Subject: SL-19958 An inventory material without asset should default to a blank material #2 --- indra/newview/lltexturectrl.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 0dd1ff5483..b3310a1f9a 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -232,12 +232,20 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti mInventoryPanel->setSelection(item_id, TAKE_FOCUS_NO); } } - - - } } +void LLFloaterTexturePicker::setImageIDFromItem(const LLInventoryItem* itemp, bool set_selection) +{ + LLUUID asset_id = itemp->getAssetUUID(); + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL && asset_id.isNull()) + { + // If an inventory item has a null asset, consider it a valid blank material(gltf) + asset_id = LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID; + } + setImageID(asset_id, set_selection); +} + void LLFloaterTexturePicker::setActive( BOOL active ) { if (!active && getChild("Pipette")->getValue().asBoolean()) @@ -388,7 +396,7 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop( { if (drop) { - setImageID( item->getAssetUUID() ); + setImageIDFromItem(item); commitIfImmediateSet(); } @@ -860,7 +868,7 @@ void LLFloaterTexturePicker::onSelectionChange(const std::dequegetAssetUUID(),false); + setImageIDFromItem(itemp, false); mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? if(!mPreviewSettingChanged) -- cgit v1.2.3 From 5a706086fefa6058389dc35707fc6b0c8ccece2d Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 21 Jul 2023 17:32:08 -0700 Subject: SL-20053: Fix sometimes unable to unset a PBR material on a prim. Caused by inventory item asset IDs being null. Seems suspicious. But working around it for now seems best. --- indra/newview/lltexturectrl.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/lltexturectrl.cpp') diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index b3310a1f9a..c13376d0a6 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -693,6 +693,11 @@ void LLFloaterTexturePicker::draw() const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library) { + if (asset_id.isNull()) + { + return LLUUID::null; + } + LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLAssetIDMatches asset_id_matches(asset_id); -- cgit v1.2.3