diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-11-18 21:06:48 +0200 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-11-18 21:15:54 +0200 |
commit | ade79bc6f6b6269dbcb88f3dff2db6584d0c2f53 (patch) | |
tree | 67c1e35b47afa9a80f26f86effe2f9d9ca46379b | |
parent | 32663643c77a931892a2f8e40e011c60bc726d4e (diff) |
SL-18677 Disable materials UI when materials caps are not available
-rw-r--r-- | indra/newview/llmaterialeditor.h | 2 | ||||
-rw-r--r-- | indra/newview/llpanelface.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 10 | ||||
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_inventory.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_inventory_add.xml | 2 |
8 files changed, 42 insertions, 16 deletions
diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index 423e56e6c0..3520709a31 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -229,7 +229,7 @@ public: U32 getUnsavedChangesFlags() { return mUnsavedChanges; } U32 getRevertedChangesFlags() { return mRevertedChanges; } - bool capabilitiesAvalaible(); + static bool capabilitiesAvalaible(); private: static bool updateInventoryItem(const std::string &buffer, const LLUUID &item_id, const LLUUID &task_id); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index d620704019..98f7adabd9 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1774,6 +1774,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, has_pbr_material = false; BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); + bool has_pbr_capabilities = LLMaterialEditor::capabilitiesAvalaible(); // pbr material LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); @@ -1784,13 +1785,14 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr); pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); - pbr_ctrl->setEnabled(editable); + pbr_ctrl->setEnabled(editable && has_pbr_capabilities); pbr_ctrl->setImageAssetID(pbr_id); has_pbr_material = pbr_id.notNull(); } - getChildView("pbr_from_inventory")->setEnabled(editable); - getChildView("edit_selected_pbr")->setEnabled(editable && has_pbr_material); - getChildView("save_selected_pbr")->setEnabled(objectp->permCopy() && has_pbr_material); + + getChildView("pbr_from_inventory")->setEnabled(editable && has_pbr_capabilities); + getChildView("edit_selected_pbr")->setEnabled(editable && has_pbr_material && has_pbr_capabilities); + getChildView("save_selected_pbr")->setEnabled(objectp->permCopy() && has_pbr_material && has_pbr_capabilities); const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); if (show_pbr) @@ -1806,11 +1808,11 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, LLUICtrl* gltfCtrlTextureOffsetU = getChild<LLUICtrl>("gltfTextureOffsetU"); LLUICtrl* gltfCtrlTextureOffsetV = getChild<LLUICtrl>("gltfTextureOffsetV"); - gltfCtrlTextureScaleU->setEnabled(show_texture_info); - gltfCtrlTextureScaleV->setEnabled(show_texture_info); - gltfCtrlTextureRotation->setEnabled(show_texture_info); - gltfCtrlTextureOffsetU->setEnabled(show_texture_info); - gltfCtrlTextureOffsetV->setEnabled(show_texture_info); + gltfCtrlTextureScaleU->setEnabled(show_texture_info && has_pbr_capabilities); + gltfCtrlTextureScaleV->setEnabled(show_texture_info && has_pbr_capabilities); + gltfCtrlTextureRotation->setEnabled(show_texture_info && has_pbr_capabilities); + gltfCtrlTextureOffsetU->setEnabled(show_texture_info && has_pbr_capabilities); + gltfCtrlTextureOffsetV->setEnabled(show_texture_info && has_pbr_capabilities); if (show_texture_info) { @@ -1823,23 +1825,23 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) { - return mat->mTextureTransform[texture_info].mScale[VX]; + return mat ? mat->mTextureTransform[texture_info].mScale[VX] : 0.f; }, transform.mScale[VX], scale_u_same, true, 1e-3f); readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) { - return mat->mTextureTransform[texture_info].mScale[VY]; + return mat ? mat->mTextureTransform[texture_info].mScale[VY] : 0.f; }, transform.mScale[VY], scale_v_same, true, 1e-3f); readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) { - return mat->mTextureTransform[texture_info].mRotation; + return mat ? mat->mTextureTransform[texture_info].mRotation : 0.f; }, transform.mRotation, rotation_same, true, 1e-3f); readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) { - return mat->mTextureTransform[texture_info].mOffset[VX]; + return mat ? mat->mTextureTransform[texture_info].mOffset[VX] : 0.f; }, transform.mOffset[VX], offset_u_same, true, 1e-3f); readSelectedGLTFMaterial<float>([&](const LLGLTFMaterial* mat) { - return mat->mTextureTransform[texture_info].mOffset[VY]; + return mat ? mat->mTextureTransform[texture_info].mOffset[VY] : 0.f; }, transform.mOffset[VY], offset_v_same, true, 1e-3f); gltfCtrlTextureScaleU->setValue(transform.mScale[VX]); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 49562da3f7..8b78ee843f 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -127,6 +127,7 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p) mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this)); mEnableCallbackRegistrar.add("Inventory.EnvironmentEnabled", [](LLUICtrl *, const LLSD &) { return LLPanelMainInventory::hasSettingsInventory(); }); + mEnableCallbackRegistrar.add("Inventory.MaterialsEnabled", [](LLUICtrl *, const LLSD &) { return LLPanelMainInventory::hasMaterialsInventory(); }); mSavedFolderState = new LLSaveFolderState(); @@ -1595,5 +1596,13 @@ bool LLPanelMainInventory::hasSettingsInventory() return LLEnvironment::instance().isInventoryEnabled(); } +bool LLPanelMainInventory::hasMaterialsInventory() +{ + std::string agent_url = gAgent.getRegionCapability("UpdateMaterialAgentInventory"); + std::string task_url = gAgent.getRegionCapability("UpdateMaterialTaskInventory"); + + return (!agent_url.empty() && !task_url.empty()); +} + // List Commands // //////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 257bce930c..9a36470273 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -165,6 +165,7 @@ protected: void onCustomAction(const LLSD& command_name); bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept); static bool hasSettingsInventory(); + static bool hasMaterialsInventory(); /** * Set upload cost in "Upload" sub menu. */ diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index c214ea164d..76a5cf8f5e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2807,6 +2807,11 @@ struct LLSelectedTEGetmatIdAndPermissions : public LLSelectedTEFunctor bool enable_object_edit_gltf_material() { + if (!LLMaterialEditor::capabilitiesAvalaible()) + { + return false; + } + LLSelectedTEGetmatIdAndPermissions func; LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); return func.mCanModify && func.mMaterialId.notNull(); @@ -2814,6 +2819,11 @@ bool enable_object_edit_gltf_material() bool enable_object_save_gltf_material() { + if (!LLMaterialEditor::capabilitiesAvalaible()) + { + return false; + } + LLSelectedTEGetmatIdAndPermissions func; LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); return func.mCanCopy && func.mMaterialId.notNull(); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0e7fd63c7f..5ecc081782 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2652,7 +2652,7 @@ void LLViewerRegion::cacheFullUpdateExtras(LLSD const & extras, std::string cons } else { - LL_WARNS() << "got material override for unknown object_id, cannot cache it" << LL_ENDL; + LL_WARNS("GLTF") << "got material override for unknown object_id, cannot cache it" << LL_ENDL; } } diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 46dd0ada5d..5e2fd31301 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -474,6 +474,8 @@ <menu_item_call.on_click function="Inventory.DoCreate" parameter="material" /> + <menu_item_call.on_enable + function="Inventory.MaterialsEnabled" /> </menu_item_call> <menu label="New Clothes" diff --git a/indra/newview/skins/default/xui/en/menu_inventory_add.xml b/indra/newview/skins/default/xui/en/menu_inventory_add.xml index 0e193521a3..fa40c5df90 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory_add.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory_add.xml @@ -104,6 +104,8 @@ <menu_item_call.on_click function="Inventory.DoCreate" parameter="material" /> + <menu_item_call.on_enable + function="Inventory.MaterialsEnabled" /> </menu_item_call> <menu height="175" |