From 6d0fcc0e616ff58f4a83bc3730374c5509ee959a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 28 Oct 2022 19:58:27 +0300 Subject: SL-17699 Blank material Id for material picker --- indra/newview/llgltfmateriallist.cpp | 2 ++ indra/newview/llgltfmateriallist.h | 2 ++ indra/newview/llmaterialeditor.cpp | 6 +----- indra/newview/llpanelface.cpp | 2 +- indra/newview/lltexturectrl.cpp | 3 ++- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 48f4305ee7..ab7a6495c4 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -47,6 +47,8 @@ LLGLTFMaterialList gGLTFMaterialList; +const LLUUID LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID("968cbad0-4dad-d64e-71b5-72bf13ad051a"); + namespace { class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index f770f6ecc8..b74e0b3ec2 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -37,6 +37,8 @@ class LLFetchedGLTFMaterial; class LLGLTFMaterialList { public: + static const LLUUID BLANK_MATERIAL_ASSET_ID; + LLGLTFMaterialList() {} diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 1213deec64..533f882d39 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -2333,11 +2333,6 @@ bool LLMaterialEditor::setFromSelection() void LLMaterialEditor::loadAsset() { - // derived from LLPreviewNotecard::loadAsset - - // TODO: see commented out "editor" references and make them do something appropriate to the UI - - // request the asset. const LLInventoryItem* item; if (mNotecardInventoryID.notNull()) { @@ -2405,6 +2400,7 @@ void LLMaterialEditor::loadAsset() setEnableEditing(false); // wait for it to load + // request the asset. gAssetStorage->getInvItemAsset(source_sim, gAgent.getID(), gAgent.getSessionID(), diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c6e0bc5153..6d8d19c57c 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -223,7 +223,7 @@ BOOL LLPanelFace::postBuild() if (pbr_ctrl) { pbr_ctrl->setDefaultImageAssetID(LLUUID::null); - pbr_ctrl->setBlankImageAssetID(LLUUID::null); // should there be some empty default material? + pbr_ctrl->setBlankImageAssetID(LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID); pbr_ctrl->setCommitCallback(boost::bind(&LLPanelFace::onCommitPbr, this, _2)); pbr_ctrl->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelPbr, this, _2)); pbr_ctrl->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectPbr, this, _2)); diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index ebb7ee609c..07e09ec038 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -700,8 +700,9 @@ void LLFloaterTexturePicker::onBtnBlank(void* userdata) void LLFloaterTexturePicker::onBtnNone(void* userdata) { LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; + self->setCanApply(true, true); self->setImageID( LLUUID::null ); - self->commitCancel(); + self->commitIfImmediateSet(); } /* -- cgit v1.2.3 From c61224bef22686c4e6f5b4a6af9acbeb27d561ab Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 29 Oct 2022 00:27:47 +0300 Subject: SL-17699 Hide pipette for material picker At the moment there is no specification how it should work, it can't work like it does for textures due to material overrides. Also removed some dead code --- indra/newview/lltexturectrl.cpp | 36 +++++++++++++++------- indra/newview/lltexturectrl.h | 1 - .../skins/default/xui/en/floater_texture_ctrl.xml | 13 -------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 07e09ec038..7aa3639df7 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -479,7 +479,6 @@ BOOL LLFloaterTexturePicker::postBuild() LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1)); getChild("l_bake_use_texture_combo_box")->setCommitCallback(onBakeTextureSelect, this); - getChild("hide_base_mesh_region")->setCommitCallback(onHideBaseMeshRegionCheck, this); setBakeTextureEnabled(TRUE); return TRUE; @@ -822,7 +821,6 @@ void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata) self->getChild("Default")->setVisible(index == 0 ? TRUE : FALSE); 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("inventory search editor")->setVisible(index == 0 ? TRUE : FALSE); self->getChild("inventory panel")->setVisible(index == 0 ? TRUE : FALSE); @@ -832,7 +830,10 @@ void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata) self->getChild("l_name_list")->setVisible(index == 1 ? TRUE : FALSE); self->getChild("l_bake_use_texture_combo_box")->setVisible(index == 2 ? TRUE : FALSE); - self->getChild("hide_base_mesh_region")->setVisible(FALSE);// index == 2 ? TRUE : FALSE); + + bool pipette_visible = (index == 0) + && (self->mInventoryPickType != LLTextureCtrl::PICK_MATERIAL); + self->getChild("Pipette")->setVisible(pipette_visible); if (index == 2) { @@ -1111,13 +1112,6 @@ void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data } } -//static -void LLFloaterTexturePicker::onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *user_data) -{ - //LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data; - //LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl; -} - void LLFloaterTexturePicker::updateFilterPermMask() { //mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss. @@ -1242,6 +1236,16 @@ void LLFloaterTexturePicker::setInventoryPickType(LLTextureCtrl::EPickInventoryT mInventoryPickType = type; refreshLocalList(); refreshInventoryFilter(); + + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL) + { + getChild("Pipette")->setVisible(false); + } + else + { + S32 index = mModeSelector->getValue().asInteger(); + getChild("Pipette")->setVisible(index == 0); + } } void LLFloaterTexturePicker::onPickerCallback(const std::vector& filenames, LLHandle handle) @@ -1292,7 +1296,17 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te ) if (inventory_item_id.notNull()) { LLToolPipette::getInstance()->setResult(TRUE, ""); - setImageID(te.getID()); + if (mInventoryPickType == LLTextureCtrl::PICK_MATERIAL) + { + // tes have no data about material ids + // Plus gltf materials are layered with overrides, + // which mean that end result might have no id. + LL_WARNS() << "tes have no data about material ids" << LL_ENDL; + } + else + { + setImageID(te.getID()); + } mNoCopyTextureSelected = FALSE; LLInventoryItem* itemp = gInventory.getItem(inventory_item_id); diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index 0a5a281e76..d06a82bbd5 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -352,7 +352,6 @@ public: static void onLocalScrollCommit(LLUICtrl* ctrl, void* userdata); static void onBakeTextureSelect(LLUICtrl* ctrl, void *userdata); - static void onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *userdata); void setLocalTextureEnabled(BOOL enabled); void setBakeTextureEnabled(BOOL enabled); diff --git a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml index 0cb69137e3..18631c3ae7 100644 --- a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml +++ b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml @@ -275,19 +275,6 @@ name="BAKED_AUX3" value="10" /> -