diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h
index 26e9e8b66588b451736ccc48ea64c90a19184c5c..8f5bc4da373a1e94a3fa3654d6361af845886155 100644
--- a/indra/llui/llfolderview.h
+++ b/indra/llui/llfolderview.h
@@ -218,6 +218,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 	virtual void draw();
 	virtual void deleteAllChildren();
 
+    void stopAutoScollining() {mNeedsScroll = false;}
 	void scrollToShowSelection();
 	void scrollToShowItem(LLFolderViewItem* item, const LLRect& constraint_rect);
 	void setScrollContainer( LLScrollContainer* parent ) { mScrollContainer = parent; }
diff --git a/indra/newview/llfloatertexturepicker.cpp b/indra/newview/llfloatertexturepicker.cpp
index 6e8d34718c96f5133a41e6ece86108adcbcb3938..58b32fe88c2078b8cdafaa3148e86f38b3fc6dcb 100644
--- a/indra/newview/llfloatertexturepicker.cpp
+++ b/indra/newview/llfloatertexturepicker.cpp
@@ -128,15 +128,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
@@ -662,14 +685,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,
@@ -737,7 +768,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();
                     }
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 42b209cf228a271d1a00ed26f7f9f20a290b06d7..3523271ae7a6167e39ffebf4cc65903b37699c1a 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -1453,45 +1453,6 @@ void LLInventoryPanel::onFocusReceived()
 	// inventory now handles cut/copy/paste/delete
 	LLEditMenuHandler::gEditMenuHandler = mFolderRoot.get();
 
-    // Tab support, when tabbing into this view, select first item
-    // (ideally needs to account for scroll)
-    bool select_first = mSelectThisID.isNull() && mFolderRoot.get() && mFolderRoot.get()->getSelectedCount() == 0;
-
-    if (select_first)
-    {
-        LLFolderViewFolder::folders_t::const_iterator folders_it = mFolderRoot.get()->getFoldersBegin();
-        LLFolderViewFolder::folders_t::const_iterator folders_end = mFolderRoot.get()->getFoldersEnd();
-
-        for (; folders_it != folders_end; ++folders_it)
-        {
-            const LLFolderViewFolder* folder_view = *folders_it;
-            if (folder_view->getVisible())
-            {
-                const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(folder_view->getViewModelItem());
-                setSelectionByID(modelp->getUUID(), TRUE);
-                select_first = false;
-                break;
-            }
-        }
-    }
-
-    if (select_first)
-    {
-        LLFolderViewFolder::items_t::const_iterator items_it = mFolderRoot.get()->getItemsBegin();
-        LLFolderViewFolder::items_t::const_iterator items_end = mFolderRoot.get()->getItemsEnd();
-
-        for (; items_it != items_end; ++items_it)
-        {
-            const LLFolderViewItem* item_view = *items_it;
-            if (item_view->getVisible())
-            {
-                const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(item_view->getViewModelItem());
-                setSelectionByID(modelp->getUUID(), TRUE);
-                break;
-            }
-        }
-    }
-
 	LLPanel::onFocusReceived();
 }
 
@@ -2300,6 +2261,53 @@ void LLInventorySingleFolderPanel::initFromParams(const Params& p)
     LLPanel::initFromParams(mParams);
 }
 
+void LLInventorySingleFolderPanel::onFocusReceived()
+{
+    // Tab support, when tabbing into this view, select first item
+    // (ideally needs to account for scroll)
+    bool select_first = mSelectThisID.isNull() && mFolderRoot.get() && mFolderRoot.get()->getSelectedCount() == 0;
+
+    if (select_first)
+    {
+        LLFolderViewFolder::folders_t::const_iterator folders_it = mFolderRoot.get()->getFoldersBegin();
+        LLFolderViewFolder::folders_t::const_iterator folders_end = mFolderRoot.get()->getFoldersEnd();
+
+        for (; folders_it != folders_end; ++folders_it)
+        {
+            const LLFolderViewFolder* folder_view = *folders_it;
+            if (folder_view->getVisible())
+            {
+                const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(folder_view->getViewModelItem());
+                setSelectionByID(modelp->getUUID(), TRUE);
+                // quick and dirty fix: don't scroll on switching focus
+                // todo: better 'tab' support, one that would work for LLInventoryPanel
+                mFolderRoot.get()->stopAutoScollining();
+                select_first = false;
+                break;
+            }
+        }
+    }
+
+    if (select_first)
+    {
+        LLFolderViewFolder::items_t::const_iterator items_it = mFolderRoot.get()->getItemsBegin();
+        LLFolderViewFolder::items_t::const_iterator items_end = mFolderRoot.get()->getItemsEnd();
+
+        for (; items_it != items_end; ++items_it)
+        {
+            const LLFolderViewItem* item_view = *items_it;
+            if (item_view->getVisible())
+            {
+                const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(item_view->getViewModelItem());
+                setSelectionByID(modelp->getUUID(), TRUE);
+                mFolderRoot.get()->stopAutoScollining();
+                break;
+            }
+        }
+    }
+    LLInventoryPanel::onFocusReceived();
+}
+
 void LLInventorySingleFolderPanel::initFolderRoot(const LLUUID& start_folder_id)
 {
     if(mRootInited) return;
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 3c17e1fe13bffdf8c84068c86b1cc98098dd9bd7..467e1a122689015880722477bb820c73e8fc2f98 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -406,6 +406,8 @@ class LLInventorySingleFolderPanel : public LLInventoryPanel
     {};
 
     void initFromParams(const Params& p);
+    void onFocusReceived() override;
+
     bool isSelectionRemovable() { return false; }
 
     void initFolderRoot(const LLUUID& start_folder_id = LLUUID::null);
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index c90ce91fde1f73965b7c17adf415e11358767544..b7eee15909c174ce6d73148a3f2057ce9a832408 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -45,7 +45,7 @@
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <boost/date_time/local_time_adjustor.hpp>
 
-const S32 LOG_RECALL_SIZE = 2048;
+const S32 LOG_RECALL_SIZE = 20480;
 
 const std::string LL_IM_TIME("time");
 const std::string LL_IM_DATE_TIME("datetime");
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 9957a3d8b9b22379a5013ba65fa4803125ffcce2..61a128ed25610edf2cf4d116327c3656997f02dc 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -1785,6 +1785,10 @@ bool LLObjectSelection::applyRestrictedPbrMaterialToTEs(LLViewerInventoryItem* i
     }
 
     LLUUID asset_id = item->getAssetUUID();
+    if (asset_id.isNull())
+    {
+        asset_id = LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID;
+    }
 
     bool material_copied_all_faces = true;
 
@@ -1984,6 +1988,10 @@ bool LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id)
                     return false;
                 }
                 asset_id = mItem->getAssetUUID();
+                if (asset_id.isNull())
+                {
+                    asset_id = LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID;
+                }
             }
 
             // Blank out most override data on the object and send to server
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index dbf452ae70dc0920c1ed9b5c615983180170f1d3..daa3d65be58efebef83a33d12fdbc012b9d5cd7e 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -203,15 +203,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
@@ -731,14 +754,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,
@@ -806,7 +837,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();
                     }