From c4625d26e51dcfa0480fa936b894d3625b68eda2 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Wed, 27 Apr 2022 11:42:02 -0600 Subject: Prototype a SaveMaterial button --- indra/newview/llpanelface.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 71657239a6..c34010ce43 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -157,6 +157,7 @@ BOOL LLPanelFace::postBuild() childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); + childSetAction("button save material", &LLPanelFace::onSaveMaterial, this); LLTextureCtrl* mTextureCtrl; LLTextureCtrl* mShinyTextureCtrl; @@ -1409,7 +1410,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLMaterialPtr material; LLSelectedTEMaterial::getCurrent(material, identical); - if (material && editable) + // QUICKHACK - enable this UI box, indiscriminatly. TODO discriminate DJH 2022-04 + childSetEnabled("button save material", true); + + if (material && editable) { LL_DEBUGS("Materials") << material->asLLSD() << LL_ENDL; @@ -2538,6 +2542,16 @@ void LLPanelFace::onAlignTexture(void* userdata) self->alignTestureLayer(); } +void LLPanelFace::onSaveMaterial(void* userdata) +{ + LLPanelFace* self = (LLPanelFace*)userdata; + + // DRTVWR-559, Q&D material picker - save to inventory goes here + auto bound = self->getBoundingRect(); + self->setUseBoundingRect(self->getUseBoundingRect()); + //self->saveMaterialToInventory(); +} + // TODO: I don't know who put these in or what these are for??? void LLPanelFace::setMediaURL(const std::string& url) -- cgit v1.2.3 From 3f43553ea096ce27da11ff797708ef7d6a391389 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Wed, 27 Apr 2022 14:55:06 -0700 Subject: Test UI for SL-17116. provide a debug interface to set a MaterialID for a face --- indra/newview/llpanelface.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 71657239a6..094add423f 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -154,6 +154,7 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("glossiness",&LLPanelFace::onCommitMaterialGloss, this); childSetCommitCallback("environment",&LLPanelFace::onCommitMaterialEnv, this); childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterialMaskCutoff, this); + childSetCommitCallback("materialID", &LLPanelFace::onCommitMaterialID, this); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); @@ -298,7 +299,7 @@ BOOL LLPanelFace::postBuild() { mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow, this); } - + clearCtrls(); @@ -1518,6 +1519,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) calcp->setVar(LLCalc::TEX_ROTATION, childGetValue("TexRot").asReal()); calcp->setVar(LLCalc::TEX_TRANSPARENCY, childGetValue("ColorTrans").asReal()); calcp->setVar(LLCalc::TEX_GLOW, childGetValue("glow").asReal()); + + getChildView("materialID")->setEnabled(editable); } else { @@ -2302,6 +2305,12 @@ void LLPanelFace::onCommitMaterialMaskCutoff(LLUICtrl* ctrl, void* userdata) LLSelectedTEMaterial::setAlphaMaskCutoff(self,self->getCurrentAlphaMaskCutoff()); } +//static +void LLPanelFace::onCommitMaterialID(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self [[maybe_unused]] = (LLPanelFace*) userdata; +} + // static void LLPanelFace::onCommitTextureInfo( LLUICtrl* ctrl, void* userdata ) { -- cgit v1.2.3 From b08742d0b3e0000430b8ae772c7c4d25cfe084fa Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 28 Apr 2022 11:53:43 -0600 Subject: Add a (broken) material upload handler fxn --- indra/newview/llpanelface.cpp | 52 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c34010ce43..34a546f458 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2542,14 +2542,58 @@ void LLPanelFace::onAlignTexture(void* userdata) self->alignTestureLayer(); } +#include "llagent.h" +#include "llfilesystem.h" +#include "llfloaterperms.h" +#include "llviewerassetupload.h" +#include "llviewermenufile.h" +#include "llsd.h" +#pragma warning (disable: 4189) void LLPanelFace::onSaveMaterial(void* userdata) { + // DRTVWR-559, Q&D material picker - save to inventory goes here + LL_DEBUGS("Material") << "saving material to inventory" << LL_ENDL; + LLPanelFace* self = (LLPanelFace*)userdata; + + std::string name = "New Material"; + + LLSD* mat_llsd = new LLSD("Surely you jest..."); + // TBD populate mat_llsd with material data + self->onCloseTexturePicker(*mat_llsd); // certainly wrong, but something like this? + + // gen a new uuid for this asset + LLTransactionID tid; + tid.generate(); + LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); + + LLFileSystem fmt_file(new_asset_id, LLAssetType::AT_MATERIAL, LLFileSystem::WRITE); + fmt_file.write(mat_llsd->asBinary().data(), mat_llsd->size()); + + S32 expected_upload_cost = 0;// LLAgentBenefitsMgr::current().getTextureUploadCost(); - // DRTVWR-559, Q&D material picker - save to inventory goes here - auto bound = self->getBoundingRect(); - self->setUseBoundingRect(self->getUseBoundingRect()); - //self->saveMaterialToInventory(); + std::string res_name = name; + std::string res_desc = "Saved Material"; + LLFolderType::EType folder_type = LLFolderType::FT_MATERIAL; + LLInventoryType::EType inv_type = LLInventoryType::IT_MATERIAL; + + auto upload_info = new LLResourceUploadInfo( + tid, + LLAssetType::AT_MATERIAL, + res_name, + res_desc, + 0, + folder_type, + inv_type, + PERM_ALL, + LLFloaterPerms::getGroupPerms("Uploads"), + LLFloaterPerms::getEveryonePerms("Uploads"), + expected_upload_cost, + false); + + LLResourceUploadInfo::ptr_t p_upload_info(upload_info); + + upload_new_resource(p_upload_info); } -- cgit v1.2.3 From c9ef206e39063c46c1fbab355c1a015e3e8b022e Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Thu, 28 Apr 2022 13:08:37 -0700 Subject: Beginning viewer side work for SL-17198 new asset and inventory types for Materials --- indra/newview/llpanelface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 094add423f..0b986e9a07 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -123,6 +123,7 @@ F32 LLPanelFace::getCurrentShinyScaleU() { return getChild("shinySca F32 LLPanelFace::getCurrentShinyScaleV() { return getChild("shinyScaleV")->getValue().asReal(); } F32 LLPanelFace::getCurrentShinyOffsetU() { return getChild("shinyOffsetU")->getValue().asReal(); } F32 LLPanelFace::getCurrentShinyOffsetV() { return getChild("shinyOffsetV")->getValue().asReal(); } +LLUUID LLPanelFace::getCurrentMaterialID() { return getChild("materialID")->getValue().asUUID(); } // // Methods @@ -2308,7 +2309,8 @@ void LLPanelFace::onCommitMaterialMaskCutoff(LLUICtrl* ctrl, void* userdata) //static void LLPanelFace::onCommitMaterialID(LLUICtrl* ctrl, void* userdata) { - LLPanelFace* self [[maybe_unused]] = (LLPanelFace*) userdata; + LLPanelFace* self = static_cast(userdata); + LLSelectedTEMaterial::setMaterialID(self, self->getCurrentMaterialID()); } // static -- cgit v1.2.3 From f05e58715e0a18a7ba2ace87c2ae45684c864169 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 29 Apr 2022 17:04:22 -0600 Subject: SL-17116, SL-17277 single-face material save only --- indra/newview/llpanelface.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 6f4d57f30e..6b3ca43402 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1412,9 +1412,14 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLMaterialPtr material; LLSelectedTEMaterial::getCurrent(material, identical); - // QUICKHACK - enable this UI box, indiscriminatly. TODO discriminate DJH 2022-04 - childSetEnabled("button save material", true); - + // enable this UI box if a single face is selected. + BOOL is_single_face = !LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected(); + childSetEnabled("button save material", static_cast(is_single_face)); + childSetEnabled("materialID", static_cast(is_single_face)); // doesn't work - why? + + // TODO: 2022-04 conflicts with media button placement. hide the button if applying media + // i.e. childSetVisible("button save material", !applying_media); + if (material && editable) { LL_DEBUGS("Materials") << material->asLLSD() << LL_ENDL; -- cgit v1.2.3 From cce5fdca844c3e762288e7aa4b255c29a5408e45 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Wed, 4 May 2022 14:33:55 -0600 Subject: SL-17325 apply inventory material to face --- indra/newview/llpanelface.cpp | 141 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 129 insertions(+), 12 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 6b3ca43402..de59490eea 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2319,7 +2319,11 @@ void LLPanelFace::onCommitMaterialMaskCutoff(LLUICtrl* ctrl, void* userdata) void LLPanelFace::onCommitMaterialID(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = static_cast(userdata); - LLSelectedTEMaterial::setMaterialID(self, self->getCurrentMaterialID()); + LLUUID matID = self->getCurrentMaterialID(); + LLSelectedTEMaterial::setMaterialID(self, matID); + + // Temporary demo hack - replace the TE entries with those from the Material's LLSD + applyMaterialUUID(matID, userdata); } // static @@ -2564,27 +2568,26 @@ void LLPanelFace::onAlignTexture(void* userdata) #include "llviewerassetupload.h" #include "llviewermenufile.h" #include "llsd.h" -#pragma warning (disable: 4189) void LLPanelFace::onSaveMaterial(void* userdata) { // DRTVWR-559, Q&D material picker - save to inventory goes here - LL_DEBUGS("Material") << "saving material to inventory" << LL_ENDL; - - LLPanelFace* self = (LLPanelFace*)userdata; + LL_DEBUGS("Material") << "saving render material to inventory" << LL_ENDL; std::string name = "New Material"; - LLSD* mat_llsd = new LLSD("Surely you jest..."); - // TBD populate mat_llsd with material data - self->onCloseTexturePicker(*mat_llsd); // certainly wrong, but something like this? - // gen a new uuid for this asset LLTransactionID tid; - tid.generate(); + tid.generate(); // timestamp-based randomization + uniquification LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - LLFileSystem fmt_file(new_asset_id, LLAssetType::AT_MATERIAL, LLFileSystem::WRITE); - fmt_file.write(mat_llsd->asBinary().data(), mat_llsd->size()); + // populate mat_llsd with material data + LLSD* mat_llsd = new LLSD(); + renderMaterialToLLSD(mat_llsd, new_asset_id, userdata); + + LLFileSystem material_file(new_asset_id, LLAssetType::AT_MATERIAL, LLFileSystem::WRITE); + material_file.write(mat_llsd->asBinary().data(), mat_llsd->size()); + + delete(mat_llsd); S32 expected_upload_cost = 0;// LLAgentBenefitsMgr::current().getTextureUploadCost(); @@ -2612,6 +2615,120 @@ void LLPanelFace::onSaveMaterial(void* userdata) upload_new_resource(p_upload_info); } +// Fill an LLSD with data describing the current face's texture settings +// TODO 2022-05 FUBAR there are both colliding and different data in LLPanelFace vs the TE. Also, neither one has the diffuse tex settings. +// +void LLPanelFace::renderMaterialToLLSD(LLSD* sd, LLUUID uuid, void* userdata) +{ + llassert(userdata != nullptr); + + sd->insert("RenderMaterialUUID", LLSD(uuid)); + + /* pf stuff is probably useless + // pull data from the LLPanelFace + LLPanelFace* instance = static_cast(userdata); + sd->insert("pfNormalMap", LLSD(instance->getCurrentNormalMap())); + sd->insert("pfSpecularMap", LLSD(instance->getCurrentSpecularMap())); + sd->insert("pfShininess", LLSD(static_cast(instance->getCurrentShininess()))); + sd->insert("pfBumpiness", LLSD(static_cast(instance->getCurrentBumpiness()))); + sd->insert("pfAlphaMode", LLSD(static_cast(instance->getCurrentDiffuseAlphaMode()))); + sd->insert("pfAlphaCutoff", LLSD(static_cast(instance->getCurrentAlphaMaskCutoff()))); + sd->insert("pfEnvIntensity", LLSD(static_cast(instance->getCurrentEnvIntensity()))); + sd->insert("pfGlossiness", LLSD(static_cast(instance->getCurrentGlossiness()))); + sd->insert("pfNormalRotation", LLSD(instance->getCurrentBumpyRot())); + sd->insert("pfNormalScaleU", LLSD(instance->getCurrentBumpyScaleU())); + sd->insert("pfNormalScaleV", LLSD(instance->getCurrentBumpyScaleV())); + sd->insert("pfNormalOffsetU", LLSD(instance->getCurrentBumpyOffsetU())); + sd->insert("pfNormalOffsetV", LLSD(instance->getCurrentBumpyOffsetV())); + sd->insert("pfSpecularRotation", LLSD(instance->getCurrentShinyRot())); + sd->insert("pfSpecularScaleU", LLSD(instance->getCurrentShinyScaleU())); + sd->insert("pfSpecularScaleV", LLSD(instance->getCurrentShinyScaleV())); + sd->insert("pfSpecularOffsetU", LLSD(instance->getCurrentShinyOffsetU())); + sd->insert("pfSpecularOffsetV", LLSD(instance->getCurrentShinyOffsetV())); + sd->insert("pfMaterialID", LLSD(instance->getCurrentMaterialID())); + */ + + // now pull same data from the selected TE (same but different. W T F?) + LLMaterialPtr mat = nullptr; + bool ident; // ? + LLSelectedTEMaterial::getCurrent(mat, ident); + + sd->insert("teMaterialID", LLSD(mat->getMaterialID())); + + sd->insert("teNormalMap", LLSD(mat->getNormalID())); + sd->insert("teNormalOffsetX", LLSD(mat->getNormalOffsetX())); + sd->insert("teNormalOffsetY", LLSD(mat->getNormalOffsetY())); + sd->insert("teNormalRepeatX", LLSD(mat->getNormalRepeatX())); + sd->insert("teNormalRepeatY", LLSD(mat->getNormalRepeatY())); + sd->insert("teNormalRotation", LLSD(mat->getNormalRotation())); + + sd->insert("teSpecularMap", LLSD(mat->getSpecularID())); + LLColor4U color = mat->getSpecularLightColor(); + sd->insert("teSpecularColorR", LLSD(static_cast(color.mV[0]))); + sd->insert("teSpecularColorG", LLSD(static_cast(color.mV[1]))); + sd->insert("teSpecularColorB", LLSD(static_cast(color.mV[2]))); + sd->insert("teSpecularColorA", LLSD(static_cast(color.mV[3]))); + sd->insert("teSpecularExponent", LLSD(static_cast(mat->getSpecularLightExponent()))); + sd->insert("teSpecularOffsetX", LLSD(mat->getSpecularOffsetX())); + sd->insert("teSpecularOffsetY", LLSD(mat->getSpecularOffsetY())); + sd->insert("teSpecularRepeatX", LLSD(mat->getSpecularRepeatX())); + sd->insert("teSpecularRepeatY", LLSD(mat->getSpecularRepeatY())); + sd->insert("teSpecularRotation", LLSD(mat->getSpecularRotation())); + + sd->insert("teAlphaMode", LLSD(static_cast(mat->getDiffuseAlphaMode()))); + sd->insert("teAlphaCutoff", LLSD(static_cast(mat->getAlphaMaskCutoff()))); + sd->insert("teEnvIntensity", LLSD(static_cast(mat->getEnvironmentIntensity()))); + sd->insert("teShaderMask", LLSD(static_cast(mat->getShaderMask()))); +} + +// Take the individual texture settings from the material and apply to current face & TE +void LLPanelFace::applyMaterialUUID(LLUUID uuid, void* userdata) +{ + llassert(userdata != nullptr); + //LLPanelFace* instance = static_cast(userdata); + + LLFileSystem material_file(uuid, LLAssetType::AT_MATERIAL, LLFileSystem::READ); + S32 bufsize = material_file.getSize(); + llassert(bufsize > 0); + U8* buffer = new U8(bufsize); + material_file.read(buffer, bufsize); + LLSD* matSD = (LLSD*) buffer; // static_cast complains here (?) + + llassert(uuid == matSD->get("MaterialUUID").asUUID()); // if not, whoo boy + + LLMaterialPtr mat = nullptr; + bool ident; // ? + LLSelectedTEMaterial::getCurrent(mat, ident); + + mat->setMaterialID(matSD->get("teMaterialID").asUUID()); + + mat->setNormalID(matSD->get("teNormalMap").asUUID()); + mat->setNormalOffsetX(matSD->get("teNormalOffsetX").asReal()); + mat->setNormalOffsetY(matSD->get("teNormalOffsetY").asReal()); + mat->setNormalRepeatX(matSD->get("teNormalRepeatX").asReal()); + mat->setNormalRepeatY(matSD->get("teNormalRepeatY").asReal()); + mat->setNormalRotation(matSD->get("teNormalRotation").asReal()); + + mat->setSpecularID(matSD->get("teSpecularMap").asUUID()); + LLColor4U color; + color.mV[0] = static_cast(matSD->get("teSecularColorR").asInteger()); + color.mV[1] = static_cast(matSD->get("teSecularColorG").asInteger()); + color.mV[2] = static_cast(matSD->get("teSecularColorB").asInteger()); + color.mV[3] = static_cast(matSD->get("teSecularColorA").asInteger()); + mat->setSpecularLightColor(color); + mat->setSpecularLightExponent(static_cast(matSD->get("teSpecularExponent").asInteger())); + mat->setSpecularOffsetX(matSD->get("teSpecularOffsetX").asReal()); + mat->setSpecularOffsetY(matSD->get("teSpecularOffsetY").asReal()); + mat->setSpecularRepeatX(matSD->get("teSpecularRepeatX").asReal()); + mat->setSpecularRepeatY(matSD->get("teSpecularRepeatY").asReal()); + mat->setSpecularRotation(matSD->get("teSpecularRotation").asReal()); + + mat->setDiffuseAlphaMode(static_cast(matSD->get("teAlphaMode").asInteger())); + mat->setAlphaMaskCutoff(static_cast(matSD->get("teAlphaCutoff").asInteger())); + mat->setEnvironmentIntensity(static_cast(matSD->get("teEnvIntensity").asInteger())); + //mat->setShaderMask(static_cast(matSD->get(teShaderMask").asInteger()); +} + // TODO: I don't know who put these in or what these are for??? void LLPanelFace::setMediaURL(const std::string& url) -- cgit v1.2.3 From c9be81a74753600b8a06f369966674b50ef9781a Mon Sep 17 00:00:00 2001 From: "Brad Kittenbrink (Brad Linden)" Date: Thu, 28 Apr 2022 17:30:51 -0700 Subject: SL-17198 material asset uploading now suuceeeds. --- indra/newview/llpanelface.cpp | 77 ++++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 30 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 6b3ca43402..024e886b2d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2559,57 +2559,74 @@ void LLPanelFace::onAlignTexture(void* userdata) } #include "llagent.h" -#include "llfilesystem.h" -#include "llfloaterperms.h" #include "llviewerassetupload.h" #include "llviewermenufile.h" #include "llsd.h" -#pragma warning (disable: 4189) +#include "llsdutil.h" +#include "llsdserialize.h" +#include "llinventorymodel.h" + void LLPanelFace::onSaveMaterial(void* userdata) { // DRTVWR-559, Q&D material picker - save to inventory goes here LL_DEBUGS("Material") << "saving material to inventory" << LL_ENDL; - LLPanelFace* self = (LLPanelFace*)userdata; + //LLPanelFace* self = static_cast(userdata); std::string name = "New Material"; - LLSD* mat_llsd = new LLSD("Surely you jest..."); - // TBD populate mat_llsd with material data - self->onCloseTexturePicker(*mat_llsd); // certainly wrong, but something like this? + LLSD material_data = llsd::map( + "version", "1", + "material", LLSD::emptyMap() + ); // gen a new uuid for this asset LLTransactionID tid; tid.generate(); LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - LLFileSystem fmt_file(new_asset_id, LLAssetType::AT_MATERIAL, LLFileSystem::WRITE); - fmt_file.write(mat_llsd->asBinary().data(), mat_llsd->size()); + std::stringstream output; + LLSDSerialize::toNotation(material_data, output); - S32 expected_upload_cost = 0;// LLAgentBenefitsMgr::current().getTextureUploadCost(); + //S32 expected_upload_cost = 0;// LLAgentBenefitsMgr::current().getTextureUploadCost(); std::string res_name = name; std::string res_desc = "Saved Material"; - LLFolderType::EType folder_type = LLFolderType::FT_MATERIAL; - LLInventoryType::EType inv_type = LLInventoryType::IT_MATERIAL; - - auto upload_info = new LLResourceUploadInfo( - tid, - LLAssetType::AT_MATERIAL, - res_name, - res_desc, - 0, - folder_type, - inv_type, - PERM_ALL, - LLFloaterPerms::getGroupPerms("Uploads"), - LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost, - false); - - LLResourceUploadInfo::ptr_t p_upload_info(upload_info); - - upload_new_resource(p_upload_info); + //LLFolderType::EType folder_type = LLFolderType::FT_MATERIAL; + //LLInventoryType::EType inv_type = LLInventoryType::IT_MATERIAL; + U32 next_owner_perm = LLPermissions::DEFAULT.getMaskNextOwner(); + + LLUUID parent = gInventory.findCategoryUUIDForType(LLFolderType::FT_MATERIAL); + const U8 subtype = NO_INV_SUBTYPE; // TODO maybe use AT_SETTINGS and LLSettingsType::ST_MATERIAL ? + + create_inventory_item(gAgent.getID(), gAgent.getSessionID(), parent, tid, res_name, res_desc, + LLAssetType::AT_MATERIAL, LLInventoryType::IT_MATERIAL, subtype, next_owner_perm, + new LLBoostFuncInventoryCallback([output=output.str()](LLUUID const & inv_item_id){ + // from reference in LLSettingsVOBase::createInventoryItem()/updateInventoryItem() + LLResourceUploadInfo::ptr_t uploadInfo = + std::make_shared( + inv_item_id, + LLAssetType::AT_SETTINGS, // TODO switch to AT_MATERIAL + output, + [](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response) { + LL_INFOS("Material") << "inventory item uploaded. item: " << item_id << " asset: " << new_asset_id << " new_item_id: " << new_item_id << " response: " << response << LL_ENDL; + LLSD params = llsd::map("ASSET_ID", new_asset_id); + LLNotificationsUtil::add("MaterialCreated", params); + }); + + const LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + std::string agent_url(region->getCapability("UpdateSettingsAgentInventory")); + if (agent_url.empty()) + { + LL_ERRS() << "missing required agent inventory cap url" << LL_ENDL; + } + LLViewerAssetUpload::EnqueueInventoryUpload(agent_url, uploadInfo); + } + }) + ); + } -- cgit v1.2.3 From 356817d2fc398b6aafb4b239175957b2a0a0115c Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 6 May 2022 10:02:47 -0700 Subject: SL-17198 fixes to get material asset serialization working better --- indra/newview/llpanelface.cpp | 114 ++++++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 53 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 90895d0eec..cb81cad1b5 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2588,7 +2588,7 @@ void LLPanelFace::onSaveMaterial(void* userdata) tid.generate(); // timestamp-based randomization + uniquification LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - renderMaterialToLLSD(&material_data, new_asset_id, userdata); + material_data["material"] = renderMaterialToLLSD(new_asset_id, userdata); std::stringstream output; LLSDSerialize::toNotation(material_data, output); @@ -2636,67 +2636,75 @@ void LLPanelFace::onSaveMaterial(void* userdata) // Fill an LLSD with data describing the current face's texture settings // TODO 2022-05 FUBAR there are both colliding and different data in LLPanelFace vs the TE. Also, neither one has the diffuse tex settings. // -void LLPanelFace::renderMaterialToLLSD(LLSD* sd, LLUUID uuid, void* userdata) +LLSD LLPanelFace::renderMaterialToLLSD(LLUUID uuid, void* userdata) { llassert(userdata != nullptr); - sd->insert("RenderMaterialUUID", LLSD(uuid)); - - /* pf stuff is probably useless - // pull data from the LLPanelFace - LLPanelFace* instance = static_cast(userdata); - sd->insert("pfNormalMap", LLSD(instance->getCurrentNormalMap())); - sd->insert("pfSpecularMap", LLSD(instance->getCurrentSpecularMap())); - sd->insert("pfShininess", LLSD(static_cast(instance->getCurrentShininess()))); - sd->insert("pfBumpiness", LLSD(static_cast(instance->getCurrentBumpiness()))); - sd->insert("pfAlphaMode", LLSD(static_cast(instance->getCurrentDiffuseAlphaMode()))); - sd->insert("pfAlphaCutoff", LLSD(static_cast(instance->getCurrentAlphaMaskCutoff()))); - sd->insert("pfEnvIntensity", LLSD(static_cast(instance->getCurrentEnvIntensity()))); - sd->insert("pfGlossiness", LLSD(static_cast(instance->getCurrentGlossiness()))); - sd->insert("pfNormalRotation", LLSD(instance->getCurrentBumpyRot())); - sd->insert("pfNormalScaleU", LLSD(instance->getCurrentBumpyScaleU())); - sd->insert("pfNormalScaleV", LLSD(instance->getCurrentBumpyScaleV())); - sd->insert("pfNormalOffsetU", LLSD(instance->getCurrentBumpyOffsetU())); - sd->insert("pfNormalOffsetV", LLSD(instance->getCurrentBumpyOffsetV())); - sd->insert("pfSpecularRotation", LLSD(instance->getCurrentShinyRot())); - sd->insert("pfSpecularScaleU", LLSD(instance->getCurrentShinyScaleU())); - sd->insert("pfSpecularScaleV", LLSD(instance->getCurrentShinyScaleV())); - sd->insert("pfSpecularOffsetU", LLSD(instance->getCurrentShinyOffsetU())); - sd->insert("pfSpecularOffsetV", LLSD(instance->getCurrentShinyOffsetV())); - sd->insert("pfMaterialID", LLSD(instance->getCurrentMaterialID())); - */ + LLSD sd; + + sd.insert("RenderMaterialUUID", LLSD(uuid)); // now pull same data from the selected TE (same but different. W T F?) LLMaterialPtr mat = nullptr; bool ident; // ? LLSelectedTEMaterial::getCurrent(mat, ident); - sd->insert("teMaterialID", LLSD(mat->getMaterialID())); - - sd->insert("teNormalMap", LLSD(mat->getNormalID())); - sd->insert("teNormalOffsetX", LLSD(mat->getNormalOffsetX())); - sd->insert("teNormalOffsetY", LLSD(mat->getNormalOffsetY())); - sd->insert("teNormalRepeatX", LLSD(mat->getNormalRepeatX())); - sd->insert("teNormalRepeatY", LLSD(mat->getNormalRepeatY())); - sd->insert("teNormalRotation", LLSD(mat->getNormalRotation())); - - sd->insert("teSpecularMap", LLSD(mat->getSpecularID())); - LLColor4U color = mat->getSpecularLightColor(); - sd->insert("teSpecularColorR", LLSD(static_cast(color.mV[0]))); - sd->insert("teSpecularColorG", LLSD(static_cast(color.mV[1]))); - sd->insert("teSpecularColorB", LLSD(static_cast(color.mV[2]))); - sd->insert("teSpecularColorA", LLSD(static_cast(color.mV[3]))); - sd->insert("teSpecularExponent", LLSD(static_cast(mat->getSpecularLightExponent()))); - sd->insert("teSpecularOffsetX", LLSD(mat->getSpecularOffsetX())); - sd->insert("teSpecularOffsetY", LLSD(mat->getSpecularOffsetY())); - sd->insert("teSpecularRepeatX", LLSD(mat->getSpecularRepeatX())); - sd->insert("teSpecularRepeatY", LLSD(mat->getSpecularRepeatY())); - sd->insert("teSpecularRotation", LLSD(mat->getSpecularRotation())); - - sd->insert("teAlphaMode", LLSD(static_cast(mat->getDiffuseAlphaMode()))); - sd->insert("teAlphaCutoff", LLSD(static_cast(mat->getAlphaMaskCutoff()))); - sd->insert("teEnvIntensity", LLSD(static_cast(mat->getEnvironmentIntensity()))); - sd->insert("teShaderMask", LLSD(static_cast(mat->getShaderMask()))); + if (mat) + { + sd.insert("teMaterialID", LLSD(mat->getMaterialID())); + + sd.insert("teNormalMap", LLSD(mat->getNormalID())); + sd.insert("teNormalOffsetX", LLSD(mat->getNormalOffsetX())); + sd.insert("teNormalOffsetY", LLSD(mat->getNormalOffsetY())); + sd.insert("teNormalRepeatX", LLSD(mat->getNormalRepeatX())); + sd.insert("teNormalRepeatY", LLSD(mat->getNormalRepeatY())); + sd.insert("teNormalRotation", LLSD(mat->getNormalRotation())); + + sd.insert("teSpecularMap", LLSD(mat->getSpecularID())); + LLColor4U color = mat->getSpecularLightColor(); + + sd.insert("teSpecularColorR", LLSD(static_cast(color.mV[0]))); + sd.insert("teSpecularColorG", LLSD(static_cast(color.mV[1]))); + sd.insert("teSpecularColorB", LLSD(static_cast(color.mV[2]))); + sd.insert("teSpecularColorA", LLSD(static_cast(color.mV[3]))); + sd.insert("teSpecularExponent", LLSD(static_cast(mat->getSpecularLightExponent()))); + sd.insert("teSpecularOffsetX", LLSD(mat->getSpecularOffsetX())); + sd.insert("teSpecularOffsetY", LLSD(mat->getSpecularOffsetY())); + sd.insert("teSpecularRepeatX", LLSD(mat->getSpecularRepeatX())); + sd.insert("teSpecularRepeatY", LLSD(mat->getSpecularRepeatY())); + sd.insert("teSpecularRotation", LLSD(mat->getSpecularRotation())); + + sd.insert("teAlphaMode", LLSD(static_cast(mat->getDiffuseAlphaMode()))); + sd.insert("teAlphaCutoff", LLSD(static_cast(mat->getAlphaMaskCutoff()))); + sd.insert("teEnvIntensity", LLSD(static_cast(mat->getEnvironmentIntensity()))); + sd.insert("teShaderMask", LLSD(static_cast(mat->getShaderMask()))); + } + else + { + // pull data from the LLPanelFace + LLPanelFace* instance = static_cast(userdata); + sd.insert("pfNormalMap", LLSD(instance->getCurrentNormalMap())); + sd.insert("pfSpecularMap", LLSD(instance->getCurrentSpecularMap())); + sd.insert("pfShininess", LLSD(static_cast(instance->getCurrentShininess()))); + sd.insert("pfBumpiness", LLSD(static_cast(instance->getCurrentBumpiness()))); + sd.insert("pfAlphaMode", LLSD(static_cast(instance->getCurrentDiffuseAlphaMode()))); + sd.insert("pfAlphaCutoff", LLSD(static_cast(instance->getCurrentAlphaMaskCutoff()))); + sd.insert("pfEnvIntensity", LLSD(static_cast(instance->getCurrentEnvIntensity()))); + sd.insert("pfGlossiness", LLSD(static_cast(instance->getCurrentGlossiness()))); + sd.insert("pfNormalRotation", LLSD(instance->getCurrentBumpyRot())); + sd.insert("pfNormalScaleU", LLSD(instance->getCurrentBumpyScaleU())); + sd.insert("pfNormalScaleV", LLSD(instance->getCurrentBumpyScaleV())); + sd.insert("pfNormalOffsetU", LLSD(instance->getCurrentBumpyOffsetU())); + sd.insert("pfNormalOffsetV", LLSD(instance->getCurrentBumpyOffsetV())); + sd.insert("pfSpecularRotation", LLSD(instance->getCurrentShinyRot())); + sd.insert("pfSpecularScaleU", LLSD(instance->getCurrentShinyScaleU())); + sd.insert("pfSpecularScaleV", LLSD(instance->getCurrentShinyScaleV())); + sd.insert("pfSpecularOffsetU", LLSD(instance->getCurrentShinyOffsetU())); + sd.insert("pfSpecularOffsetV", LLSD(instance->getCurrentShinyOffsetV())); + sd.insert("pfMaterialID", LLSD(instance->getCurrentMaterialID())); + } + + return sd; } // Take the individual texture settings from the material and apply to current face & TE -- cgit v1.2.3 From 6095a7d3105ec75c6df55383f1f919bff7bbfb71 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 6 May 2022 10:05:23 -0700 Subject: SL-17198 more fixes to get material asset serialization working better --- indra/newview/llpanelface.cpp | 62 ++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 27 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index cb81cad1b5..ad3742157f 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2716,43 +2716,51 @@ void LLPanelFace::applyMaterialUUID(LLUUID uuid, void* userdata) LLFileSystem material_file(uuid, LLAssetType::AT_MATERIAL, LLFileSystem::READ); S32 bufsize = material_file.getSize(); llassert(bufsize > 0); - U8* buffer = new U8(bufsize); - material_file.read(buffer, bufsize); - LLSD* matSD = (LLSD*) buffer; // static_cast complains here (?) + std::vector buffer(bufsize); + material_file.read(&buffer[0], bufsize); + std::istringstream input(std::string(buffer.begin(), buffer.end())); // TODO - extend LLFileSystem to expose iostream interface + LLSD matSD; - llassert(uuid == matSD->get("MaterialUUID").asUUID()); // if not, whoo boy + LLSDSerialize::fromNotation(matSD, input, bufsize); + + LL_INFOS() << "dump matSD: " << matSD << LL_ENDL; + + // strip off the versioning wrapper for now + matSD = matSD["material"]; + + // wrong, oops. llassert(uuid == matSD.get("RenderMaterialUUID").asUUID()); // if not, whoo boy LLMaterialPtr mat = nullptr; bool ident; // ? LLSelectedTEMaterial::getCurrent(mat, ident); - mat->setMaterialID(matSD->get("teMaterialID").asUUID()); + mat->setMaterialID(matSD.get("teMaterialID").asUUID()); - mat->setNormalID(matSD->get("teNormalMap").asUUID()); - mat->setNormalOffsetX(matSD->get("teNormalOffsetX").asReal()); - mat->setNormalOffsetY(matSD->get("teNormalOffsetY").asReal()); - mat->setNormalRepeatX(matSD->get("teNormalRepeatX").asReal()); - mat->setNormalRepeatY(matSD->get("teNormalRepeatY").asReal()); - mat->setNormalRotation(matSD->get("teNormalRotation").asReal()); + mat->setNormalID(matSD.get("teNormalMap").asUUID()); + mat->setNormalOffsetX(matSD.get("teNormalOffsetX").asReal()); + mat->setNormalOffsetY(matSD.get("teNormalOffsetY").asReal()); + mat->setNormalRepeatX(matSD.get("teNormalRepeatX").asReal()); + mat->setNormalRepeatY(matSD.get("teNormalRepeatY").asReal()); + mat->setNormalRotation(matSD.get("teNormalRotation").asReal()); - mat->setSpecularID(matSD->get("teSpecularMap").asUUID()); + mat->setSpecularID(matSD.get("teSpecularMap").asUUID()); LLColor4U color; - color.mV[0] = static_cast(matSD->get("teSecularColorR").asInteger()); - color.mV[1] = static_cast(matSD->get("teSecularColorG").asInteger()); - color.mV[2] = static_cast(matSD->get("teSecularColorB").asInteger()); - color.mV[3] = static_cast(matSD->get("teSecularColorA").asInteger()); + color.mV[0] = static_cast(matSD.get("teSecularColorR").asInteger()); + color.mV[1] = static_cast(matSD.get("teSecularColorG").asInteger()); + color.mV[2] = static_cast(matSD.get("teSecularColorB").asInteger()); + color.mV[3] = static_cast(matSD.get("teSecularColorA").asInteger()); mat->setSpecularLightColor(color); - mat->setSpecularLightExponent(static_cast(matSD->get("teSpecularExponent").asInteger())); - mat->setSpecularOffsetX(matSD->get("teSpecularOffsetX").asReal()); - mat->setSpecularOffsetY(matSD->get("teSpecularOffsetY").asReal()); - mat->setSpecularRepeatX(matSD->get("teSpecularRepeatX").asReal()); - mat->setSpecularRepeatY(matSD->get("teSpecularRepeatY").asReal()); - mat->setSpecularRotation(matSD->get("teSpecularRotation").asReal()); - - mat->setDiffuseAlphaMode(static_cast(matSD->get("teAlphaMode").asInteger())); - mat->setAlphaMaskCutoff(static_cast(matSD->get("teAlphaCutoff").asInteger())); - mat->setEnvironmentIntensity(static_cast(matSD->get("teEnvIntensity").asInteger())); - //mat->setShaderMask(static_cast(matSD->get(teShaderMask").asInteger()); + mat->setSpecularLightExponent(static_cast(matSD.get("teSpecularExponent").asInteger())); + mat->setSpecularOffsetX(matSD.get("teSpecularOffsetX").asReal()); + mat->setSpecularOffsetY(matSD.get("teSpecularOffsetY").asReal()); + mat->setSpecularRepeatX(matSD.get("teSpecularRepeatX").asReal()); + mat->setSpecularRepeatY(matSD.get("teSpecularRepeatY").asReal()); + mat->setSpecularRotation(matSD.get("teSpecularRotation").asReal()); + + mat->setDiffuseAlphaMode(static_cast(matSD.get("teAlphaMode").asInteger())); + mat->setAlphaMaskCutoff(static_cast(matSD.get("teAlphaCutoff").asInteger())); + mat->setEnvironmentIntensity(static_cast(matSD.get("teEnvIntensity").asInteger())); + //mat->setShaderMask(static_cast(matSD.get(teShaderMask").asInteger()); } -- cgit v1.2.3 From 03d012d46cbcc6d67f6241ce66649e92688f246f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 30 Aug 2022 14:42:04 -0500 Subject: SL-18038 Remove placeholder "save as material" button --- indra/newview/llpanelface.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index ec67a9cdc6..865529eb8f 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -178,7 +178,6 @@ BOOL LLPanelFace::postBuild() childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); - childSetAction("button save material", &LLPanelFace::onSaveMaterial, this); LLTextureCtrl* mTextureCtrl; LLTextureCtrl* mShinyTextureCtrl; @@ -1444,12 +1443,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // enable this UI box if a single face is selected. BOOL is_single_face = !LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected(); - childSetEnabled("button save material", static_cast(is_single_face)); childSetEnabled("materialID", static_cast(is_single_face)); // doesn't work - why? - // TODO: 2022-04 conflicts with media button placement. hide the button if applying media - // i.e. childSetVisible("button save material", !applying_media); - if (material && editable) { LL_DEBUGS("Materials") << material->asLLSD() << LL_ENDL; -- cgit v1.2.3 From 20dc30450cb50d08e6c7d23613a6a59aae1a6a16 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 31 Aug 2022 19:45:23 +0300 Subject: SL-17999 PBR material in tool's texture tab --- indra/newview/llpanelface.cpp | 467 +++++++++++++++++++----------------------- 1 file changed, 212 insertions(+), 255 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 865529eb8f..795a93c3fe 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -93,13 +93,15 @@ // Must match the commbobox definitions in panel_tools_texture.xml // const S32 MATMEDIA_MATERIAL = 0; // Material -const S32 MATMEDIA_MEDIA = 1; // Media +const S32 MATMEDIA_PBR = 1; // PBR +const S32 MATMEDIA_MEDIA = 2; // Media const S32 MATTYPE_DIFFUSE = 0; // Diffuse material texture const S32 MATTYPE_NORMAL = 1; // Normal map const S32 MATTYPE_SPECULAR = 2; // Specular map const S32 ALPHAMODE_MASK = 2; // Alpha masking mode const S32 BUMPY_TEXTURE = 18; // use supplied normal map const S32 SHINY_TEXTURE = 4; // use supplied specular map +const S32 PBRTYPE_ALBEDO = 0; // PBR ALBEDO BOOST_STATIC_ASSERT(MATTYPE_DIFFUSE == LLRender::DIFFUSE_MAP && MATTYPE_NORMAL == LLRender::NORMAL_MAP && MATTYPE_SPECULAR == LLRender::SPECULAR_MAP); @@ -142,7 +144,6 @@ F32 LLPanelFace::getCurrentShinyScaleU() { return getChild("shinySca F32 LLPanelFace::getCurrentShinyScaleV() { return getChild("shinyScaleV")->getValue().asReal(); } F32 LLPanelFace::getCurrentShinyOffsetU() { return getChild("shinyOffsetU")->getValue().asReal(); } F32 LLPanelFace::getCurrentShinyOffsetV() { return getChild("shinyOffsetV")->getValue().asReal(); } -LLUUID LLPanelFace::getCurrentMaterialID() { return getChild("materialID")->getValue().asUUID(); } // // Methods @@ -174,7 +175,6 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("glossiness",&LLPanelFace::onCommitMaterialGloss, this); childSetCommitCallback("environment",&LLPanelFace::onCommitMaterialEnv, this); childSetCommitCallback("maskcutoff",&LLPanelFace::onCommitMaterialMaskCutoff, this); - childSetCommitCallback("materialID", &LLPanelFace::onCommitMaterialID, this); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); @@ -197,6 +197,24 @@ BOOL LLPanelFace::postBuild() setMouseOpaque(FALSE); + LLTextureCtrl* pbr_ctrl = getChild("pbr_control"); + if (pbr_ctrl) + { + pbr_ctrl->setDefaultImageAssetID(LLUUID(gSavedSettings.getString("DefaultObjectTexture"))); + 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)); + pbr_ctrl->setDragCallback(boost::bind(&LLPanelFace::onDragPbr, this, _2)); + pbr_ctrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onPbrSelectionChanged, this, _1)); + pbr_ctrl->setOnCloseCallback(boost::bind(&LLPanelFace::onCloseTexturePicker, this, _2)); + + pbr_ctrl->setFollowsTop(); + pbr_ctrl->setFollowsLeft(); + pbr_ctrl->setImmediateFilterPermMask(PERM_NONE); + pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); + pbr_ctrl->setBakeTextureEnabled(false); + } + mTextureCtrl = getChild("texture control"); if(mTextureCtrl) { @@ -314,6 +332,13 @@ BOOL LLPanelFace::postBuild() radio_mat_type->selectNthItem(MATTYPE_DIFFUSE); } + LLRadioGroup* radio_pbr_type = getChild("radio_pbr_type"); + if (radio_mat_type) + { + radio_pbr_type->setCommitCallback(LLPanelFace::onCommitPbrType, this); + radio_pbr_type->selectNthItem(PBRTYPE_ALBEDO); + } + mCtrlGlow = getChild("glow"); if(mCtrlGlow) { @@ -852,7 +877,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) { LL_WARNS() << "failed getChild for 'combobox matmedia'" << LL_ENDL; } - getChildView("combobox matmedia")->setEnabled(editable); + combobox_matmedia->setEnabled(editable); LLRadioGroup* radio_mat_type = getChild("radio_material_type"); if(radio_mat_type) @@ -869,14 +894,31 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } getChildView("radio_material_type")->setEnabled(editable); + getChildView("radio_pbr_type")->setEnabled(editable); getChildView("checkbox_sync_settings")->setEnabled(editable); childSetValue("checkbox_sync_settings", gSavedSettings.getBOOL("SyncMaterialSettings")); updateVisibility(); bool identical = true; // true because it is anded below - bool identical_diffuse = false; - bool identical_norm = false; - bool identical_spec = false; + bool identical_diffuse = false; + bool identical_norm = false; + bool identical_spec = false; + + // pbr material + bool is_pbr_material = false; + LLTextureCtrl* pbr_ctrl = getChild("pbr_control"); + if (pbr_ctrl) + { + LLUUID pbr_id; + bool identical_pbr; + LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr); + identical &= identical_pbr; + + pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); + pbr_ctrl->setEnabled(editable); + pbr_ctrl->setImageAssetID(pbr_id); + is_pbr_material = pbr_id.notNull(); + } LLTextureCtrl* texture_ctrl = getChild("texture control"); LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); @@ -888,7 +930,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // Color swatch { - getChildView("color label")->setEnabled(editable); + getChildView("color label")->setEnabled(editable && !is_pbr_material); } LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch"); @@ -903,17 +945,17 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mColorSwatch->setOriginal(color); mColorSwatch->set(color, force_set_values || (prev_color != color) || !editable); - mColorSwatch->setValid(editable); - mColorSwatch->setEnabled( editable ); + mColorSwatch->setValid(editable && !is_pbr_material); + mColorSwatch->setEnabled(editable && !is_pbr_material); mColorSwatch->setCanApplyImmediately( editable ); } // Color transparency - getChildView("color trans")->setEnabled(editable); + getChildView("color trans")->setEnabled(editable && !is_pbr_material); F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; getChild("ColorTrans")->setValue(editable ? transparency : 0); - getChildView("ColorTrans")->setEnabled(editable); + getChildView("ColorTrans")->setEnabled(editable && !is_pbr_material); // Specular map LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); @@ -958,7 +1000,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) U8 bumpy = 0; // Bumpy - { + { bool identical_bumpy = false; LLSelectedTE::getBumpmap(bumpy,identical_bumpy); @@ -979,7 +1021,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("combobox bumpiness")->setEnabled(editable); getChild("combobox bumpiness")->setTentative(!identical_bumpy); getChildView("label bumpiness")->setEnabled(editable); - } + } // Texture { @@ -1333,8 +1375,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTE::getGlow(glow,identical_glow); getChild("glow")->setValue(glow); getChild("glow")->setTentative(!identical_glow); - getChildView("glow")->setEnabled(editable); - getChildView("glow label")->setEnabled(editable); + getChildView("glow")->setEnabled(editable && !is_pbr_material); + getChildView("glow label")->setEnabled(editable && !is_pbr_material); } { @@ -1441,10 +1483,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLMaterialPtr material; LLSelectedTEMaterial::getCurrent(material, identical); - // enable this UI box if a single face is selected. - BOOL is_single_face = !LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected(); - childSetEnabled("materialID", static_cast(is_single_face)); // doesn't work - why? - if (material && editable) { LL_DEBUGS("Materials") << material->asLLSD() << LL_ENDL; @@ -1557,8 +1595,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) calcp->setVar(LLCalc::TEX_ROTATION, childGetValue("TexRot").asReal()); calcp->setVar(LLCalc::TEX_TRANSPARENCY, childGetValue("ColorTrans").asReal()); calcp->setVar(LLCalc::TEX_GLOW, childGetValue("glow").asReal()); - - getChildView("materialID")->setEnabled(editable); } else { @@ -1566,6 +1602,12 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) clearCtrls(); // Disable non-UICtrls + LLTextureCtrl* pbr_ctrl = getChild("pbr_control"); + if (pbr_ctrl) + { + pbr_ctrl->setImageAssetID(LLUUID::null); + pbr_ctrl->setEnabled(FALSE); + } LLTextureCtrl* texture_ctrl = getChild("texture control"); if(texture_ctrl) { @@ -1701,10 +1743,12 @@ void LLPanelFace::updateVisibility() U32 materials_media = combo_matmedia->getCurrentIndex(); U32 material_type = radio_mat_type->getSelectedIndex(); bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); - bool show_texture = (show_media || ((material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled())); - bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL) && combo_matmedia->getEnabled(); - bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled(); - getChildView("radio_material_type")->setVisible(!show_media); + bool show_material = materials_media == MATMEDIA_MATERIAL; + bool show_pbr = materials_media == MATMEDIA_PBR; + bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled())); + bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && combo_matmedia->getEnabled(); + bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled(); + getChildView("radio_material_type")->setVisible(show_texture); // Media controls getChildView("media_info")->setVisible(show_media); @@ -1713,20 +1757,20 @@ void LLPanelFace::updateVisibility() getChildView("button align")->setVisible(show_media); // Diffuse texture controls - getChildView("texture control")->setVisible(show_texture && !show_media); - getChildView("label alphamode")->setVisible(show_texture && !show_media); - getChildView("combobox alphamode")->setVisible(show_texture && !show_media); + getChildView("texture control")->setVisible(show_texture && show_material); + getChildView("label alphamode")->setVisible(show_texture && (show_material || show_pbr)); + getChildView("combobox alphamode")->setVisible(show_texture && (show_material || show_pbr)); getChildView("label maskcutoff")->setVisible(false); getChildView("maskcutoff")->setVisible(false); - if (show_texture && !show_media) + if (show_texture && show_material) { updateAlphaControls(); } - getChildView("TexScaleU")->setVisible(show_texture); - getChildView("TexScaleV")->setVisible(show_texture); - getChildView("TexRot")->setVisible(show_texture); - getChildView("TexOffsetU")->setVisible(show_texture); - getChildView("TexOffsetV")->setVisible(show_texture); + getChildView("TexScaleU")->setVisible(show_texture || show_pbr); + getChildView("TexScaleV")->setVisible(show_texture || show_pbr); + getChildView("TexRot")->setVisible(show_texture || show_pbr); + getChildView("TexOffsetU")->setVisible(show_texture || show_pbr); + getChildView("TexOffsetV")->setVisible(show_texture || show_pbr); // Specular map controls getChildView("shinytexture control")->setVisible(show_shininess); @@ -1762,7 +1806,9 @@ void LLPanelFace::updateVisibility() getChildView("bumpyOffsetU")->setVisible(show_bumpiness); getChildView("bumpyOffsetV")->setVisible(show_bumpiness); - + // PBR controls + getChildView("pbr_control")->setVisible(show_pbr); + getChildView("radio_pbr_type")->setVisible(show_pbr); } // static @@ -1777,6 +1823,16 @@ void LLPanelFace::onCommitMaterialType(LLUICtrl* ctrl, void* userdata) self->updateUI(); } +// static +void LLPanelFace::onCommitPbrType(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*)userdata; + // Force to default states to side-step problems with menu contents + // and generally reflecting old state when switching tabs or objects + // + self->updateUI(); +} + // static void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata) { @@ -1843,8 +1899,8 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh LLRadioGroup* radio_mat_type = getChild("radio_material_type"); U32 materials_media = combo_matmedia->getCurrentIndex(); U32 material_type = radio_mat_type->getSelectedIndex(); - bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); - bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled(); + bool show_material = (materials_media == MATMEDIA_MATERIAL); + bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled(); U32 shiny_value = comboShiny->getCurrentIndex(); bool show_shinyctrls = (shiny_value == SHINY_TEXTURE) && show_shininess; // Use texture getChildView("label glossiness")->setVisible(show_shinyctrls); @@ -1961,22 +2017,82 @@ void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata) self->sendGlow(); } +// static +BOOL LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) +{ + BOOL accept = TRUE; + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) + { + LLSelectNode* node = *iter; + LLViewerObject* obj = node->getObject(); + if (!LLToolDragAndDrop::isInventoryDropAcceptable(obj, item)) + { + accept = FALSE; + break; + } + } + return accept; +} + +void LLPanelFace::onCommitPbr(const LLSD& data) +{ + LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); + if (!pbr_ctrl) return; + if (!pbr_ctrl->getTentative()) + { + // we grab the item id first, because we want to do a + // permissions check in the selection manager. ARGH! + LLUUID id = pbr_ctrl->getImageItemID(); + if (id.isNull()) + { + id = pbr_ctrl->getImageAssetID(); + } + LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id); + } +} + +void LLPanelFace::onCancelPbr(const LLSD& data) +{ + LLSelectMgr::getInstance()->selectionRevertGLTFMaterials(); +} + +void LLPanelFace::onSelectPbr(const LLSD& data) +{ + LLSelectMgr::getInstance()->saveSelectedObjectTextures(); + + LLTextureCtrl* pbr_ctrl = getChild("pbr_control"); + if (!pbr_ctrl) return; + if (!pbr_ctrl->getTentative()) + { + // we grab the item id first, because we want to do a + // permissions check in the selection manager. ARGH! + LLUUID id = pbr_ctrl->getImageItemID(); + if (id.isNull()) + { + id = pbr_ctrl->getImageAssetID(); + } + LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id); + LLSelectedTEMaterial::setMaterialID(this, id); + } +} + // static BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) { - BOOL accept = TRUE; - for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); - iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) - { - LLSelectNode* node = *iter; - LLViewerObject* obj = node->getObject(); - if(!LLToolDragAndDrop::isInventoryDropAcceptable(obj, item)) - { - accept = FALSE; - break; - } - } - return accept; + BOOL accept = TRUE; + for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) + { + LLSelectNode* node = *iter; + LLViewerObject* obj = node->getObject(); + if (!LLToolDragAndDrop::isInventoryDropAcceptable(obj, item)) + { + accept = FALSE; + break; + } + } + return accept; } void LLPanelFace::onCommitTexture( const LLSD& data ) @@ -2354,17 +2470,6 @@ void LLPanelFace::onCommitMaterialMaskCutoff(LLUICtrl* ctrl, void* userdata) LLSelectedTEMaterial::setAlphaMaskCutoff(self,self->getCurrentAlphaMaskCutoff()); } -//static -void LLPanelFace::onCommitMaterialID(LLUICtrl* ctrl, void* userdata) -{ - LLPanelFace* self = static_cast(userdata); - LLUUID matID = self->getCurrentMaterialID(); - LLSelectedTEMaterial::setMaterialID(self, matID); - - // Temporary demo hack - replace the TE entries with those from the Material's LLSD - applyMaterialUUID(matID, userdata); -} - // static void LLPanelFace::onCommitTextureInfo( LLUICtrl* ctrl, void* userdata ) { @@ -3474,6 +3579,39 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) } } +void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) +{ + LLTextureCtrl* pbr_ctrl = getChild("pbr_control"); + if (pbr_ctrl) + { + LLUUID obj_owner_id; + std::string obj_owner_name; + LLSelectMgr::instance().selectGetOwner(obj_owner_id, obj_owner_name); + + LLSaleInfo sale_info; + LLSelectMgr::instance().selectGetSaleInfo(sale_info); + + bool can_copy = itemp->getPermissions().allowCopyBy(gAgentID); // do we have perm to copy this texture? + bool can_transfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID); // do we have perm to transfer this texture? + bool is_object_owner = gAgentID == obj_owner_id; // does object for which we are going to apply texture belong to the agent? + bool not_for_sale = !sale_info.isForSale(); // is object for which we are going to apply texture not for sale? + + if (can_copy && can_transfer) + { + pbr_ctrl->setCanApply(true, true); + return; + } + + // if texture has (no-transfer) attribute it can be applied only for object which we own and is not for sale + pbr_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale); + + if (gSavedSettings.getBOOL("TextureLivePreview")) + { + LLNotificationsUtil::add("LivePreviewUnavailable"); + } + } +} + bool LLPanelFace::isIdenticalPlanarTexgen() { LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; @@ -3553,6 +3691,18 @@ void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical) identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); } +void LLPanelFace::LLSelectedTE::getPbrMaterialId(LLUUID& id, bool& identical) +{ + struct LLSelectedTEGetmatId : public LLSelectedTEGetFunctor + { + LLUUID get(LLViewerObject* object, S32 te_index) + { + return object->getRenderMaterialID(te_index); + } + } func; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, id); +} + void LLPanelFace::LLSelectedTEMaterial::getCurrent(LLMaterialPtr& material_ptr, bool& identical_material) { struct MaterialFunctor : public LLSelectedTEGetFunctor @@ -3692,196 +3842,3 @@ void LLPanelFace::LLSelectedTE::getMaxDiffuseRepeats(F32& repeats, bool& identic identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_diff_repeats_func, repeats ); } - -void LLPanelFace::onSaveMaterial(void* userdata) -{ - // DRTVWR-559, Q&D material picker - save to inventory goes here - LL_DEBUGS("Material") << "saving render material to inventory" << LL_ENDL; - - std::string name = "New Material"; - - LLSD material_data = llsd::map( - "version", "1", - "material", LLSD::emptyMap() - ); - - // gen a new uuid for this asset - LLTransactionID tid; - tid.generate(); // timestamp-based randomization + uniquification - LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - - material_data["material"] = renderMaterialToLLSD(new_asset_id, userdata); - std::stringstream output; - LLSDSerialize::toNotation(material_data, output); - - //S32 expected_upload_cost = 0;// LLAgentBenefitsMgr::current().getTextureUploadCost(); - - std::string res_name = name; - std::string res_desc = "Saved Material"; - //LLFolderType::EType folder_type = LLFolderType::FT_MATERIAL; - //LLInventoryType::EType inv_type = LLInventoryType::IT_MATERIAL; - U32 next_owner_perm = LLPermissions::DEFAULT.getMaskNextOwner(); - - LLUUID parent = gInventory.findCategoryUUIDForType(LLFolderType::FT_MATERIAL); - const U8 subtype = NO_INV_SUBTYPE; // TODO maybe use AT_SETTINGS and LLSettingsType::ST_MATERIAL ? - - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), parent, tid, res_name, res_desc, - LLAssetType::AT_MATERIAL, LLInventoryType::IT_MATERIAL, subtype, next_owner_perm, - new LLBoostFuncInventoryCallback([output=output.str()](LLUUID const & inv_item_id){ - // from reference in LLSettingsVOBase::createInventoryItem()/updateInventoryItem() - LLResourceUploadInfo::ptr_t uploadInfo = - std::make_shared( - inv_item_id, - LLAssetType::AT_SETTINGS, // TODO switch to AT_MATERIAL - output, - [](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response) { - LL_INFOS("Material") << "inventory item uploaded. item: " << item_id << " asset: " << new_asset_id << " new_item_id: " << new_item_id << " response: " << response << LL_ENDL; - LLSD params = llsd::map("ASSET_ID", new_asset_id); - LLNotificationsUtil::add("MaterialCreated", params); - }); - - const LLViewerRegion* region = gAgent.getRegion(); - if (region) - { - std::string agent_url(region->getCapability("UpdateSettingsAgentInventory")); - if (agent_url.empty()) - { - LL_ERRS() << "missing required agent inventory cap url" << LL_ENDL; - } - LLViewerAssetUpload::EnqueueInventoryUpload(agent_url, uploadInfo); - } - }) - ); - -} - -// Fill an LLSD with data describing the current face's texture settings -// TODO 2022-05 FUBAR there are both colliding and different data in LLPanelFace vs the TE. Also, neither one has the diffuse tex settings. -// -LLSD LLPanelFace::renderMaterialToLLSD(LLUUID uuid, void* userdata) -{ - llassert(userdata != nullptr); - - LLSD sd; - - sd.insert("RenderMaterialUUID", LLSD(uuid)); - - // now pull same data from the selected TE (same but different. W T F?) - LLMaterialPtr mat = nullptr; - bool ident; // ? - LLSelectedTEMaterial::getCurrent(mat, ident); - - if (mat) - { - sd.insert("teMaterialID", LLSD(mat->getMaterialID())); - - sd.insert("teNormalMap", LLSD(mat->getNormalID())); - sd.insert("teNormalOffsetX", LLSD(mat->getNormalOffsetX())); - sd.insert("teNormalOffsetY", LLSD(mat->getNormalOffsetY())); - sd.insert("teNormalRepeatX", LLSD(mat->getNormalRepeatX())); - sd.insert("teNormalRepeatY", LLSD(mat->getNormalRepeatY())); - sd.insert("teNormalRotation", LLSD(mat->getNormalRotation())); - - sd.insert("teSpecularMap", LLSD(mat->getSpecularID())); - LLColor4U color = mat->getSpecularLightColor(); - - sd.insert("teSpecularColorR", LLSD(static_cast(color.mV[0]))); - sd.insert("teSpecularColorG", LLSD(static_cast(color.mV[1]))); - sd.insert("teSpecularColorB", LLSD(static_cast(color.mV[2]))); - sd.insert("teSpecularColorA", LLSD(static_cast(color.mV[3]))); - sd.insert("teSpecularExponent", LLSD(static_cast(mat->getSpecularLightExponent()))); - sd.insert("teSpecularOffsetX", LLSD(mat->getSpecularOffsetX())); - sd.insert("teSpecularOffsetY", LLSD(mat->getSpecularOffsetY())); - sd.insert("teSpecularRepeatX", LLSD(mat->getSpecularRepeatX())); - sd.insert("teSpecularRepeatY", LLSD(mat->getSpecularRepeatY())); - sd.insert("teSpecularRotation", LLSD(mat->getSpecularRotation())); - - sd.insert("teAlphaMode", LLSD(static_cast(mat->getDiffuseAlphaMode()))); - sd.insert("teAlphaCutoff", LLSD(static_cast(mat->getAlphaMaskCutoff()))); - sd.insert("teEnvIntensity", LLSD(static_cast(mat->getEnvironmentIntensity()))); - sd.insert("teShaderMask", LLSD(static_cast(mat->getShaderMask()))); - } - else - { - // pull data from the LLPanelFace - LLPanelFace* instance = static_cast(userdata); - sd.insert("pfNormalMap", LLSD(instance->getCurrentNormalMap())); - sd.insert("pfSpecularMap", LLSD(instance->getCurrentSpecularMap())); - sd.insert("pfShininess", LLSD(static_cast(instance->getCurrentShininess()))); - sd.insert("pfBumpiness", LLSD(static_cast(instance->getCurrentBumpiness()))); - sd.insert("pfAlphaMode", LLSD(static_cast(instance->getCurrentDiffuseAlphaMode()))); - sd.insert("pfAlphaCutoff", LLSD(static_cast(instance->getCurrentAlphaMaskCutoff()))); - sd.insert("pfEnvIntensity", LLSD(static_cast(instance->getCurrentEnvIntensity()))); - sd.insert("pfGlossiness", LLSD(static_cast(instance->getCurrentGlossiness()))); - sd.insert("pfNormalRotation", LLSD(instance->getCurrentBumpyRot())); - sd.insert("pfNormalScaleU", LLSD(instance->getCurrentBumpyScaleU())); - sd.insert("pfNormalScaleV", LLSD(instance->getCurrentBumpyScaleV())); - sd.insert("pfNormalOffsetU", LLSD(instance->getCurrentBumpyOffsetU())); - sd.insert("pfNormalOffsetV", LLSD(instance->getCurrentBumpyOffsetV())); - sd.insert("pfSpecularRotation", LLSD(instance->getCurrentShinyRot())); - sd.insert("pfSpecularScaleU", LLSD(instance->getCurrentShinyScaleU())); - sd.insert("pfSpecularScaleV", LLSD(instance->getCurrentShinyScaleV())); - sd.insert("pfSpecularOffsetU", LLSD(instance->getCurrentShinyOffsetU())); - sd.insert("pfSpecularOffsetV", LLSD(instance->getCurrentShinyOffsetV())); - sd.insert("pfMaterialID", LLSD(instance->getCurrentMaterialID())); - } - - return sd; -} - -// Take the individual texture settings from the material and apply to current face & TE -void LLPanelFace::applyMaterialUUID(LLUUID uuid, void* userdata) -{ - llassert(userdata != nullptr); - //LLPanelFace* instance = static_cast(userdata); - - LLFileSystem material_file(uuid, LLAssetType::AT_MATERIAL, LLFileSystem::READ); - S32 bufsize = material_file.getSize(); - llassert(bufsize > 0); - std::vector buffer(bufsize); - material_file.read(&buffer[0], bufsize); - std::istringstream input(std::string(buffer.begin(), buffer.end())); // TODO - extend LLFileSystem to expose iostream interface - LLSD matSD; - - LLSDSerialize::fromNotation(matSD, input, bufsize); - - LL_INFOS() << "dump matSD: " << matSD << LL_ENDL; - - // strip off the versioning wrapper for now - matSD = matSD["material"]; - - // wrong, oops. llassert(uuid == matSD.get("RenderMaterialUUID").asUUID()); // if not, whoo boy - - LLMaterialPtr mat = nullptr; - bool ident; // ? - LLSelectedTEMaterial::getCurrent(mat, ident); - - mat->setMaterialID(matSD.get("teMaterialID").asUUID()); - - mat->setNormalID(matSD.get("teNormalMap").asUUID()); - mat->setNormalOffsetX(matSD.get("teNormalOffsetX").asReal()); - mat->setNormalOffsetY(matSD.get("teNormalOffsetY").asReal()); - mat->setNormalRepeatX(matSD.get("teNormalRepeatX").asReal()); - mat->setNormalRepeatY(matSD.get("teNormalRepeatY").asReal()); - mat->setNormalRotation(matSD.get("teNormalRotation").asReal()); - - mat->setSpecularID(matSD.get("teSpecularMap").asUUID()); - LLColor4U color; - color.mV[0] = static_cast(matSD.get("teSecularColorR").asInteger()); - color.mV[1] = static_cast(matSD.get("teSecularColorG").asInteger()); - color.mV[2] = static_cast(matSD.get("teSecularColorB").asInteger()); - color.mV[3] = static_cast(matSD.get("teSecularColorA").asInteger()); - mat->setSpecularLightColor(color); - mat->setSpecularLightExponent(static_cast(matSD.get("teSpecularExponent").asInteger())); - mat->setSpecularOffsetX(matSD.get("teSpecularOffsetX").asReal()); - mat->setSpecularOffsetY(matSD.get("teSpecularOffsetY").asReal()); - mat->setSpecularRepeatX(matSD.get("teSpecularRepeatX").asReal()); - mat->setSpecularRepeatY(matSD.get("teSpecularRepeatY").asReal()); - mat->setSpecularRotation(matSD.get("teSpecularRotation").asReal()); - - mat->setDiffuseAlphaMode(static_cast(matSD.get("teAlphaMode").asInteger())); - mat->setAlphaMaskCutoff(static_cast(matSD.get("teAlphaCutoff").asInteger())); - mat->setEnvironmentIntensity(static_cast(matSD.get("teEnvIntensity").asInteger())); - //mat->setShaderMask(static_cast(matSD.get(teShaderMask").asInteger()); -} - -- cgit v1.2.3 From 116bd660b65cfad64c6f9635db165cff5b3eda36 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 31 Aug 2022 23:39:36 +0300 Subject: SL-17653 Finalized texure picker's local filtering --- indra/newview/llpanelface.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 795a93c3fe..9300b161f4 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -213,6 +213,7 @@ BOOL LLPanelFace::postBuild() pbr_ctrl->setImmediateFilterPermMask(PERM_NONE); pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); pbr_ctrl->setBakeTextureEnabled(false); + pbr_ctrl->setInventoryPickType(LLTextureCtrl::PICK_MATERIAL); } mTextureCtrl = getChild("texture control"); -- cgit v1.2.3 From bded34a8615a2adceb2eda2f2d85501a70990efe Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 2 Sep 2022 19:22:49 +0300 Subject: SL-17999 PBR should reuse texture possition channels from normal materials --- indra/newview/llpanelface.cpp | 278 ++++++++++++++++++++++++++---------------- 1 file changed, 171 insertions(+), 107 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9300b161f4..c205efb436 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -101,7 +101,9 @@ const S32 MATTYPE_SPECULAR = 2; // Specular map const S32 ALPHAMODE_MASK = 2; // Alpha masking mode const S32 BUMPY_TEXTURE = 18; // use supplied normal map const S32 SHINY_TEXTURE = 4; // use supplied specular map -const S32 PBRTYPE_ALBEDO = 0; // PBR ALBEDO +const S32 PBRTYPE_ALBEDO = 0; // PBR Albedo +const S32 PBRTYPE_NORMAL = 1; // PBR Normal +const S32 PBRTYPE_METALLIC = 2; // PBR Metallic BOOST_STATIC_ASSERT(MATTYPE_DIFFUSE == LLRender::DIFFUSE_MAP && MATTYPE_NORMAL == LLRender::NORMAL_MAP && MATTYPE_SPECULAR == LLRender::SPECULAR_MAP); @@ -867,35 +869,26 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("button align")->setEnabled(editable); LLComboBox* combobox_matmedia = getChild("combobox matmedia"); - if (combobox_matmedia) - { - if (combobox_matmedia->getCurrentIndex() < MATMEDIA_MATERIAL) - { - combobox_matmedia->selectNthItem(MATMEDIA_MATERIAL); - } - } - else - { - LL_WARNS() << "failed getChild for 'combobox matmedia'" << LL_ENDL; - } + if (combobox_matmedia->getCurrentIndex() < MATMEDIA_MATERIAL) + { + combobox_matmedia->selectNthItem(MATMEDIA_MATERIAL); + } combobox_matmedia->setEnabled(editable); LLRadioGroup* radio_mat_type = getChild("radio_material_type"); - if(radio_mat_type) - { - if (radio_mat_type->getSelectedIndex() < MATTYPE_DIFFUSE) - { - radio_mat_type->selectNthItem(MATTYPE_DIFFUSE); - } + if (radio_mat_type->getSelectedIndex() < MATTYPE_DIFFUSE) + { + radio_mat_type->selectNthItem(MATTYPE_DIFFUSE); + } + radio_mat_type->setEnabled(editable); - } - else - { - LL_WARNS("Materials") << "failed getChild for 'radio_material_type'" << LL_ENDL; - } + LLRadioGroup* radio_pbr_type = getChild("radio_pbr_type"); + if (radio_pbr_type->getSelectedIndex() < PBRTYPE_ALBEDO) + { + radio_pbr_type->selectNthItem(PBRTYPE_ALBEDO); + } + radio_pbr_type->setEnabled(editable); - getChildView("radio_material_type")->setEnabled(editable); - getChildView("radio_pbr_type")->setEnabled(editable); getChildView("checkbox_sync_settings")->setEnabled(editable); childSetValue("checkbox_sync_settings", gSavedSettings.getBOOL("SyncMaterialSettings")); updateVisibility(); @@ -906,8 +899,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bool identical_spec = false; // pbr material - bool is_pbr_material = false; - LLTextureCtrl* pbr_ctrl = getChild("pbr_control"); + bool has_pbr_material = false; + LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); if (pbr_ctrl) { LLUUID pbr_id; @@ -918,7 +911,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); pbr_ctrl->setEnabled(editable); pbr_ctrl->setImageAssetID(pbr_id); - is_pbr_material = pbr_id.notNull(); + has_pbr_material = pbr_id.notNull(); } LLTextureCtrl* texture_ctrl = getChild("texture control"); @@ -931,9 +924,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // Color swatch { - getChildView("color label")->setEnabled(editable && !is_pbr_material); + getChildView("color label")->setEnabled(editable && !has_pbr_material); } - LLColorSwatchCtrl* mColorSwatch = getChild("colorswatch"); + LLColorSwatchCtrl* mColorSwatch = findChild("colorswatch"); LLColor4 color = LLColor4::white; bool identical_color = false; @@ -946,17 +939,17 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mColorSwatch->setOriginal(color); mColorSwatch->set(color, force_set_values || (prev_color != color) || !editable); - mColorSwatch->setValid(editable && !is_pbr_material); - mColorSwatch->setEnabled(editable && !is_pbr_material); + mColorSwatch->setValid(editable && !has_pbr_material); + mColorSwatch->setEnabled(editable && !has_pbr_material); mColorSwatch->setCanApplyImmediately( editable ); } // Color transparency - getChildView("color trans")->setEnabled(editable && !is_pbr_material); + getChildView("color trans")->setEnabled(editable && !has_pbr_material); F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; getChild("ColorTrans")->setValue(editable ? transparency : 0); - getChildView("ColorTrans")->setEnabled(editable && !is_pbr_material); + getChildView("ColorTrans")->setEnabled(editable && !has_pbr_material); // Specular map LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); @@ -1215,9 +1208,18 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("shinyScaleU")->setValue(spec_scale_s); getChild("bumpyScaleU")->setValue(norm_scale_s); - getChildView("TexScaleU")->setEnabled(editable); - getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull()); + if (combobox_matmedia->getCurrentIndex() == MATMEDIA_PBR) + { + getChildView("TexScaleU")->setEnabled(editable && has_pbr_material); + getChildView("shinyScaleU")->setEnabled(editable && has_pbr_material); + getChildView("bumpyScaleU")->setEnabled(editable && has_pbr_material); + } + else + { + getChildView("TexScaleU")->setEnabled(editable); + getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull()); + getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull()); + } BOOL diff_scale_tentative = !(identical && identical_diff_scale_s); BOOL norm_scale_tentative = !(identical && identical_norm_scale_s); @@ -1254,9 +1256,18 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) BOOL norm_scale_tentative = !identical_norm_scale_t; BOOL spec_scale_tentative = !identical_spec_scale_t; - getChildView("TexScaleV")->setEnabled(editable); - getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull()); + if (combobox_matmedia->getCurrentIndex() == MATMEDIA_PBR) + { + getChildView("TexScaleV")->setEnabled(editable && has_pbr_material); + getChildView("shinyScaleV")->setEnabled(editable && has_pbr_material); + getChildView("bumpyScaleV")->setEnabled(editable && has_pbr_material); + } + else + { + getChildView("TexScaleV")->setEnabled(editable); + getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull()); + getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull()); + } if (force_set_values) { @@ -1300,9 +1311,18 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("shinyOffsetU")->setTentative(LLSD(norm_offset_u_tentative)); getChild("bumpyOffsetU")->setTentative(LLSD(spec_offset_u_tentative)); - getChildView("TexOffsetU")->setEnabled(editable); - getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyOffsetU")->setEnabled(editable && normmap_id.notNull()); + if (combobox_matmedia->getCurrentIndex() == MATMEDIA_PBR) + { + getChildView("TexOffsetU")->setEnabled(editable && has_pbr_material); + getChildView("shinyOffsetU")->setEnabled(editable && has_pbr_material); + getChildView("bumpyOffsetU")->setEnabled(editable && has_pbr_material); + } + else + { + getChildView("TexOffsetU")->setEnabled(editable); + getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull()); + getChildView("bumpyOffsetU")->setEnabled(editable && normmap_id.notNull()); + } } { @@ -1330,9 +1350,18 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("shinyOffsetV")->setTentative(LLSD(norm_offset_v_tentative)); getChild("bumpyOffsetV")->setTentative(LLSD(spec_offset_v_tentative)); - getChildView("TexOffsetV")->setEnabled(editable); - getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyOffsetV")->setEnabled(editable && normmap_id.notNull()); + if (combobox_matmedia->getCurrentIndex() == MATMEDIA_PBR) + { + getChildView("TexOffsetV")->setEnabled(editable && has_pbr_material); + getChildView("shinyOffsetV")->setEnabled(editable && has_pbr_material); + getChildView("bumpyOffsetV")->setEnabled(editable && has_pbr_material); + } + else + { + getChildView("TexOffsetV")->setEnabled(editable); + getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull()); + getChildView("bumpyOffsetV")->setEnabled(editable && normmap_id.notNull()); + } } // Texture rotation @@ -1356,10 +1385,19 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 diff_rot_deg = diff_rotation * RAD_TO_DEG; F32 norm_rot_deg = norm_rotation * RAD_TO_DEG; F32 spec_rot_deg = spec_rotation * RAD_TO_DEG; - - getChildView("TexRot")->setEnabled(editable); - getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull()); + + if (combobox_matmedia->getCurrentIndex() == MATMEDIA_PBR) + { + getChildView("TexRot")->setEnabled(editable && has_pbr_material); + getChildView("shinyRot")->setEnabled(editable && has_pbr_material); + getChildView("bumpyRot")->setEnabled(editable && has_pbr_material); + } + else + { + getChildView("TexRot")->setEnabled(editable); + getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull()); + getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull()); + } getChild("TexRot")->setTentative(diff_rot_tentative); getChild("shinyRot")->setTentative(LLSD(norm_rot_tentative)); @@ -1376,8 +1414,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTE::getGlow(glow,identical_glow); getChild("glow")->setValue(glow); getChild("glow")->setTentative(!identical_glow); - getChildView("glow")->setEnabled(editable && !is_pbr_material); - getChildView("glow label")->setEnabled(editable && !is_pbr_material); + getChildView("glow")->setEnabled(editable && !has_pbr_material); + getChildView("glow label")->setEnabled(editable && !has_pbr_material); } { @@ -1425,42 +1463,61 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLComboBox* mComboTexGen = getChild("combobox texgen"); if (mComboTexGen) - { + { S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; - BOOL enabled = editable && (index != 1); - BOOL identical_repeats = true; + bool enabled = editable && (index != 1); + bool identical_repeats = true; + S32 material_selection = combobox_matmedia->getCurrentIndex(); F32 repeats = 1.0f; - U32 material_type = (combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? radio_mat_type->getSelectedIndex() : MATTYPE_DIFFUSE; + U32 material_type = MATTYPE_DIFFUSE; + if (material_selection == MATMEDIA_MATERIAL) + { + material_type = radio_mat_type->getSelectedIndex(); + } + else if (material_selection == MATMEDIA_PBR) + { + enabled = editable && has_pbr_material; + material_type = radio_pbr_type->getSelectedIndex(); + } LLSelectMgr::getInstance()->setTextureChannel(LLRender::eTexIndex(material_type)); - switch (material_type) - { - default: - case MATTYPE_DIFFUSE: - { - enabled = editable && !id.isNull(); - identical_repeats = identical_diff_repeats; - repeats = repeats_diff; - } - break; + switch (material_type) + { + default: + case MATTYPE_DIFFUSE: + { + if (material_selection != MATMEDIA_PBR) + { + enabled = editable && !id.isNull(); + } + identical_repeats = identical_diff_repeats; + repeats = repeats_diff; + } + break; - case MATTYPE_SPECULAR: - { - enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); - identical_repeats = identical_spec_repeats; - repeats = repeats_spec; - } - break; + case MATTYPE_SPECULAR: + { + if (material_selection != MATMEDIA_PBR) + { + enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); + } + identical_repeats = identical_spec_repeats; + repeats = repeats_spec; + } + break; - case MATTYPE_NORMAL: - { - enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); - identical_repeats = identical_norm_repeats; - repeats = repeats_norm; - } - break; - } + case MATTYPE_NORMAL: + { + if (material_selection != MATMEDIA_PBR) + { + enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); + } + identical_repeats = identical_norm_repeats; + repeats = repeats_norm; + } + break; + } BOOL repeats_tentative = !identical_repeats; @@ -1731,25 +1788,32 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) // static void LLPanelFace::updateVisibility() -{ - LLComboBox* combo_matmedia = getChild("combobox matmedia"); - LLRadioGroup* radio_mat_type = getChild("radio_material_type"); - LLComboBox* combo_shininess = getChild("combobox shininess"); - LLComboBox* combo_bumpiness = getChild("combobox bumpiness"); - if (!radio_mat_type || !combo_matmedia || !combo_shininess || !combo_bumpiness) +{ + LLComboBox* combo_matmedia = findChild("combobox matmedia"); + LLRadioGroup* radio_mat_type = findChild("radio_material_type"); + LLRadioGroup* radio_pbr_type = findChild("radio_pbr_type"); + LLComboBox* combo_shininess = findChild("combobox shininess"); + LLComboBox* combo_bumpiness = findChild("combobox bumpiness"); + if (!radio_mat_type || !radio_pbr_type || !combo_matmedia || !combo_shininess || !combo_bumpiness) { LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL; return; } U32 materials_media = combo_matmedia->getCurrentIndex(); U32 material_type = radio_mat_type->getSelectedIndex(); + U32 pbr_type = radio_pbr_type->getSelectedIndex(); bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); bool show_material = materials_media == MATMEDIA_MATERIAL; bool show_pbr = materials_media == MATMEDIA_PBR; bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled())); bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && combo_matmedia->getEnabled(); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled(); - getChildView("radio_material_type")->setVisible(show_texture); + bool show_pbr_albedo = show_pbr && (pbr_type == PBRTYPE_ALBEDO) && combo_matmedia->getEnabled(); + bool show_pbr_normal = show_pbr && (pbr_type == PBRTYPE_NORMAL) && combo_matmedia->getEnabled(); + bool show_pbr_metallic = show_pbr && (pbr_type == PBRTYPE_METALLIC) && combo_matmedia->getEnabled(); + + radio_mat_type->setVisible(show_material); + radio_pbr_type->setVisible(show_pbr); // Media controls getChildView("media_info")->setVisible(show_media); @@ -1759,19 +1823,20 @@ void LLPanelFace::updateVisibility() // Diffuse texture controls getChildView("texture control")->setVisible(show_texture && show_material); - getChildView("label alphamode")->setVisible(show_texture && (show_material || show_pbr)); - getChildView("combobox alphamode")->setVisible(show_texture && (show_material || show_pbr)); + getChildView("label alphamode")->setVisible((show_texture && show_material) || show_pbr); + getChildView("combobox alphamode")->setVisible((show_texture && show_material) || show_pbr); getChildView("label maskcutoff")->setVisible(false); getChildView("maskcutoff")->setVisible(false); - if (show_texture && show_material) + if ((show_texture && show_material) || show_pbr) { updateAlphaControls(); } - getChildView("TexScaleU")->setVisible(show_texture || show_pbr); - getChildView("TexScaleV")->setVisible(show_texture || show_pbr); - getChildView("TexRot")->setVisible(show_texture || show_pbr); - getChildView("TexOffsetU")->setVisible(show_texture || show_pbr); - getChildView("TexOffsetV")->setVisible(show_texture || show_pbr); + // texture scale and position controls are shared between bpr and non-pbr textures + getChildView("TexScaleU")->setVisible(show_texture || show_pbr_albedo); + getChildView("TexScaleV")->setVisible(show_texture || show_pbr_albedo); + getChildView("TexRot")->setVisible(show_texture || show_pbr_albedo); + getChildView("TexOffsetU")->setVisible(show_texture || show_pbr_albedo); + getChildView("TexOffsetV")->setVisible(show_texture || show_pbr_albedo); // Specular map controls getChildView("shinytexture control")->setVisible(show_shininess); @@ -1787,11 +1852,11 @@ void LLPanelFace::updateVisibility() { updateShinyControls(); } - getChildView("shinyScaleU")->setVisible(show_shininess); - getChildView("shinyScaleV")->setVisible(show_shininess); - getChildView("shinyRot")->setVisible(show_shininess); - getChildView("shinyOffsetU")->setVisible(show_shininess); - getChildView("shinyOffsetV")->setVisible(show_shininess); + getChildView("shinyScaleU")->setVisible(show_shininess || show_pbr_normal); + getChildView("shinyScaleV")->setVisible(show_shininess || show_pbr_normal); + getChildView("shinyRot")->setVisible(show_shininess || show_pbr_normal); + getChildView("shinyOffsetU")->setVisible(show_shininess || show_pbr_normal); + getChildView("shinyOffsetV")->setVisible(show_shininess || show_pbr_normal); // Normal map controls if (show_bumpiness) @@ -1801,15 +1866,14 @@ void LLPanelFace::updateVisibility() getChildView("bumpytexture control")->setVisible(show_bumpiness); getChildView("combobox bumpiness")->setVisible(show_bumpiness); getChildView("label bumpiness")->setVisible(show_bumpiness); - getChildView("bumpyScaleU")->setVisible(show_bumpiness); - getChildView("bumpyScaleV")->setVisible(show_bumpiness); - getChildView("bumpyRot")->setVisible(show_bumpiness); - getChildView("bumpyOffsetU")->setVisible(show_bumpiness); - getChildView("bumpyOffsetV")->setVisible(show_bumpiness); + getChildView("bumpyScaleU")->setVisible(show_bumpiness || show_pbr_metallic); + getChildView("bumpyScaleV")->setVisible(show_bumpiness || show_pbr_metallic); + getChildView("bumpyRot")->setVisible(show_bumpiness || show_pbr_metallic); + getChildView("bumpyOffsetU")->setVisible(show_bumpiness || show_pbr_metallic); + getChildView("bumpyOffsetV")->setVisible(show_bumpiness || show_pbr_metallic); // PBR controls getChildView("pbr_control")->setVisible(show_pbr); - getChildView("radio_pbr_type")->setVisible(show_pbr); } // static -- cgit v1.2.3 From caf95ed00b0d35e9071db157c68a57f09198a530 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 5 Sep 2022 12:18:26 +0300 Subject: SL-17999 Small cleanup --- indra/newview/llpanelface.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c205efb436..ac4c76351d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -188,7 +188,6 @@ BOOL LLPanelFace::postBuild() LLColorSwatchCtrl* mShinyColorSwatch; LLComboBox* mComboTexGen; - LLComboBox* mComboMatMedia; LLCheckBoxCtrl *mCheckFullbright; @@ -199,10 +198,11 @@ BOOL LLPanelFace::postBuild() setMouseOpaque(FALSE); - LLTextureCtrl* pbr_ctrl = getChild("pbr_control"); + LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); if (pbr_ctrl) { - pbr_ctrl->setDefaultImageAssetID(LLUUID(gSavedSettings.getString("DefaultObjectTexture"))); + pbr_ctrl->setDefaultImageAssetID(LLUUID::null); + pbr_ctrl->setBlankImageAssetID(LLUUID::null); // should there be some empty default material? 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)); @@ -321,22 +321,22 @@ BOOL LLPanelFace::postBuild() mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } - mComboMatMedia = getChild("combobox matmedia"); - if(mComboMatMedia) + LLComboBox* combo_mat_media = findChild("combobox matmedia"); + if(combo_mat_media) { - mComboMatMedia->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this); - mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); + combo_mat_media->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this); + combo_mat_media->selectNthItem(MATMEDIA_MATERIAL); } - LLRadioGroup* radio_mat_type = getChild("radio_material_type"); + LLRadioGroup* radio_mat_type = findChild("radio_material_type"); if(radio_mat_type) { radio_mat_type->setCommitCallback(LLPanelFace::onCommitMaterialType, this); radio_mat_type->selectNthItem(MATTYPE_DIFFUSE); } - LLRadioGroup* radio_pbr_type = getChild("radio_pbr_type"); - if (radio_mat_type) + LLRadioGroup* radio_pbr_type = findChild("radio_pbr_type"); + if (radio_pbr_type) { radio_pbr_type->setCommitCallback(LLPanelFace::onCommitPbrType, this); radio_pbr_type->selectNthItem(PBRTYPE_ALBEDO); @@ -1660,7 +1660,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) clearCtrls(); // Disable non-UICtrls - LLTextureCtrl* pbr_ctrl = getChild("pbr_control"); + LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); if (pbr_ctrl) { pbr_ctrl->setImageAssetID(LLUUID::null); @@ -2126,7 +2126,7 @@ void LLPanelFace::onSelectPbr(const LLSD& data) { LLSelectMgr::getInstance()->saveSelectedObjectTextures(); - LLTextureCtrl* pbr_ctrl = getChild("pbr_control"); + LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); if (!pbr_ctrl) return; if (!pbr_ctrl->getTentative()) { @@ -3646,7 +3646,7 @@ void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) { - LLTextureCtrl* pbr_ctrl = getChild("pbr_control"); + LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); if (pbr_ctrl) { LLUUID obj_owner_id; -- cgit v1.2.3 From 87b55e7293d7b87650e9e792f6be6b7e894773de Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 13 Sep 2022 01:15:31 +0300 Subject: SL-17653 Removed unneeded combo box --- indra/newview/llpanelface.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index ac4c76351d..28b8a64131 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1090,10 +1090,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) texture_ctrl->setTentative(FALSE); texture_ctrl->setEnabled(editable); texture_ctrl->setImageAssetID(id); - getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f); - getChildView("label alphamode")->setEnabled(editable && mIsAlpha); - getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); - getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); + getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material); + getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material); + getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); + getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); texture_ctrl->setBakeTextureEnabled(TRUE); } @@ -1116,10 +1116,10 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) texture_ctrl->setTentative(TRUE); texture_ctrl->setEnabled(editable); texture_ctrl->setImageAssetID(id); - getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f); - getChildView("label alphamode")->setEnabled(editable && mIsAlpha); - getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); - getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); + getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material); + getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material); + getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); + getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); texture_ctrl->setBakeTextureEnabled(TRUE); } @@ -1823,8 +1823,8 @@ void LLPanelFace::updateVisibility() // Diffuse texture controls getChildView("texture control")->setVisible(show_texture && show_material); - getChildView("label alphamode")->setVisible((show_texture && show_material) || show_pbr); - getChildView("combobox alphamode")->setVisible((show_texture && show_material) || show_pbr); + getChildView("label alphamode")->setVisible(show_texture && show_material); + getChildView("combobox alphamode")->setVisible(show_texture && show_material); getChildView("label maskcutoff")->setVisible(false); getChildView("maskcutoff")->setVisible(false); if ((show_texture && show_material) || show_pbr) -- cgit v1.2.3 From 1478cacfcda16162bd3d854a275afcc6a41852dd Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 16 Sep 2022 21:24:16 +0300 Subject: DRTVWR-559 Fixed merge conflicts --- indra/newview/llpanelface.cpp | 44 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7b7fcd4585..6498215e94 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -326,11 +326,11 @@ BOOL LLPanelFace::postBuild() mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); } - LLComboBox* combo_mat_media = findChild("combobox matmedia"); - if(combo_mat_media) + mComboMatMedia = getChild("combobox matmedia"); + if(mComboMatMedia) { - combo_mat_media->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this); - combo_mat_media->selectNthItem(MATMEDIA_MATERIAL); + mComboMatMedia->setCommitCallback(LLPanelFace::onCommitMaterialsMedia,this); + mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); } LLRadioGroup* radio_mat_type = findChild("radio_material_type"); @@ -883,12 +883,11 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // only turn on auto-adjust button if there is a media renderer and the media is loaded childSetEnabled("button align", editable); - LLComboBox* combobox_matmedia = getChild("combobox matmedia"); - if (combobox_matmedia->getCurrentIndex() < MATMEDIA_MATERIAL) + if (mComboMatMedia->getCurrentIndex() < MATMEDIA_MATERIAL) { - combobox_matmedia->selectNthItem(MATMEDIA_MATERIAL); + mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); } - combobox_matmedia->setEnabled(editable); + mComboMatMedia->setEnabled(editable); LLRadioGroup* radio_mat_type = getChild("radio_material_type"); if (radio_mat_type->getSelectedIndex() < MATTYPE_DIFFUSE) @@ -1223,7 +1222,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("shinyScaleU")->setValue(spec_scale_s); getChild("bumpyScaleU")->setValue(norm_scale_s); - if (combobox_matmedia->getCurrentIndex() == MATMEDIA_PBR) + if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) { getChildView("TexScaleU")->setEnabled(editable && has_pbr_material); getChildView("shinyScaleU")->setEnabled(editable && has_pbr_material); @@ -1271,7 +1270,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) BOOL norm_scale_tentative = !identical_norm_scale_t; BOOL spec_scale_tentative = !identical_spec_scale_t; - if (combobox_matmedia->getCurrentIndex() == MATMEDIA_PBR) + if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) { getChildView("TexScaleV")->setEnabled(editable && has_pbr_material); getChildView("shinyScaleV")->setEnabled(editable && has_pbr_material); @@ -1326,7 +1325,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("shinyOffsetU")->setTentative(LLSD(norm_offset_u_tentative)); getChild("bumpyOffsetU")->setTentative(LLSD(spec_offset_u_tentative)); - if (combobox_matmedia->getCurrentIndex() == MATMEDIA_PBR) + if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) { getChildView("TexOffsetU")->setEnabled(editable && has_pbr_material); getChildView("shinyOffsetU")->setEnabled(editable && has_pbr_material); @@ -1365,7 +1364,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("shinyOffsetV")->setTentative(LLSD(norm_offset_v_tentative)); getChild("bumpyOffsetV")->setTentative(LLSD(spec_offset_v_tentative)); - if (combobox_matmedia->getCurrentIndex() == MATMEDIA_PBR) + if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) { getChildView("TexOffsetV")->setEnabled(editable && has_pbr_material); getChildView("shinyOffsetV")->setEnabled(editable && has_pbr_material); @@ -1401,7 +1400,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 norm_rot_deg = norm_rotation * RAD_TO_DEG; F32 spec_rot_deg = spec_rotation * RAD_TO_DEG; - if (combobox_matmedia->getCurrentIndex() == MATMEDIA_PBR) + if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) { getChildView("TexRot")->setEnabled(editable && has_pbr_material); getChildView("shinyRot")->setEnabled(editable && has_pbr_material); @@ -1482,7 +1481,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; bool enabled = editable && (index != 1); bool identical_repeats = true; - S32 material_selection = combobox_matmedia->getCurrentIndex(); + S32 material_selection = mComboMatMedia->getCurrentIndex(); F32 repeats = 1.0f; U32 material_type = MATTYPE_DIFFUSE; @@ -2553,12 +2552,11 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) void LLPanelFace::updateVisibility() { - LLComboBox* combo_matmedia = findChild("combobox matmedia"); LLRadioGroup* radio_mat_type = findChild("radio_material_type"); LLRadioGroup* radio_pbr_type = findChild("radio_pbr_type"); LLComboBox* combo_shininess = findChild("combobox shininess"); LLComboBox* combo_bumpiness = findChild("combobox bumpiness"); - if (!radio_mat_type || !radio_pbr_type || !combo_matmedia || !combo_shininess || !combo_bumpiness) + if (!radio_mat_type || !radio_pbr_type || !mComboMatMedia || !combo_shininess || !combo_bumpiness) { LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL; return; @@ -2566,15 +2564,15 @@ void LLPanelFace::updateVisibility() U32 materials_media = mComboMatMedia->getCurrentIndex(); U32 material_type = radio_mat_type->getSelectedIndex(); U32 pbr_type = radio_pbr_type->getSelectedIndex(); - bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled(); + bool show_media = (materials_media == MATMEDIA_MEDIA) && mComboMatMedia->getEnabled(); bool show_material = materials_media == MATMEDIA_MATERIAL; bool show_pbr = materials_media == MATMEDIA_PBR; - bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled())); - bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && combo_matmedia->getEnabled(); - bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled(); - bool show_pbr_albedo = show_pbr && (pbr_type == PBRTYPE_ALBEDO) && combo_matmedia->getEnabled(); - bool show_pbr_normal = show_pbr && (pbr_type == PBRTYPE_NORMAL) && combo_matmedia->getEnabled(); - bool show_pbr_metallic = show_pbr && (pbr_type == PBRTYPE_METALLIC) && combo_matmedia->getEnabled(); + bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && mComboMatMedia->getEnabled())); + bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled(); + bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); + bool show_pbr_albedo = show_pbr && (pbr_type == PBRTYPE_ALBEDO) && mComboMatMedia->getEnabled(); + bool show_pbr_normal = show_pbr && (pbr_type == PBRTYPE_NORMAL) && mComboMatMedia->getEnabled(); + bool show_pbr_metallic = show_pbr && (pbr_type == PBRTYPE_METALLIC) && mComboMatMedia->getEnabled(); radio_mat_type->setVisible(show_material); radio_pbr_type->setVisible(show_pbr); -- cgit v1.2.3 From 94b92868587c652d7140aa704db42e497482827d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 22 Sep 2022 02:14:51 +0300 Subject: SL-17999 'copy' functionality for 'features' and 'texture' tabs And a fix to prevent message spam --- indra/newview/llpanelface.cpp | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 6498215e94..f7eff39da7 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -3632,10 +3632,31 @@ private: struct LLPanelFaceUpdateFunctor : public LLSelectedObjectFunctor { - LLPanelFaceUpdateFunctor(bool update_media) : mUpdateMedia(update_media) {} + LLPanelFaceUpdateFunctor(bool update_media, bool update_pbr) + : mUpdateMedia(update_media) + , mUpdatePbr(update_pbr) + {} + virtual bool apply(LLViewerObject* object) { + if (mUpdatePbr) + { + LLRenderMaterialParams* param_block = (LLRenderMaterialParams*)object->getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL); + if (param_block) + { + if (param_block->isEmpty()) + { + object->setHasRenderMaterialParams(false); + } + else + { + object->parameterChanged(LLNetworkData::PARAMS_RENDER_MATERIAL, true); + } + } + } + object->sendTEUpdate(); + if (mUpdateMedia) { LLVOVolume *vo = dynamic_cast(object); @@ -3648,6 +3669,7 @@ struct LLPanelFaceUpdateFunctor : public LLSelectedObjectFunctor } private: bool mUpdateMedia; + bool mUpdatePbr; }; struct LLPanelFaceNavigateHomeFunctor : public LLSelectedTEFunctor @@ -3783,7 +3805,7 @@ void LLPanelFace::onPasteColor() LLPanelFacePasteTexFunctor paste_func(this, PASTE_COLOR); selected_objects->applyToTEs(&paste_func); - LLPanelFaceUpdateFunctor sendfunc(false); + LLPanelFaceUpdateFunctor sendfunc(false, false); selected_objects->applyToObjects(&sendfunc); } @@ -3886,6 +3908,7 @@ void LLPanelFace::onCopyTexture() te_data["te"]["bumpmap"] = tep->getBumpmap(); te_data["te"]["bumpshiny"] = tep->getBumpShiny(); te_data["te"]["bumpfullbright"] = tep->getBumpShinyFullbright(); + te_data["te"]["pbr"] = objectp->getRenderMaterialID(te); if (te_data["te"].has("imageid")) { @@ -4139,7 +4162,7 @@ void LLPanelFace::onPasteTexture() LLPanelFacePasteTexFunctor paste_func(this, PASTE_TEXTURE); selected_objects->applyToTEs(&paste_func); - LLPanelFaceUpdateFunctor sendfunc(true); + LLPanelFaceUpdateFunctor sendfunc(true, true); selected_objects->applyToObjects(&sendfunc); LLPanelFaceNavigateHomeFunctor navigate_home_func; @@ -4273,6 +4296,14 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) { objectp->setTEBumpShinyFullbright(te, (U8)te_data["te"]["bumpfullbright"].asInteger()); } + if (te_data["te"].has("pbr")) + { + objectp->setRenderMaterialID(te, te_data["te"]["pbr"].asUUID(), false); + } + else + { + objectp->setRenderMaterialID(te, LLUUID::null, false); + } // Texture map if (te_data["te"].has("scales") && te_data["te"].has("scalet")) -- cgit v1.2.3 From 8f1d22686551f4d6783d03cd3685085ed7fcb96c Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 23 Sep 2022 11:19:56 -0500 Subject: SL-18134 Rename Albedo to Base Color to be more consistent with GLTF spec --- indra/newview/llpanelface.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f7eff39da7..a4a91baad8 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -105,7 +105,7 @@ const S32 MATTYPE_SPECULAR = 2; // Specular map const S32 ALPHAMODE_MASK = 2; // Alpha masking mode const S32 BUMPY_TEXTURE = 18; // use supplied normal map const S32 SHINY_TEXTURE = 4; // use supplied specular map -const S32 PBRTYPE_ALBEDO = 0; // PBR Albedo +const S32 PBRTYPE_BASE_COLOR = 0; // PBR Base Color const S32 PBRTYPE_NORMAL = 1; // PBR Normal const S32 PBRTYPE_METALLIC = 2; // PBR Metallic @@ -344,7 +344,7 @@ BOOL LLPanelFace::postBuild() if (radio_pbr_type) { radio_pbr_type->setCommitCallback(LLPanelFace::onCommitPbrType, this); - radio_pbr_type->selectNthItem(PBRTYPE_ALBEDO); + radio_pbr_type->selectNthItem(PBRTYPE_BASE_COLOR); } mCtrlGlow = getChild("glow"); @@ -897,9 +897,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) radio_mat_type->setEnabled(editable); LLRadioGroup* radio_pbr_type = getChild("radio_pbr_type"); - if (radio_pbr_type->getSelectedIndex() < PBRTYPE_ALBEDO) + if (radio_pbr_type->getSelectedIndex() < PBRTYPE_BASE_COLOR) { - radio_pbr_type->selectNthItem(PBRTYPE_ALBEDO); + radio_pbr_type->selectNthItem(PBRTYPE_BASE_COLOR); } radio_pbr_type->setEnabled(editable); @@ -2570,7 +2570,7 @@ void LLPanelFace::updateVisibility() bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && mComboMatMedia->getEnabled())); bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled(); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); - bool show_pbr_albedo = show_pbr && (pbr_type == PBRTYPE_ALBEDO) && mComboMatMedia->getEnabled(); + bool show_pbr_base_color = show_pbr && (pbr_type == PBRTYPE_BASE_COLOR) && mComboMatMedia->getEnabled(); bool show_pbr_normal = show_pbr && (pbr_type == PBRTYPE_NORMAL) && mComboMatMedia->getEnabled(); bool show_pbr_metallic = show_pbr && (pbr_type == PBRTYPE_METALLIC) && mComboMatMedia->getEnabled(); @@ -2594,11 +2594,11 @@ void LLPanelFace::updateVisibility() updateAlphaControls(); } // texture scale and position controls are shared between bpr and non-pbr textures - getChildView("TexScaleU")->setVisible(show_texture || show_pbr_albedo); - getChildView("TexScaleV")->setVisible(show_texture || show_pbr_albedo); - getChildView("TexRot")->setVisible(show_texture || show_pbr_albedo); - getChildView("TexOffsetU")->setVisible(show_texture || show_pbr_albedo); - getChildView("TexOffsetV")->setVisible(show_texture || show_pbr_albedo); + getChildView("TexScaleU")->setVisible(show_texture || show_pbr_base_color); + getChildView("TexScaleV")->setVisible(show_texture || show_pbr_base_color); + getChildView("TexRot")->setVisible(show_texture || show_pbr_base_color); + getChildView("TexOffsetU")->setVisible(show_texture || show_pbr_base_color); + getChildView("TexOffsetV")->setVisible(show_texture || show_pbr_base_color); // Specular map controls getChildView("shinytexture control")->setVisible(show_shininess); -- cgit v1.2.3 From 17f421fb2eeda7b9038d8ca6ad3aba521363c229 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 12 Oct 2022 22:50:59 +0300 Subject: SL-18346 Fixed tools floater not editing pbr texture offsets correctly --- indra/newview/llpanelface.cpp | 78 +++++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 17 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index a4a91baad8..ba9f02bc48 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -119,10 +119,23 @@ std::string USE_TEXTURE; LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit() { - LLRadioGroup* radio_mat_type = getChild("radio_material_type"); - LLRender::eTexIndex channel_to_edit = (mComboMatMedia && mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? - (radio_mat_type ? (LLRender::eTexIndex)radio_mat_type->getSelectedIndex() : LLRender::DIFFUSE_MAP) : LLRender::DIFFUSE_MAP; + + LLRender::eTexIndex channel_to_edit = LLRender::DIFFUSE_MAP; + if (mComboMatMedia) + { + U32 matmedia_selection = mComboMatMedia->getCurrentIndex(); + if (matmedia_selection = MATMEDIA_MATERIAL) + { + LLRadioGroup* radio_mat_type = getChild("radio_material_type"); + channel_to_edit = (LLRender::eTexIndex)radio_mat_type->getSelectedIndex(); + } + if (matmedia_selection = MATMEDIA_PBR) + { + LLRadioGroup* radio_mat_type = getChild("radio_pbr_type"); + channel_to_edit = (LLRender::eTexIndex)radio_mat_type->getSelectedIndex(); + } + } channel_to_edit = (channel_to_edit == LLRender::NORMAL_MAP) ? (getCurrentNormalMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit; channel_to_edit = (channel_to_edit == LLRender::SPECULAR_MAP) ? (getCurrentSpecularMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit; @@ -517,20 +530,42 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor { BOOL valid; F32 value; - - LLRadioGroup * radio_mat_type = mPanel->getChild("radio_material_type"); std::string prefix; - switch (radio_mat_type->getSelectedIndex()) + U32 materials_media = mPanel->getChild("combobox matmedia")->getCurrentIndex(); + + if (MATMEDIA_PBR == materials_media) { - case MATTYPE_DIFFUSE: - prefix = "Tex"; - break; - case MATTYPE_NORMAL: - prefix = "bumpy"; - break; - case MATTYPE_SPECULAR: - prefix = "shiny"; - break; + LLRadioGroup * radio_pbr_type = mPanel->getChild("radio_pbr_type"); + switch (radio_pbr_type->getSelectedIndex()) + { + case PBRTYPE_BASE_COLOR: + prefix = "Tex"; + break; + case PBRTYPE_NORMAL: + prefix = "bumpy"; + break; + case PBRTYPE_METALLIC: + prefix = "shiny"; + break; + } + } + else + { + // Effectively the same as MATMEDIA_PBR sans using different radio, + // separate for the sake of clarity + LLRadioGroup * radio_mat_type = mPanel->getChild("radio_material_type"); + switch (radio_mat_type->getSelectedIndex()) + { + case MATTYPE_DIFFUSE: + prefix = "Tex"; + break; + case MATTYPE_NORMAL: + prefix = "bumpy"; + break; + case MATTYPE_SPECULAR: + prefix = "shiny"; + break; + } } LLSpinCtrl * ctrlTexScaleS = mPanel->getChild(prefix + "ScaleU"); @@ -3468,11 +3503,20 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) LLPanelFace* self = (LLPanelFace*) userdata; LLUICtrl* repeats_ctrl = self->getChild("rptctrl"); - LLRadioGroup* radio_mat_type = self->getChild("radio_material_type"); U32 materials_media = self->mComboMatMedia->getCurrentIndex(); + U32 material_type = 0; + if (materials_media == MATMEDIA_PBR) + { + LLRadioGroup* radio_mat_type = self->getChild("radio_pbr_type"); + material_type = radio_mat_type->getSelectedIndex(); + } + if (materials_media == MATMEDIA_MATERIAL) + { + LLRadioGroup* radio_mat_type = self->getChild("radio_material_type"); + material_type = radio_mat_type->getSelectedIndex(); + } - U32 material_type = (materials_media == MATMEDIA_MATERIAL) ? radio_mat_type->getSelectedIndex() : 0; F32 repeats_per_meter = repeats_ctrl->getValue().asReal(); F32 obj_scale_s = 1.0f; -- cgit v1.2.3 From baf1f0f14de82549e999db0e628a284401fe4086 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 13 Oct 2022 00:01:23 +0300 Subject: SL-18346 Fix a typo --- indra/newview/llpanelface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index ba9f02bc48..aaee64485a 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -125,12 +125,12 @@ LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit() if (mComboMatMedia) { U32 matmedia_selection = mComboMatMedia->getCurrentIndex(); - if (matmedia_selection = MATMEDIA_MATERIAL) + if (matmedia_selection == MATMEDIA_MATERIAL) { LLRadioGroup* radio_mat_type = getChild("radio_material_type"); channel_to_edit = (LLRender::eTexIndex)radio_mat_type->getSelectedIndex(); } - if (matmedia_selection = MATMEDIA_PBR) + if (matmedia_selection == MATMEDIA_PBR) { LLRadioGroup* radio_mat_type = getChild("radio_pbr_type"); channel_to_edit = (LLRender::eTexIndex)radio_mat_type->getSelectedIndex(); -- cgit v1.2.3 From bda420662710e95de1b3f6ff954459b4bb6c3b01 Mon Sep 17 00:00:00 2001 From: "Brad Kittenbrink (Brad Linden)" Date: Mon, 10 Oct 2022 16:10:10 -0700 Subject: WIP for SL-18103 and SL-17697 live editing of materials using ModifyMaterialParams cap --- indra/newview/llpanelface.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index aaee64485a..ff5128e0c2 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -46,6 +46,7 @@ #include "llcombobox.h" #include "lldrawpoolbump.h" #include "llface.h" +#include "llgltfmateriallist.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" // gInventory #include "llinventorymodelbackgroundfetch.h" @@ -53,6 +54,7 @@ #include "llfloaterreg.h" #include "lllineeditor.h" #include "llmaterialmgr.h" +#include "llmaterialeditor.h" #include "llmediactrl.h" #include "llmediaentry.h" #include "llmenubutton.h" @@ -91,6 +93,7 @@ #include "llsdserialize.h" #include "llinventorymodel.h" +using namespace std::literals; // // Constant definitions for comboboxes @@ -234,6 +237,9 @@ BOOL LLPanelFace::postBuild() pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); pbr_ctrl->setBakeTextureEnabled(false); pbr_ctrl->setInventoryPickType(LLTextureCtrl::PICK_MATERIAL); + + // TODO - design real UI for activating live editing + pbr_ctrl->setRightMouseUpCallback(boost::bind(&LLPanelFace::onPbrStartEditing, this)); } mTextureCtrl = getChild("texture control"); @@ -4574,6 +4580,33 @@ void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) } } +void LLPanelFace::onPbrStartEditing() { + LL_DEBUGS() << "begin live editing material" << LL_ENDL; + + LLMaterialEditor *editor = + dynamic_cast(LLFloaterReg::showInstance("material_editor", LLSD(LLUUID::null), TAKE_FOCUS_YES)); + if (editor) + { + LLObjectSelection *select = LLSelectMgr::getInstance()->getSelection(); + LLViewerObject * objectp = select->getFirstObject(); + LLUUID object_id = objectp->getID(); + + bool identical; + LLUUID material_id; + LLSelectedTE::getPbrMaterialId(material_id, identical); + + S32 face = 0; + + LL_DEBUGS() << "loading material live editor with asset " << material_id << " on object " << object_id << LL_ENDL; + + LLGLTFMaterial* material = gGLTFMaterialList.getMaterial(material_id); + editor->setTitle("Editing material on "s + object_id.asString()); + editor->setAssetId(material_id); + editor->setFromGLTFMaterial(material); + editor->setOverrideTarget(object_id, face); + } +} + bool LLPanelFace::isIdenticalPlanarTexgen() { LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; -- cgit v1.2.3 From c6bb0fef90b0c2c6557b933b0bc57cabd66fa572 Mon Sep 17 00:00:00 2001 From: "Brad Kittenbrink (Brad Linden)" Date: Tue, 11 Oct 2022 18:08:15 -0700 Subject: Fix SL-17697 local_id usage --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index ff5128e0c2..f93a0e7142 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4603,7 +4603,7 @@ void LLPanelFace::onPbrStartEditing() { editor->setTitle("Editing material on "s + object_id.asString()); editor->setAssetId(material_id); editor->setFromGLTFMaterial(material); - editor->setOverrideTarget(object_id, face); + editor->setOverrideTarget(objectp->getLocalID(), face); } } -- cgit v1.2.3 From 53e5216b2092b98d6973c2b27c5c75713ec99e73 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Mon, 17 Oct 2022 15:44:32 -0700 Subject: Continuing work on SL-17697 Live editing with material overrides. * Fixed Selection usage so material editor no longer hardcoded to a single object/face * made local preview hack the fallback for when the ModifyMaterialParams cap is missing --- indra/newview/llpanelface.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f93a0e7142..fd8bf044f8 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4587,23 +4587,16 @@ void LLPanelFace::onPbrStartEditing() { dynamic_cast(LLFloaterReg::showInstance("material_editor", LLSD(LLUUID::null), TAKE_FOCUS_YES)); if (editor) { - LLObjectSelection *select = LLSelectMgr::getInstance()->getSelection(); - LLViewerObject * objectp = select->getFirstObject(); - LLUUID object_id = objectp->getID(); - bool identical; LLUUID material_id; LLSelectedTE::getPbrMaterialId(material_id, identical); - S32 face = 0; - - LL_DEBUGS() << "loading material live editor with asset " << material_id << " on object " << object_id << LL_ENDL; + LL_DEBUGS() << "loading material live editor with asset " << material_id << LL_ENDL; LLGLTFMaterial* material = gGLTFMaterialList.getMaterial(material_id); - editor->setTitle("Editing material on "s + object_id.asString()); + editor->setTitle("Editing material on selection"s); editor->setAssetId(material_id); editor->setFromGLTFMaterial(material); - editor->setOverrideTarget(objectp->getLocalID(), face); } } -- cgit v1.2.3 From f20c47a5968c82b1627139537e07a2ae67f64b24 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Mon, 17 Oct 2022 16:49:51 -0700 Subject: More work on SL-17697 LLMaterialEditor now uses new override diffing code when applyToSelection() gets called --- indra/newview/llpanelface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index fd8bf044f8..457ff525c5 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4593,8 +4593,8 @@ void LLPanelFace::onPbrStartEditing() { LL_DEBUGS() << "loading material live editor with asset " << material_id << LL_ENDL; - LLGLTFMaterial* material = gGLTFMaterialList.getMaterial(material_id); - editor->setTitle("Editing material on selection"s); + LLPointer material = gGLTFMaterialList.getMaterial(material_id); + editor->setTitle(editor->getString("material_override_title")); editor->setAssetId(material_id); editor->setFromGLTFMaterial(material); } -- cgit v1.2.3 From 7be33594eaab6b9c0da863778bbdacdb8cbe7838 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 18 Oct 2022 20:12:38 +0300 Subject: SL-18008 Updated Save and Edit PBR buttons --- indra/newview/llpanelface.cpp | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 457ff525c5..f4b75c9154 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4580,24 +4580,15 @@ void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) } } -void LLPanelFace::onPbrStartEditing() { - LL_DEBUGS() << "begin live editing material" << LL_ENDL; - - LLMaterialEditor *editor = - dynamic_cast(LLFloaterReg::showInstance("material_editor", LLSD(LLUUID::null), TAKE_FOCUS_YES)); - if (editor) - { - bool identical; - LLUUID material_id; - LLSelectedTE::getPbrMaterialId(material_id, identical); +void LLPanelFace::onPbrStartEditing() +{ + bool identical; + LLUUID material_id; + LLSelectedTE::getPbrMaterialId(material_id, identical); - LL_DEBUGS() << "loading material live editor with asset " << material_id << LL_ENDL; + LL_DEBUGS() << "loading material live editor with asset " << material_id << LL_ENDL; - LLPointer material = gGLTFMaterialList.getMaterial(material_id); - editor->setTitle(editor->getString("material_override_title")); - editor->setAssetId(material_id); - editor->setFromGLTFMaterial(material); - } + LLMaterialEditor::loadLiveMaterial(material_id); } bool LLPanelFace::isIdenticalPlanarTexgen() -- cgit v1.2.3 From 0cd7c3842119f1801872b4db05e17544b4eb7158 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 21 Oct 2022 18:05:19 -0500 Subject: SL-18105 Hook up live material editor to current selection set and implicitly open build floater when editing a PBR material. --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f4b75c9154..f8e786fc97 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4588,7 +4588,7 @@ void LLPanelFace::onPbrStartEditing() LL_DEBUGS() << "loading material live editor with asset " << material_id << LL_ENDL; - LLMaterialEditor::loadLiveMaterial(material_id); + LLMaterialEditor::loadLiveMaterialEditor(); } bool LLPanelFace::isIdenticalPlanarTexgen() -- cgit v1.2.3 From 88659e9fe793a02fb4edcbf8ef07307c25119604 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 22 Oct 2022 15:25:03 -0500 Subject: SL-18105 When saving an object's material to inventory, save the version that as overrides applied. --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f8e786fc97..c6e0bc5153 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4588,7 +4588,7 @@ void LLPanelFace::onPbrStartEditing() LL_DEBUGS() << "loading material live editor with asset " << material_id << LL_ENDL; - LLMaterialEditor::loadLiveMaterialEditor(); + LLMaterialEditor::loadLive(); } bool LLPanelFace::isIdenticalPlanarTexgen() -- cgit v1.2.3 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/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') 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)); -- cgit v1.2.3 From b6a35e36d71b421e8f74e5b5e3f0909c8fcda930 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 29 Oct 2022 01:27:35 +0300 Subject: SL-18448 Material Editor and Tools floater adjustments 1. Enable glow 2. Added buttons to texture->pbr --- indra/newview/llpanelface.cpp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 6d8d19c57c..f884cfe842 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -201,6 +201,8 @@ BOOL LLPanelFace::postBuild() childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); + childSetAction("pbr_from_inventory", &LLPanelFace::onClickBtnLoadInvPBR, this); + childSetAction("edit_selected_pbr", &LLPanelFace::onClickBtnEditPBR, this); LLTextureCtrl* mTextureCtrl; LLTextureCtrl* mShinyTextureCtrl; @@ -237,9 +239,6 @@ BOOL LLPanelFace::postBuild() pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); pbr_ctrl->setBakeTextureEnabled(false); pbr_ctrl->setInventoryPickType(LLTextureCtrl::PICK_MATERIAL); - - // TODO - design real UI for activating live editing - pbr_ctrl->setRightMouseUpCallback(boost::bind(&LLPanelFace::onPbrStartEditing, this)); } mTextureCtrl = getChild("texture control"); @@ -968,6 +967,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) 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); LLTextureCtrl* texture_ctrl = getChild("texture control"); LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); @@ -1469,8 +1470,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTE::getGlow(glow,identical_glow); getChild("glow")->setValue(glow); getChild("glow")->setTentative(!identical_glow); - getChildView("glow")->setEnabled(editable && !has_pbr_material); - getChildView("glow label")->setEnabled(editable && !has_pbr_material); + getChildView("glow")->setEnabled(editable); + getChildView("glow label")->setEnabled(editable); } { @@ -1746,6 +1747,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("label shininess")->setEnabled(FALSE); getChildView("label bumpiness")->setEnabled(FALSE); getChildView("button align")->setEnabled(FALSE); + getChildView("pbr_from_inventory")->setEnabled(FALSE); + getChildView("edit_selected_pbr")->setEnabled(FALSE); //getChildView("has media")->setEnabled(FALSE); //getChildView("media info set")->setEnabled(FALSE); @@ -2677,6 +2680,8 @@ void LLPanelFace::updateVisibility() // PBR controls getChildView("pbr_control")->setVisible(show_pbr); + getChildView("pbr_from_inventory")->setVisible(show_pbr); + getChildView("edit_selected_pbr")->setVisible(show_pbr); } // static @@ -3651,6 +3656,19 @@ void LLPanelFace::onAlignTexture(void* userdata) self->alignTestureLayer(); } +void LLPanelFace::onClickBtnLoadInvPBR(void* userdata) +{ + // Shouldn't this be "save to inventory?" + LLPanelFace* self = (LLPanelFace*)userdata; + LLTextureCtrl* pbr_ctrl = self->findChild("pbr_control"); + pbr_ctrl->showPicker(true); +} + +void LLPanelFace::onClickBtnEditPBR(void* userdata) +{ + LLMaterialEditor::loadLive(); +} + enum EPasteMode { PASTE_COLOR, @@ -4580,17 +4598,6 @@ void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) } } -void LLPanelFace::onPbrStartEditing() -{ - bool identical; - LLUUID material_id; - LLSelectedTE::getPbrMaterialId(material_id, identical); - - LL_DEBUGS() << "loading material live editor with asset " << material_id << LL_ENDL; - - LLMaterialEditor::loadLive(); -} - bool LLPanelFace::isIdenticalPlanarTexgen() { LLTextureEntry::e_texgen selected_texgen = LLTextureEntry::TEX_GEN_DEFAULT; -- cgit v1.2.3 From 757dc513db9ab6476c6c1c529e28752b50355882 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 1 Nov 2022 23:57:49 +0200 Subject: SL-18448 Fix metallic and normal controls being swapped --- indra/newview/llpanelface.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f884cfe842..04957729ed 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2658,11 +2658,11 @@ void LLPanelFace::updateVisibility() { updateShinyControls(); } - getChildView("shinyScaleU")->setVisible(show_shininess || show_pbr_normal); - getChildView("shinyScaleV")->setVisible(show_shininess || show_pbr_normal); - getChildView("shinyRot")->setVisible(show_shininess || show_pbr_normal); - getChildView("shinyOffsetU")->setVisible(show_shininess || show_pbr_normal); - getChildView("shinyOffsetV")->setVisible(show_shininess || show_pbr_normal); + getChildView("shinyScaleU")->setVisible(show_shininess || show_pbr_metallic); + getChildView("shinyScaleV")->setVisible(show_shininess || show_pbr_metallic); + getChildView("shinyRot")->setVisible(show_shininess || show_pbr_metallic); + getChildView("shinyOffsetU")->setVisible(show_shininess || show_pbr_metallic); + getChildView("shinyOffsetV")->setVisible(show_shininess || show_pbr_metallic); // Normal map controls if (show_bumpiness) @@ -2672,11 +2672,11 @@ void LLPanelFace::updateVisibility() getChildView("bumpytexture control")->setVisible(show_bumpiness); getChildView("combobox bumpiness")->setVisible(show_bumpiness); getChildView("label bumpiness")->setVisible(show_bumpiness); - getChildView("bumpyScaleU")->setVisible(show_bumpiness || show_pbr_metallic); - getChildView("bumpyScaleV")->setVisible(show_bumpiness || show_pbr_metallic); - getChildView("bumpyRot")->setVisible(show_bumpiness || show_pbr_metallic); - getChildView("bumpyOffsetU")->setVisible(show_bumpiness || show_pbr_metallic); - getChildView("bumpyOffsetV")->setVisible(show_bumpiness || show_pbr_metallic); + getChildView("bumpyScaleU")->setVisible(show_bumpiness || show_pbr_normal); + getChildView("bumpyScaleV")->setVisible(show_bumpiness || show_pbr_normal); + getChildView("bumpyRot")->setVisible(show_bumpiness || show_pbr_normal); + getChildView("bumpyOffsetU")->setVisible(show_bumpiness || show_pbr_normal); + getChildView("bumpyOffsetV")->setVisible(show_bumpiness || show_pbr_normal); // PBR controls getChildView("pbr_control")->setVisible(show_pbr); -- cgit v1.2.3 From 89e9cdd482072e246e4d7fa578929ffad1c54ac4 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 2 Nov 2022 21:54:30 +0200 Subject: SL-18531 Disable texture controls when editing face with material --- indra/newview/llpanelface.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 04957729ed..c4d7eb46df 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1140,11 +1140,11 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) updateAlphaControls(); if (texture_ctrl) - { + { if (identical_diffuse) { texture_ctrl->setTentative(FALSE); - texture_ctrl->setEnabled(editable); + texture_ctrl->setEnabled(editable && !has_pbr_material); texture_ctrl->setImageAssetID(id); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material); getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material); @@ -1154,7 +1154,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) texture_ctrl->setBakeTextureEnabled(TRUE); } else if (id.isNull()) - { + { // None selected texture_ctrl->setTentative(FALSE); texture_ctrl->setEnabled(FALSE); @@ -1165,12 +1165,12 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("label maskcutoff")->setEnabled(FALSE); texture_ctrl->setBakeTextureEnabled(false); - } - else - { + } + else + { // Tentative: multiple selected with different textures texture_ctrl->setTentative(TRUE); - texture_ctrl->setEnabled(editable); + texture_ctrl->setEnabled(editable && !has_pbr_material); texture_ctrl->setImageAssetID(id); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material); getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material); @@ -1185,14 +1185,14 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (shinytexture_ctrl) { shinytexture_ctrl->setTentative( !identical_spec ); - shinytexture_ctrl->setEnabled( editable ); + shinytexture_ctrl->setEnabled( editable && !has_pbr_material); shinytexture_ctrl->setImageAssetID( specmap_id ); } if (bumpytexture_ctrl) { bumpytexture_ctrl->setTentative( !identical_norm ); - bumpytexture_ctrl->setEnabled( editable ); + bumpytexture_ctrl->setEnabled( editable && !has_pbr_material); bumpytexture_ctrl->setImageAssetID( normmap_id ); } } -- cgit v1.2.3 From a87505333e0fcd5ba06da76d0d66e469121e8b30 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 2 Nov 2022 23:39:55 +0200 Subject: SL-18448 Save material button in tools floater --- indra/newview/llpanelface.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index c4d7eb46df..06f69e6fb5 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -203,6 +203,7 @@ BOOL LLPanelFace::postBuild() childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); childSetAction("pbr_from_inventory", &LLPanelFace::onClickBtnLoadInvPBR, this); childSetAction("edit_selected_pbr", &LLPanelFace::onClickBtnEditPBR, this); + childSetAction("save_selected_pbr", &LLPanelFace::onClickBtnSavePBR, this); LLTextureCtrl* mTextureCtrl; LLTextureCtrl* mShinyTextureCtrl; @@ -969,6 +970,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } 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); LLTextureCtrl* texture_ctrl = getChild("texture control"); LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); @@ -1749,8 +1751,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("button align")->setEnabled(FALSE); getChildView("pbr_from_inventory")->setEnabled(FALSE); getChildView("edit_selected_pbr")->setEnabled(FALSE); - //getChildView("has media")->setEnabled(FALSE); - //getChildView("media info set")->setEnabled(FALSE); + getChildView("save_selected_pbr")->setEnabled(FALSE); updateVisibility(); @@ -2682,6 +2683,7 @@ void LLPanelFace::updateVisibility() getChildView("pbr_control")->setVisible(show_pbr); getChildView("pbr_from_inventory")->setVisible(show_pbr); getChildView("edit_selected_pbr")->setVisible(show_pbr); + getChildView("save_selected_pbr")->setVisible(show_pbr); } // static @@ -3669,6 +3671,11 @@ void LLPanelFace::onClickBtnEditPBR(void* userdata) LLMaterialEditor::loadLive(); } +void LLPanelFace::onClickBtnSavePBR(void* userdata) +{ + LLMaterialEditor::saveObjectsMaterialAs(); +} + enum EPasteMode { PASTE_COLOR, -- cgit v1.2.3 From c1180f1cc7370d2ff3acb37d6f6fac08f500661b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 7 Nov 2022 18:02:34 +0200 Subject: SL-18583 Fix race condition when setting multiple faces And fix cases of updates not applying --- indra/newview/llpanelface.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 06f69e6fb5..ab6d4dc1d6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4374,10 +4374,26 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) if (te_data["te"].has("pbr")) { objectp->setRenderMaterialID(te, te_data["te"]["pbr"].asUUID(), false); + + // todo: provide copied overrides here + LLCoros::instance().launch("modifyMaterialCoro", + std::bind(&LLGLTFMaterialList::modifyMaterialCoro, + gAgent.getRegionCapability("ModifyMaterialParams"), + llsd::map( + "object_id", objectp->getID(), + "side", te), nullptr)); } else { objectp->setRenderMaterialID(te, LLUUID::null, false); + + // blank out any override data on the server + LLCoros::instance().launch("modifyMaterialCoro", + std::bind(&LLGLTFMaterialList::modifyMaterialCoro, + gAgent.getRegionCapability("ModifyMaterialParams"), + llsd::map( + "object_id", objectp->getID(), + "side", te), nullptr)); } // Texture map -- cgit v1.2.3 From dafbed80b4cfdf906913a469503db320da49cabf Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 8 Nov 2022 23:14:08 +0200 Subject: SL-18583 Copy&Paste support for overrides And a fix for SL-18583 --- indra/newview/llpanelface.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index ab6d4dc1d6..37ecf72b1b 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -3716,6 +3716,7 @@ struct LLPanelFaceUpdateFunctor : public LLSelectedObjectFunctor { if (mUpdatePbr) { + // setRenderMaterialId is supposed to create it LLRenderMaterialParams* param_block = (LLRenderMaterialParams*)object->getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL); if (param_block) { @@ -3723,10 +3724,14 @@ struct LLPanelFaceUpdateFunctor : public LLSelectedObjectFunctor { object->setHasRenderMaterialParams(false); } - else + else if (object->hasRenderMaterialParams()) { object->parameterChanged(LLNetworkData::PARAMS_RENDER_MATERIAL, true); } + else + { + object->setHasRenderMaterialParams(true); + } } } @@ -3984,6 +3989,10 @@ void LLPanelFace::onCopyTexture() te_data["te"]["bumpshiny"] = tep->getBumpShiny(); te_data["te"]["bumpfullbright"] = tep->getBumpShinyFullbright(); te_data["te"]["pbr"] = objectp->getRenderMaterialID(te); + if (tep->getGLTFMaterialOverride() != nullptr) + { + te_data["te"]["pbr_override"] = tep->getGLTFMaterialOverride()->asJSON(); + } if (te_data["te"].has("imageid")) { @@ -4371,21 +4380,32 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) { objectp->setTEBumpShinyFullbright(te, (U8)te_data["te"]["bumpfullbright"].asInteger()); } + // PBR/GLTF if (te_data["te"].has("pbr")) { - objectp->setRenderMaterialID(te, te_data["te"]["pbr"].asUUID(), false); + objectp->setRenderMaterialID(te, te_data["te"]["pbr"].asUUID(), false /*send in bulk later*/); + tep->setGLTFRenderMaterial(nullptr); + tep->setGLTFMaterialOverride(nullptr); + + LLSD override_data; + override_data["object_id"] = objectp->getID(); + override_data["side"] = te; + if (te_data["te"].has("pbr_override")) + { + override_data["gltf_json"] = te_data["te"]["pbr_override"]; + } - // todo: provide copied overrides here LLCoros::instance().launch("modifyMaterialCoro", std::bind(&LLGLTFMaterialList::modifyMaterialCoro, gAgent.getRegionCapability("ModifyMaterialParams"), - llsd::map( - "object_id", objectp->getID(), - "side", te), nullptr)); + override_data, + nullptr)); } else { - objectp->setRenderMaterialID(te, LLUUID::null, false); + objectp->setRenderMaterialID(te, LLUUID::null, false /*send in bulk later*/ ); + tep->setGLTFRenderMaterial(nullptr); + tep->setGLTFMaterialOverride(nullptr); // blank out any override data on the server LLCoros::instance().launch("modifyMaterialCoro", -- cgit v1.2.3 From d68f379786ed54dbce9dcf921ded4cccd0c5c61e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 10 Nov 2022 17:28:09 +0200 Subject: SL-18583 Fixed incorrect values being applied when returning to a case without override --- indra/newview/llpanelface.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 37ecf72b1b..f88735e275 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4408,12 +4408,7 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) tep->setGLTFMaterialOverride(nullptr); // blank out any override data on the server - LLCoros::instance().launch("modifyMaterialCoro", - std::bind(&LLGLTFMaterialList::modifyMaterialCoro, - gAgent.getRegionCapability("ModifyMaterialParams"), - llsd::map( - "object_id", objectp->getID(), - "side", te), nullptr)); + LLGLTFMaterialList::queueApplyMaterialAsset(objectp->getID(), te, LLUUID::null); } // Texture map -- cgit v1.2.3 From 0ecc677b4970959f1cd7b14f12e01ab331eae6c7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 10 Nov 2022 18:30:41 +0200 Subject: SL-18583 Missed flushUpdates --- indra/newview/llpanelface.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f88735e275..fec5ac906f 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4249,6 +4249,8 @@ void LLPanelFace::onPasteTexture() LLPanelFaceUpdateFunctor sendfunc(true, true); selected_objects->applyToObjects(&sendfunc); + LLGLTFMaterialList::flushUpdates(); + LLPanelFaceNavigateHomeFunctor navigate_home_func; selected_objects->applyToTEs(&navigate_home_func); } -- cgit v1.2.3 From 76de36c40520445d7ad77f85cd6c601942b97032 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 10 Nov 2022 13:21:06 -0600 Subject: SL-18602 Integrate queueModify/queueApply/queueUpdate into all the places that used to post to ModifyMaterialParams directly. --- indra/newview/llpanelface.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f88735e275..b6af2feee3 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4383,7 +4383,7 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) // PBR/GLTF if (te_data["te"].has("pbr")) { - objectp->setRenderMaterialID(te, te_data["te"]["pbr"].asUUID(), false /*send in bulk later*/); + objectp->setRenderMaterialID(te, te_data["te"]["pbr"].asUUID(), false /*managing our own update*/); tep->setGLTFRenderMaterial(nullptr); tep->setGLTFMaterialOverride(nullptr); @@ -4394,12 +4394,14 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) { override_data["gltf_json"] = te_data["te"]["pbr_override"]; } + else + { + override_data["gltf_json"] = ""; + } + + override_data["asset_id"] = te_data["te"]["pbr"].asUUID(); - LLCoros::instance().launch("modifyMaterialCoro", - std::bind(&LLGLTFMaterialList::modifyMaterialCoro, - gAgent.getRegionCapability("ModifyMaterialParams"), - override_data, - nullptr)); + LLGLTFMaterialList::queueUpdate(override_data); } else { @@ -4408,7 +4410,7 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) tep->setGLTFMaterialOverride(nullptr); // blank out any override data on the server - LLGLTFMaterialList::queueApplyMaterialAsset(objectp->getID(), te, LLUUID::null); + LLGLTFMaterialList::queueApply(objectp->getID(), te, LLUUID::null); } // Texture map -- cgit v1.2.3 From 12a86f89e5345569d5cc36941ec7774fe54af298 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 10 Nov 2022 14:16:34 -0600 Subject: SL-18617 Disable fullbright checkbox and color swatch when GLTF material is present. --- indra/newview/llpanelface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index e2ff29039d..0cadfb3eee 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -997,9 +997,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) color_swatch->setOriginal(color); color_swatch->set(color, force_set_values || (prev_color != color) || !editable); - color_swatch->setValid(editable); - color_swatch->setEnabled( editable ); - color_swatch->setCanApplyImmediately( editable ); + color_swatch->setValid(editable && !has_pbr_material); + color_swatch->setEnabled( editable && !has_pbr_material); + color_swatch->setCanApplyImmediately( editable && !has_pbr_material); } // Color transparency @@ -1501,7 +1501,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTE::getFullbright(fullbright_flag,identical_fullbright); getChild("checkbox fullbright")->setValue((S32)(fullbright_flag != 0)); - getChildView("checkbox fullbright")->setEnabled(editable); + getChildView("checkbox fullbright")->setEnabled(editable && !has_pbr_material); getChild("checkbox fullbright")->setTentative(!identical_fullbright); } -- cgit v1.2.3 From eab3d43e1b2283ba07037cec7ccce78dc4022f1d Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Thu, 10 Nov 2022 14:20:51 -0800 Subject: SL-18627: Make space for pbr transform controls in build floater and disable some WIP controls --- indra/newview/llpanelface.cpp | 331 +++++++++++++++++++++++------------------- 1 file changed, 182 insertions(+), 149 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 37ecf72b1b..64b31a25f4 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -108,9 +108,11 @@ const S32 MATTYPE_SPECULAR = 2; // Specular map const S32 ALPHAMODE_MASK = 2; // Alpha masking mode const S32 BUMPY_TEXTURE = 18; // use supplied normal map const S32 SHINY_TEXTURE = 4; // use supplied specular map -const S32 PBRTYPE_BASE_COLOR = 0; // PBR Base Color -const S32 PBRTYPE_NORMAL = 1; // PBR Normal -const S32 PBRTYPE_METALLIC = 2; // PBR Metallic +const S32 PBRTYPE_RENDER_MATERIAL_ID = 0; // Render Material ID +const S32 PBRTYPE_BASE_COLOR = 1; // PBR Base Color +const S32 PBRTYPE_NORMAL = 2; // PBR Normal +const S32 PBRTYPE_METALLIC_ROUGHNESS = 3; // PBR Metallic +const S32 PBRTYPE_EMISSIVE = 4; // PBR Emissive BOOST_STATIC_ASSERT(MATTYPE_DIFFUSE == LLRender::DIFFUSE_MAP && MATTYPE_NORMAL == LLRender::NORMAL_MAP && MATTYPE_SPECULAR == LLRender::SPECULAR_MAP); @@ -199,6 +201,12 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("add_media", &LLPanelFace::onClickBtnAddMedia, this); childSetCommitCallback("delete_media", &LLPanelFace::onClickBtnDeleteMedia, this); + childSetCommitCallback("gltfTextureScaleU", &LLPanelFace::onCommitGLTFTextureScaleU, this); + childSetCommitCallback("gltfTextureScaleV", &LLPanelFace::onCommitGLTFTextureScaleV, this); + childSetCommitCallback("gltfRotation", &LLPanelFace::onCommitGLTFRotation, this); + childSetCommitCallback("gltfTextureTranslationU", &LLPanelFace::onCommitGLTFTextureTranslationU, this); + childSetCommitCallback("gltfTextureTranslationV", &LLPanelFace::onCommitGLTFTextureTranslationV, this); + childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); childSetAction("pbr_from_inventory", &LLPanelFace::onClickBtnLoadInvPBR, this); @@ -363,7 +371,7 @@ BOOL LLPanelFace::postBuild() if (radio_pbr_type) { radio_pbr_type->setCommitCallback(LLPanelFace::onCommitPbrType, this); - radio_pbr_type->selectNthItem(PBRTYPE_BASE_COLOR); + radio_pbr_type->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); } mCtrlGlow = getChild("glow"); @@ -537,41 +545,21 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor BOOL valid; F32 value; std::string prefix; - U32 materials_media = mPanel->getChild("combobox matmedia")->getCurrentIndex(); - if (MATMEDIA_PBR == materials_media) + // Effectively the same as MATMEDIA_PBR sans using different radio, + // separate for the sake of clarity + LLRadioGroup * radio_mat_type = mPanel->getChild("radio_material_type"); + switch (radio_mat_type->getSelectedIndex()) { - LLRadioGroup * radio_pbr_type = mPanel->getChild("radio_pbr_type"); - switch (radio_pbr_type->getSelectedIndex()) - { - case PBRTYPE_BASE_COLOR: - prefix = "Tex"; - break; - case PBRTYPE_NORMAL: - prefix = "bumpy"; - break; - case PBRTYPE_METALLIC: - prefix = "shiny"; - break; - } - } - else - { - // Effectively the same as MATMEDIA_PBR sans using different radio, - // separate for the sake of clarity - LLRadioGroup * radio_mat_type = mPanel->getChild("radio_material_type"); - switch (radio_mat_type->getSelectedIndex()) - { - case MATTYPE_DIFFUSE: - prefix = "Tex"; - break; - case MATTYPE_NORMAL: - prefix = "bumpy"; - break; - case MATTYPE_SPECULAR: - prefix = "shiny"; - break; - } + case MATTYPE_DIFFUSE: + prefix = "Tex"; + break; + case MATTYPE_NORMAL: + prefix = "bumpy"; + break; + case MATTYPE_SPECULAR: + prefix = "shiny"; + break; } LLSpinCtrl * ctrlTexScaleS = mPanel->getChild(prefix + "ScaleU"); @@ -921,6 +909,11 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) { BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); + bool has_pbr_material; + updateUIGLTF(objectp, has_pbr_material, force_set_values); + + const bool has_material = !has_pbr_material; + // only turn on auto-adjust button if there is a media renderer and the media is loaded childSetEnabled("button align", editable); @@ -938,40 +931,25 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) radio_mat_type->setEnabled(editable); LLRadioGroup* radio_pbr_type = getChild("radio_pbr_type"); - if (radio_pbr_type->getSelectedIndex() < PBRTYPE_BASE_COLOR) + if (radio_pbr_type->getSelectedIndex() < PBRTYPE_RENDER_MATERIAL_ID) { - radio_pbr_type->selectNthItem(PBRTYPE_BASE_COLOR); + radio_pbr_type->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); } radio_pbr_type->setEnabled(editable); getChildView("checkbox_sync_settings")->setEnabled(editable); childSetValue("checkbox_sync_settings", gSavedSettings.getBOOL("SyncMaterialSettings")); + updateVisibility(); + // *NOTE: The "identical" variable is currently only used to decide if + // the texgen control should be tentative - this is not used by GLTF + // materials. -Cosmic;2022-11-09 bool identical = true; // true because it is anded below bool identical_diffuse = false; bool identical_norm = false; bool identical_spec = false; - // pbr material - bool has_pbr_material = false; - LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); - if (pbr_ctrl) - { - LLUUID pbr_id; - bool identical_pbr; - LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr); - identical &= identical_pbr; - - pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); - pbr_ctrl->setEnabled(editable); - 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); - LLTextureCtrl* texture_ctrl = getChild("texture control"); LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); @@ -982,7 +960,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // Color swatch { - getChildView("color label")->setEnabled(editable && !has_pbr_material); + getChildView("color label")->setEnabled(editable); } LLColorSwatchCtrl* color_swatch = findChild("colorswatch"); @@ -1003,11 +981,11 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } // Color transparency - getChildView("color trans")->setEnabled(editable && !has_pbr_material); + getChildView("color trans")->setEnabled(editable); F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; getChild("ColorTrans")->setValue(editable ? transparency : 0); - getChildView("ColorTrans")->setEnabled(editable && !has_pbr_material); + getChildView("ColorTrans")->setEnabled(editable); // Specular map LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); @@ -1266,18 +1244,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("shinyScaleU")->setValue(spec_scale_s); getChild("bumpyScaleU")->setValue(norm_scale_s); - if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) - { - getChildView("TexScaleU")->setEnabled(editable && has_pbr_material); - getChildView("shinyScaleU")->setEnabled(editable && has_pbr_material); - getChildView("bumpyScaleU")->setEnabled(editable && has_pbr_material); - } - else - { - getChildView("TexScaleU")->setEnabled(editable); - getChildView("shinyScaleU")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyScaleU")->setEnabled(editable && normmap_id.notNull()); - } + getChildView("TexScaleU")->setEnabled(editable && has_material); + getChildView("shinyScaleU")->setEnabled(editable && has_material && specmap_id.notNull()); + getChildView("bumpyScaleU")->setEnabled(editable && has_material && normmap_id.notNull()); BOOL diff_scale_tentative = !(identical && identical_diff_scale_s); BOOL norm_scale_tentative = !(identical && identical_norm_scale_s); @@ -1314,18 +1283,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) BOOL norm_scale_tentative = !identical_norm_scale_t; BOOL spec_scale_tentative = !identical_spec_scale_t; - if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) - { - getChildView("TexScaleV")->setEnabled(editable && has_pbr_material); - getChildView("shinyScaleV")->setEnabled(editable && has_pbr_material); - getChildView("bumpyScaleV")->setEnabled(editable && has_pbr_material); - } - else - { - getChildView("TexScaleV")->setEnabled(editable); - getChildView("shinyScaleV")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyScaleV")->setEnabled(editable && normmap_id.notNull()); - } + getChildView("TexScaleV")->setEnabled(editable && has_material); + getChildView("shinyScaleV")->setEnabled(editable && has_material && specmap_id.notNull()); + getChildView("bumpyScaleV")->setEnabled(editable && has_material && normmap_id.notNull()); if (force_set_values) { @@ -1369,18 +1329,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("shinyOffsetU")->setTentative(LLSD(norm_offset_u_tentative)); getChild("bumpyOffsetU")->setTentative(LLSD(spec_offset_u_tentative)); - if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) - { - getChildView("TexOffsetU")->setEnabled(editable && has_pbr_material); - getChildView("shinyOffsetU")->setEnabled(editable && has_pbr_material); - getChildView("bumpyOffsetU")->setEnabled(editable && has_pbr_material); - } - else - { - getChildView("TexOffsetU")->setEnabled(editable); - getChildView("shinyOffsetU")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyOffsetU")->setEnabled(editable && normmap_id.notNull()); - } + getChildView("TexOffsetU")->setEnabled(editable && has_material); + getChildView("shinyOffsetU")->setEnabled(editable && has_material && specmap_id.notNull()); + getChildView("bumpyOffsetU")->setEnabled(editable && has_material && normmap_id.notNull()); } { @@ -1408,18 +1359,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("shinyOffsetV")->setTentative(LLSD(norm_offset_v_tentative)); getChild("bumpyOffsetV")->setTentative(LLSD(spec_offset_v_tentative)); - if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) - { - getChildView("TexOffsetV")->setEnabled(editable && has_pbr_material); - getChildView("shinyOffsetV")->setEnabled(editable && has_pbr_material); - getChildView("bumpyOffsetV")->setEnabled(editable && has_pbr_material); - } - else - { - getChildView("TexOffsetV")->setEnabled(editable); - getChildView("shinyOffsetV")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyOffsetV")->setEnabled(editable && normmap_id.notNull()); - } + getChildView("TexOffsetV")->setEnabled(editable && has_material); + getChildView("shinyOffsetV")->setEnabled(editable && has_material && specmap_id.notNull()); + getChildView("bumpyOffsetV")->setEnabled(editable && has_material && normmap_id.notNull()); } // Texture rotation @@ -1444,18 +1386,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 norm_rot_deg = norm_rotation * RAD_TO_DEG; F32 spec_rot_deg = spec_rotation * RAD_TO_DEG; - if (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR) - { - getChildView("TexRot")->setEnabled(editable && has_pbr_material); - getChildView("shinyRot")->setEnabled(editable && has_pbr_material); - getChildView("bumpyRot")->setEnabled(editable && has_pbr_material); - } - else - { - getChildView("TexRot")->setEnabled(editable); - getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull()); - getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull()); - } + getChildView("TexRot")->setEnabled(editable && has_material); + getChildView("shinyRot")->setEnabled(editable && has_material && specmap_id.notNull()); + getChildView("bumpyRot")->setEnabled(editable && has_material && normmap_id.notNull()); getChild("TexRot")->setTentative(diff_rot_tentative); getChild("shinyRot")->setTentative(LLSD(norm_rot_tentative)); @@ -1579,7 +1512,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) BOOL repeats_tentative = !identical_repeats; - getChildView("rptctrl")->setEnabled(identical_planar_texgen ? FALSE : enabled); LLSpinCtrl* rpt_ctrl = getChild("rptctrl"); if (force_set_values) { @@ -1591,6 +1523,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) rpt_ctrl->setValue(editable ? repeats : 1.0f); } rpt_ctrl->setTentative(LLSD(repeats_tentative)); + rpt_ctrl->setEnabled(has_material && !identical_planar_texgen && enabled); } } @@ -1767,6 +1700,57 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } } +void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, bool force_set_values) +{ + has_pbr_material = false; + + BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); + + // pbr material + LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); + if (pbr_ctrl) + { + LLUUID pbr_id; + bool identical_pbr; + LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr); + + pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); + pbr_ctrl->setEnabled(editable); + 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); +} + +void LLPanelFace::updateVisibilityGLTF() +{ + const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); + + LLRadioGroup* radio_pbr_type = findChild("radio_pbr_type"); + radio_pbr_type->setVisible(show_pbr); + + const U32 pbr_type = radio_pbr_type->getSelectedIndex(); + const bool show_pbr_render_material_id = show_pbr && (pbr_type == PBRTYPE_RENDER_MATERIAL_ID); + const bool show_pbr_base_color = show_pbr && (pbr_type == PBRTYPE_BASE_COLOR); + const bool show_pbr_normal = show_pbr && (pbr_type == PBRTYPE_NORMAL); + const bool show_pbr_metallic_roughness = show_pbr && (pbr_type == PBRTYPE_METALLIC_ROUGHNESS); + const bool show_pbr_emissive = show_pbr && (pbr_type == PBRTYPE_EMISSIVE); + const bool show_pbr_transform = show_pbr_base_color || show_pbr_normal || show_pbr_metallic_roughness || show_pbr_emissive; + + getChildView("pbr_control")->setVisible(show_pbr_render_material_id); + + getChildView("pbr_from_inventory")->setVisible(show_pbr_render_material_id); + getChildView("edit_selected_pbr")->setVisible(show_pbr_render_material_id); + getChildView("save_selected_pbr")->setVisible(show_pbr_render_material_id); + + getChildView("gltfTextureScaleU")->setVisible(show_pbr_transform); + getChildView("gltfTextureScaleV")->setVisible(show_pbr_transform); + getChildView("gltfTextureRotation")->setVisible(show_pbr_transform); + getChildView("gltfTextureTranslationU")->setVisible(show_pbr_transform); + getChildView("gltfTextureTranslationV")->setVisible(show_pbr_transform); +} void LLPanelFace::updateCopyTexButton() { @@ -2608,19 +2592,19 @@ void LLPanelFace::updateVisibility() } U32 materials_media = mComboMatMedia->getCurrentIndex(); U32 material_type = radio_mat_type->getSelectedIndex(); - U32 pbr_type = radio_pbr_type->getSelectedIndex(); bool show_media = (materials_media == MATMEDIA_MEDIA) && mComboMatMedia->getEnabled(); bool show_material = materials_media == MATMEDIA_MATERIAL; - bool show_pbr = materials_media == MATMEDIA_PBR; bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && mComboMatMedia->getEnabled())); bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled(); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); - bool show_pbr_base_color = show_pbr && (pbr_type == PBRTYPE_BASE_COLOR) && mComboMatMedia->getEnabled(); - bool show_pbr_normal = show_pbr && (pbr_type == PBRTYPE_NORMAL) && mComboMatMedia->getEnabled(); - bool show_pbr_metallic = show_pbr && (pbr_type == PBRTYPE_METALLIC) && mComboMatMedia->getEnabled(); radio_mat_type->setVisible(show_material); - radio_pbr_type->setVisible(show_pbr); + + // Shared material controls + getChildView("checkbox_sync_settings")->setVisible(show_material || show_media); + getChildView("tex gen")->setVisible(show_material || show_media); + getChildView("combobox texgen")->setVisible(show_material || show_media); + getChildView("button align textures")->setVisible(show_material || show_media); // Media controls mTitleMediaText->setVisible(show_media); @@ -2634,16 +2618,16 @@ void LLPanelFace::updateVisibility() getChildView("combobox alphamode")->setVisible(show_texture && show_material); getChildView("label maskcutoff")->setVisible(false); getChildView("maskcutoff")->setVisible(false); - if ((show_texture && show_material) || show_pbr) + if (show_texture && show_material) { updateAlphaControls(); } - // texture scale and position controls are shared between bpr and non-pbr textures - getChildView("TexScaleU")->setVisible(show_texture || show_pbr_base_color); - getChildView("TexScaleV")->setVisible(show_texture || show_pbr_base_color); - getChildView("TexRot")->setVisible(show_texture || show_pbr_base_color); - getChildView("TexOffsetU")->setVisible(show_texture || show_pbr_base_color); - getChildView("TexOffsetV")->setVisible(show_texture || show_pbr_base_color); + // texture scale and position controls + getChildView("TexScaleU")->setVisible(show_texture); + getChildView("TexScaleV")->setVisible(show_texture); + getChildView("TexRot")->setVisible(show_texture); + getChildView("TexOffsetU")->setVisible(show_texture); + getChildView("TexOffsetV")->setVisible(show_texture); // Specular map controls getChildView("shinytexture control")->setVisible(show_shininess); @@ -2659,11 +2643,11 @@ void LLPanelFace::updateVisibility() { updateShinyControls(); } - getChildView("shinyScaleU")->setVisible(show_shininess || show_pbr_metallic); - getChildView("shinyScaleV")->setVisible(show_shininess || show_pbr_metallic); - getChildView("shinyRot")->setVisible(show_shininess || show_pbr_metallic); - getChildView("shinyOffsetU")->setVisible(show_shininess || show_pbr_metallic); - getChildView("shinyOffsetV")->setVisible(show_shininess || show_pbr_metallic); + getChildView("shinyScaleU")->setVisible(show_shininess); + getChildView("shinyScaleV")->setVisible(show_shininess); + getChildView("shinyRot")->setVisible(show_shininess); + getChildView("shinyOffsetU")->setVisible(show_shininess); + getChildView("shinyOffsetV")->setVisible(show_shininess); // Normal map controls if (show_bumpiness) @@ -2673,17 +2657,16 @@ void LLPanelFace::updateVisibility() getChildView("bumpytexture control")->setVisible(show_bumpiness); getChildView("combobox bumpiness")->setVisible(show_bumpiness); getChildView("label bumpiness")->setVisible(show_bumpiness); - getChildView("bumpyScaleU")->setVisible(show_bumpiness || show_pbr_normal); - getChildView("bumpyScaleV")->setVisible(show_bumpiness || show_pbr_normal); - getChildView("bumpyRot")->setVisible(show_bumpiness || show_pbr_normal); - getChildView("bumpyOffsetU")->setVisible(show_bumpiness || show_pbr_normal); - getChildView("bumpyOffsetV")->setVisible(show_bumpiness || show_pbr_normal); + getChildView("bumpyScaleU")->setVisible(show_bumpiness); + getChildView("bumpyScaleV")->setVisible(show_bumpiness); + getChildView("bumpyRot")->setVisible(show_bumpiness); + getChildView("bumpyOffsetU")->setVisible(show_bumpiness); + getChildView("bumpyOffsetV")->setVisible(show_bumpiness); + + getChild("rptctrl")->setVisible(show_material || show_media); // PBR controls - getChildView("pbr_control")->setVisible(show_pbr); - getChildView("pbr_from_inventory")->setVisible(show_pbr); - getChildView("edit_selected_pbr")->setVisible(show_pbr); - getChildView("save_selected_pbr")->setVisible(show_pbr); + updateVisibilityGLTF(); } // static @@ -4556,6 +4539,56 @@ void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata) self->sendTextureInfo(); } +// static +void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl, void* userdata) +{ +#if 0 + LLPanelFace* self = (LLPanelFace*)userdata; + LL_WARNS() << ctrl->getValue().asReal() << LL_ENDL; // TODO: Remove + // TODO +#endif +} + +// static +void LLPanelFace::onCommitGLTFTextureScaleV(LLUICtrl* ctrl, void* userdata) +{ +#if 0 + LLPanelFace* self = (LLPanelFace*)userdata; + LL_WARNS() << ctrl->getValue().asReal() << LL_ENDL; // TODO: Remove + // TODO +#endif +} + +// static +void LLPanelFace::onCommitGLTFRotation(LLUICtrl* ctrl, void* userdata) +{ +#if 0 + LLPanelFace* self = (LLPanelFace*)userdata; + LL_WARNS() << ctrl->getValue().asReal() << LL_ENDL; // TODO: Remove + // TODO +#endif +} + +// static +void LLPanelFace::onCommitGLTFTextureTranslationU(LLUICtrl* ctrl, void* userdata) +{ +#if 0 + LLPanelFace* self = (LLPanelFace*)userdata; + LL_WARNS() << ctrl->getValue().asReal() << LL_ENDL; // TODO: Remove + // TODO +#endif +} + +// static +void LLPanelFace::onCommitGLTFTextureTranslationV(LLUICtrl* ctrl, void* userdata) +{ +#if 0 + LLPanelFace* self = (LLPanelFace*)userdata; + LL_WARNS() << ctrl->getValue().asReal() << LL_ENDL; // TODO: Remove + // TODO +#endif +} + void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) { LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL; -- cgit v1.2.3 From fd76c195c83d4af7469cc41f59c3fdcb02716012 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 11 Nov 2022 15:53:45 -0800 Subject: SL-18632: Implement editing GLTF material texture transforms in build floater --- indra/newview/llpanelface.cpp | 245 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 202 insertions(+), 43 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9d720b1523..f43a5d7dbe 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -114,6 +114,73 @@ const S32 PBRTYPE_NORMAL = 2; // PBR Normal const S32 PBRTYPE_METALLIC_ROUGHNESS = 3; // PBR Metallic const S32 PBRTYPE_EMISSIVE = 4; // PBR Emissive +LLGLTFMaterial::TextureInfo texture_info_from_pbrtype(S32 pbr_type) +{ + switch (pbr_type) + { + case PBRTYPE_BASE_COLOR: + return LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR; + break; + case PBRTYPE_NORMAL: + return LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL; + break; + case PBRTYPE_METALLIC_ROUGHNESS: + return LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS; + break; + case PBRTYPE_EMISSIVE: + return LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE; + break; + default: + return LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; + break; + } +} + +void updateSelectedGLTFMaterials(std::function func) +{ + struct LLSelectedTEGLTFMaterialFunctor : public LLSelectedTEFunctor + { + LLSelectedTEGLTFMaterialFunctor(std::function func) : mFunc(func) {} + virtual ~LLSelectedTEGLTFMaterialFunctor() {}; + bool apply(LLViewerObject* object, S32 face) override + { + LLGLTFMaterial new_override; + const LLTextureEntry* tep = object->getTE(face); + if (tep->getGLTFMaterialOverride()) + { + new_override = *tep->getGLTFMaterialOverride(); + } + mFunc(&new_override); + LLGLTFMaterialList::queueModify(object->getID(), face, &new_override); + + return true; + } + + std::function mFunc; + } select_func(func); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&select_func); +} + +template +void readSelectedGLTFMaterial(std::function func, T& value, bool& identical, bool has_tolerance, T tolerance) +{ + struct LLSelectedTEGetGLTFMaterialFunctor : public LLSelectedTEGetFunctor + { + LLSelectedTEGetGLTFMaterialFunctor(std::function func) : mFunc(func) {} + virtual ~LLSelectedTEGetGLTFMaterialFunctor() {}; + T get(LLViewerObject* object, S32 face) override + { + const LLTextureEntry* tep = object->getTE(face); + const LLGLTFMaterial* render_material = tep->getGLTFRenderMaterial(); + + return mFunc(render_material); + } + + std::function mFunc; + } select_func(func); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&select_func, value, has_tolerance, tolerance); +} + BOOST_STATIC_ASSERT(MATTYPE_DIFFUSE == LLRender::DIFFUSE_MAP && MATTYPE_NORMAL == LLRender::NORMAL_MAP && MATTYPE_SPECULAR == LLRender::SPECULAR_MAP); // @@ -201,11 +268,11 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("add_media", &LLPanelFace::onClickBtnAddMedia, this); childSetCommitCallback("delete_media", &LLPanelFace::onClickBtnDeleteMedia, this); - childSetCommitCallback("gltfTextureScaleU", &LLPanelFace::onCommitGLTFTextureScaleU, this); - childSetCommitCallback("gltfTextureScaleV", &LLPanelFace::onCommitGLTFTextureScaleV, this); - childSetCommitCallback("gltfRotation", &LLPanelFace::onCommitGLTFRotation, this); - childSetCommitCallback("gltfTextureTranslationU", &LLPanelFace::onCommitGLTFTextureTranslationU, this); - childSetCommitCallback("gltfTextureTranslationV", &LLPanelFace::onCommitGLTFTextureTranslationV, this); + childSetCommitCallback("gltfTextureScaleU", boost::bind(&LLPanelFace::onCommitGLTFTextureScaleU, this, _1), nullptr); + childSetCommitCallback("gltfTextureScaleV", boost::bind(&LLPanelFace::onCommitGLTFTextureScaleV, this, _1), nullptr); + childSetCommitCallback("gltfTextureRotation", boost::bind(&LLPanelFace::onCommitGLTFRotation, this, _1), nullptr); + childSetCommitCallback("gltfTextureOffsetU", boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetU, this, _1), nullptr); + childSetCommitCallback("gltfTextureOffsetV", boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetV, this, _1), nullptr); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); @@ -1722,6 +1789,70 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, 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); + + const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); + if (show_pbr) + { + + const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + const bool show_texture_info = texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; + + LLUICtrl* gltfCtrlTextureScaleU = getChild("gltfTextureScaleU"); + LLUICtrl* gltfCtrlTextureScaleV = getChild("gltfTextureScaleV"); + LLUICtrl* gltfCtrlTextureRotation = getChild("gltfTextureRotation"); + LLUICtrl* gltfCtrlTextureOffsetU = getChild("gltfTextureOffsetU"); + LLUICtrl* gltfCtrlTextureOffsetV = getChild("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); + + if (show_texture_info) + { + LLGLTFMaterial::TextureTransform transform; + bool scale_u_same = true; + bool scale_v_same = true; + bool rotation_same = true; + bool offset_u_same = true; + bool offset_v_same = true; + + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat->mTextureTransform[texture_info].mScale[VX]; + }, transform.mScale[VX], scale_u_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat->mTextureTransform[texture_info].mScale[VY]; + }, transform.mScale[VY], scale_v_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat->mTextureTransform[texture_info].mRotation; + }, transform.mRotation, rotation_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat->mTextureTransform[texture_info].mOffset[VX]; + }, transform.mOffset[VX], offset_u_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat->mTextureTransform[texture_info].mOffset[VY]; + }, transform.mOffset[VY], offset_v_same, true, 1e-3f); + + gltfCtrlTextureScaleU->setValue(transform.mScale[VX]); + gltfCtrlTextureScaleV->setValue(transform.mScale[VY]); + gltfCtrlTextureRotation->setValue(transform.mRotation * RAD_TO_DEG); + gltfCtrlTextureOffsetU->setValue(transform.mOffset[VX]); + gltfCtrlTextureOffsetV->setValue(transform.mOffset[VY]); + + gltfCtrlTextureScaleU->setTentative(!scale_u_same); + gltfCtrlTextureScaleV->setTentative(!scale_v_same); + gltfCtrlTextureRotation->setTentative(!rotation_same); + gltfCtrlTextureOffsetU->setTentative(!offset_u_same); + gltfCtrlTextureOffsetV->setTentative(!offset_v_same); + } + } } void LLPanelFace::updateVisibilityGLTF() @@ -1748,8 +1879,8 @@ void LLPanelFace::updateVisibilityGLTF() getChildView("gltfTextureScaleU")->setVisible(show_pbr_transform); getChildView("gltfTextureScaleV")->setVisible(show_pbr_transform); getChildView("gltfTextureRotation")->setVisible(show_pbr_transform); - getChildView("gltfTextureTranslationU")->setVisible(show_pbr_transform); - getChildView("gltfTextureTranslationV")->setVisible(show_pbr_transform); + getChildView("gltfTextureOffsetU")->setVisible(show_pbr_transform); + getChildView("gltfTextureOffsetV")->setVisible(show_pbr_transform); } void LLPanelFace::updateCopyTexButton() @@ -2597,11 +2728,15 @@ void LLPanelFace::updateVisibility() bool show_texture = (show_media || (show_material && (material_type == MATTYPE_DIFFUSE) && mComboMatMedia->getEnabled())); bool show_bumpiness = show_material && (material_type == MATTYPE_NORMAL) && mComboMatMedia->getEnabled(); bool show_shininess = show_material && (material_type == MATTYPE_SPECULAR) && mComboMatMedia->getEnabled(); + const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); + const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + const bool show_texture_info = show_pbr && texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; radio_mat_type->setVisible(show_material); // Shared material controls - getChildView("checkbox_sync_settings")->setVisible(show_material || show_media); + getChildView("checkbox_sync_settings")->setVisible(show_material || show_media || show_texture_info); getChildView("tex gen")->setVisible(show_material || show_media); getChildView("combobox texgen")->setVisible(show_material || show_media); getChildView("button align textures")->setVisible(show_material || show_media); @@ -4538,54 +4673,78 @@ void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata) self->sendTextureInfo(); } -// static -void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl, void* userdata) +void updateGLTFTextureTransform(float value, U32 pbr_type, std::function edit) { -#if 0 - LLPanelFace* self = (LLPanelFace*)userdata; - LL_WARNS() << ctrl->getValue().asReal() << LL_ENDL; // TODO: Remove - // TODO -#endif + U32 texture_info_start; + U32 texture_info_end; + if (gSavedSettings.getBOOL("SyncMaterialSettings")) + { + texture_info_start = 0; + texture_info_end = LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; + } + else + { + texture_info_start = texture_info_from_pbrtype(pbr_type); + texture_info_end = texture_info_start + 1; + } + updateSelectedGLTFMaterials([&](LLGLTFMaterial* new_override) + { + for (U32 ti = texture_info_start; ti < texture_info_end; ++ti) + { + LLGLTFMaterial::TextureTransform& new_transform = new_override->mTextureTransform[(LLGLTFMaterial::TextureInfo)ti]; + edit(&new_transform); + } + }); } -// static -void LLPanelFace::onCommitGLTFTextureScaleV(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl) { -#if 0 - LLPanelFace* self = (LLPanelFace*)userdata; - LL_WARNS() << ctrl->getValue().asReal() << LL_ENDL; // TODO: Remove - // TODO -#endif + const float value = ctrl->getValue().asReal(); + const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + { + new_transform->mScale.mV[VX] = value; + }); } -// static -void LLPanelFace::onCommitGLTFRotation(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitGLTFTextureScaleV(LLUICtrl* ctrl) +{ + const float value = ctrl->getValue().asReal(); + const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + { + new_transform->mScale.mV[VY] = value; + }); +} + +void LLPanelFace::onCommitGLTFRotation(LLUICtrl* ctrl) { -#if 0 - LLPanelFace* self = (LLPanelFace*)userdata; - LL_WARNS() << ctrl->getValue().asReal() << LL_ENDL; // TODO: Remove - // TODO -#endif + const float value = ctrl->getValue().asReal() * DEG_TO_RAD; + const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + { + new_transform->mRotation = value; + }); } -// static -void LLPanelFace::onCommitGLTFTextureTranslationU(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitGLTFTextureOffsetU(LLUICtrl* ctrl) { -#if 0 - LLPanelFace* self = (LLPanelFace*)userdata; - LL_WARNS() << ctrl->getValue().asReal() << LL_ENDL; // TODO: Remove - // TODO -#endif + const float value = ctrl->getValue().asReal(); + const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + { + new_transform->mOffset.mV[VX] = value; + }); } -// static -void LLPanelFace::onCommitGLTFTextureTranslationV(LLUICtrl* ctrl, void* userdata) +void LLPanelFace::onCommitGLTFTextureOffsetV(LLUICtrl* ctrl) { -#if 0 - LLPanelFace* self = (LLPanelFace*)userdata; - LL_WARNS() << ctrl->getValue().asReal() << LL_ENDL; // TODO: Remove - // TODO -#endif + const float value = ctrl->getValue().asReal(); + const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + updateGLTFTextureTransform(value, pbr_type, [&](LLGLTFMaterial::TextureTransform* new_transform) + { + new_transform->mOffset.mV[VY] = value; + }); } void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp) -- cgit v1.2.3 From 62aa0e807f9eb1eeb2db0296fc942bab2faa0e13 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Wed, 16 Nov 2022 12:04:16 -0800 Subject: SL-18632: Un-hide planar align options when editing GLTF textures in build floater --- indra/newview/llpanelface.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f43a5d7dbe..d620704019 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1003,6 +1003,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) radio_pbr_type->selectNthItem(PBRTYPE_RENDER_MATERIAL_ID); } radio_pbr_type->setEnabled(editable); + const bool pbr_selected = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR; + const bool texture_info_selected = pbr_selected && radio_pbr_type->getSelectedIndex() != PBRTYPE_RENDER_MATERIAL_ID; getChildView("checkbox_sync_settings")->setEnabled(editable); childSetValue("checkbox_sync_settings", gSavedSettings.getBOOL("SyncMaterialSettings")); @@ -1251,9 +1253,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLCheckBoxCtrl* cb_planar_align = getChild("checkbox planar align"); align_planar = (cb_planar_align && cb_planar_align->get()); - bool enabled = (editable && isIdenticalPlanarTexgen()); + bool enabled = (editable && isIdenticalPlanarTexgen() && (!pbr_selected || texture_info_selected)); childSetValue("checkbox planar align", align_planar && enabled); - childSetVisible("checkbox planar align", enabled); + childSetVisible("checkbox planar align", enabled); childSetEnabled("checkbox planar align", enabled); childSetEnabled("button align textures", enabled && LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1); @@ -2737,8 +2739,8 @@ void LLPanelFace::updateVisibility() // Shared material controls getChildView("checkbox_sync_settings")->setVisible(show_material || show_media || show_texture_info); - getChildView("tex gen")->setVisible(show_material || show_media); - getChildView("combobox texgen")->setVisible(show_material || show_media); + getChildView("tex gen")->setVisible(show_material || show_media || show_texture_info); + getChildView("combobox texgen")->setVisible(show_material || show_media || show_texture_info); getChildView("button align textures")->setVisible(show_material || show_media); // Media controls -- cgit v1.2.3 From ade79bc6f6b6269dbcb88f3dff2db6584d0c2f53 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 18 Nov 2022 21:06:48 +0200 Subject: SL-18677 Disable materials UI when materials caps are not available --- indra/newview/llpanelface.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'indra/newview/llpanelface.cpp') 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("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("gltfTextureOffsetU"); LLUICtrl* gltfCtrlTextureOffsetV = getChild("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([&](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([&](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([&](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([&](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([&](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]); -- cgit v1.2.3 From 32984b56ea8fa4f4357379a40627b5e9267d7543 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 24 Nov 2022 12:16:59 +0200 Subject: SL-18701 llsd is not thread safe, parse it before using --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 98f7adabd9..84b1ff63f4 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1774,7 +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(); + bool has_pbr_capabilities = LLMaterialEditor::capabilitiesAvailable(); // pbr material LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); -- cgit v1.2.3 From a989eba0808b2e5fda5494ff3b109784aa79984e Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 21 Nov 2022 16:09:07 -0800 Subject: SL-18732: Fix flickering of control values when changing GLTF texture transforms in build floater --- indra/newview/llpanelface.cpp | 227 ++++++++++++++++++++++++++++++++---------- 1 file changed, 172 insertions(+), 55 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 84b1ff63f4..b7e92bf315 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -32,7 +32,6 @@ // library includes #include "llcalc.h" #include "llerror.h" -#include "llfocusmgr.h" #include "llrect.h" #include "llstring.h" #include "llfontgl.h" @@ -95,6 +94,8 @@ using namespace std::literals; +LLPanelFace::Selection LLPanelFace::sMaterialOverrideSelection; + // // Constant definitions for comboboxes // Must match the commbobox definitions in panel_tools_texture.xml @@ -136,7 +137,7 @@ LLGLTFMaterial::TextureInfo texture_info_from_pbrtype(S32 pbr_type) } } -void updateSelectedGLTFMaterials(std::function func) +void LLPanelFace::updateSelectedGLTFMaterials(std::function func) { struct LLSelectedTEGLTFMaterialFunctor : public LLSelectedTEFunctor { @@ -158,6 +159,7 @@ void updateSelectedGLTFMaterials(std::function func) std::function mFunc; } select_func(func); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&select_func); } @@ -268,11 +270,14 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("add_media", &LLPanelFace::onClickBtnAddMedia, this); childSetCommitCallback("delete_media", &LLPanelFace::onClickBtnDeleteMedia, this); - childSetCommitCallback("gltfTextureScaleU", boost::bind(&LLPanelFace::onCommitGLTFTextureScaleU, this, _1), nullptr); - childSetCommitCallback("gltfTextureScaleV", boost::bind(&LLPanelFace::onCommitGLTFTextureScaleV, this, _1), nullptr); - childSetCommitCallback("gltfTextureRotation", boost::bind(&LLPanelFace::onCommitGLTFRotation, this, _1), nullptr); - childSetCommitCallback("gltfTextureOffsetU", boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetU, this, _1), nullptr); - childSetCommitCallback("gltfTextureOffsetV", boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetV, this, _1), nullptr); + getChild("gltfTextureScaleU")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureScaleU, this, _1), nullptr); + getChild("gltfTextureScaleV")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureScaleV, this, _1), nullptr); + getChild("gltfTextureRotation")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFRotation, this, _1), nullptr); + getChild("gltfTextureOffsetU")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetU, this, _1), nullptr); + getChild("gltfTextureOffsetV")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetV, this, _1), nullptr); + + LLGLTFMaterialList::addUpdateCallback(&LLPanelFace::onMaterialOverrideReceived); + sMaterialOverrideSelection.connect(); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); childSetAction("button align textures", &LLPanelFace::onAlignTexture, this); @@ -486,6 +491,11 @@ void LLPanelFace::draw() updateMediaTitle(); LLPanel::draw(); + + if (sMaterialOverrideSelection.update()) + { + setMaterialOverridesFromSelection(); + } } void LLPanelFace::sendTexture() @@ -1773,7 +1783,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, { has_pbr_material = false; - BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); + const bool editable = objectp->permModify() && !objectp->isPermanentEnforced(); bool has_pbr_capabilities = LLMaterialEditor::capabilitiesAvailable(); // pbr material @@ -1784,10 +1794,11 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, bool identical_pbr; LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr); + has_pbr_material = pbr_id.notNull(); + pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); pbr_ctrl->setEnabled(editable && has_pbr_capabilities); pbr_ctrl->setImageAssetID(pbr_id); - has_pbr_material = pbr_id.notNull(); } getChildView("pbr_from_inventory")->setEnabled(editable && has_pbr_capabilities); @@ -1797,14 +1808,13 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); if (show_pbr) { - const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); const bool show_texture_info = texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; LLUICtrl* gltfCtrlTextureScaleU = getChild("gltfTextureScaleU"); - LLUICtrl* gltfCtrlTextureScaleV = getChild("gltfTextureScaleV"); - LLUICtrl* gltfCtrlTextureRotation = getChild("gltfTextureRotation"); + LLUICtrl* gltfCtrlTextureScaleV = getChild("gltfTextureScaleV"); + LLUICtrl* gltfCtrlTextureRotation = getChild("gltfTextureRotation"); LLUICtrl* gltfCtrlTextureOffsetU = getChild("gltfTextureOffsetU"); LLUICtrl* gltfCtrlTextureOffsetV = getChild("gltfTextureOffsetV"); @@ -1814,48 +1824,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, gltfCtrlTextureOffsetU->setEnabled(show_texture_info && has_pbr_capabilities); gltfCtrlTextureOffsetV->setEnabled(show_texture_info && has_pbr_capabilities); - if (show_texture_info) - { - LLGLTFMaterial::TextureTransform transform; - bool scale_u_same = true; - bool scale_v_same = true; - bool rotation_same = true; - bool offset_u_same = true; - bool offset_v_same = true; - - readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mScale[VX] : 0.f; - }, transform.mScale[VX], scale_u_same, true, 1e-3f); - readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mScale[VY] : 0.f; - }, transform.mScale[VY], scale_v_same, true, 1e-3f); - readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mRotation : 0.f; - }, transform.mRotation, rotation_same, true, 1e-3f); - readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mOffset[VX] : 0.f; - }, transform.mOffset[VX], offset_u_same, true, 1e-3f); - readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mOffset[VY] : 0.f; - }, transform.mOffset[VY], offset_v_same, true, 1e-3f); - - gltfCtrlTextureScaleU->setValue(transform.mScale[VX]); - gltfCtrlTextureScaleV->setValue(transform.mScale[VY]); - gltfCtrlTextureRotation->setValue(transform.mRotation * RAD_TO_DEG); - gltfCtrlTextureOffsetU->setValue(transform.mOffset[VX]); - gltfCtrlTextureOffsetV->setValue(transform.mOffset[VY]); - - gltfCtrlTextureScaleU->setTentative(!scale_u_same); - gltfCtrlTextureScaleV->setTentative(!scale_v_same); - gltfCtrlTextureRotation->setTentative(!rotation_same); - gltfCtrlTextureOffsetU->setTentative(!offset_u_same); - gltfCtrlTextureOffsetV->setTentative(!offset_v_same); - } + // Control values are set in setMaterialOverridesFromSelection } } @@ -2084,6 +2053,12 @@ void LLPanelFace::unloadMedia() mTitleMedia->unloadMediaSource(); } +// static +void LLPanelFace::onMaterialOverrideReceived(const LLUUID& object_id, S32 side) +{ + sMaterialOverrideSelection.onObjectUpdated(object_id, side); +} + ////////////////////////////////////////////////////////////////////////////// // void LLPanelFace::navigateToTitleMedia( const std::string url ) @@ -4677,7 +4652,7 @@ void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata) self->sendTextureInfo(); } -void updateGLTFTextureTransform(float value, U32 pbr_type, std::function edit) +void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::function edit) { U32 texture_info_start; U32 texture_info_end; @@ -4699,6 +4674,148 @@ void updateGLTFTextureTransform(float value, U32 pbr_type, std::functiongetSelection()->getFirstNode(); + if (node) + { + LLViewerObject* object = node->getObject(); + sMaterialOverrideSelection.setObjectUpdatePending(object->getID(), node->getLastSelectedTE()); + } +} + +void LLPanelFace::setMaterialOverridesFromSelection() +{ + const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); + const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + if (texture_info == LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT) + { + return; + } + + LLGLTFMaterial::TextureTransform transform; + bool scale_u_same = true; + bool scale_v_same = true; + bool rotation_same = true; + bool offset_u_same = true; + bool offset_v_same = true; + + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[texture_info].mScale[VX] : 0.f; + }, transform.mScale[VX], scale_u_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[texture_info].mScale[VY] : 0.f; + }, transform.mScale[VY], scale_v_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[texture_info].mRotation : 0.f; + }, transform.mRotation, rotation_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[texture_info].mOffset[VX] : 0.f; + }, transform.mOffset[VX], offset_u_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[texture_info].mOffset[VY] : 0.f; + }, transform.mOffset[VY], offset_v_same, true, 1e-3f); + + LLUICtrl* gltfCtrlTextureScaleU = getChild("gltfTextureScaleU"); + LLUICtrl* gltfCtrlTextureScaleV = getChild("gltfTextureScaleV"); + LLUICtrl* gltfCtrlTextureRotation = getChild("gltfTextureRotation"); + LLUICtrl* gltfCtrlTextureOffsetU = getChild("gltfTextureOffsetU"); + LLUICtrl* gltfCtrlTextureOffsetV = getChild("gltfTextureOffsetV"); + + gltfCtrlTextureScaleU->setValue(transform.mScale[VX]); + gltfCtrlTextureScaleV->setValue(transform.mScale[VY]); + gltfCtrlTextureRotation->setValue(transform.mRotation * RAD_TO_DEG); + gltfCtrlTextureOffsetU->setValue(transform.mOffset[VX]); + gltfCtrlTextureOffsetV->setValue(transform.mOffset[VY]); + + gltfCtrlTextureScaleU->setTentative(!scale_u_same); + gltfCtrlTextureScaleV->setTentative(!scale_v_same); + gltfCtrlTextureRotation->setTentative(!rotation_same); + gltfCtrlTextureOffsetU->setTentative(!offset_u_same); + gltfCtrlTextureOffsetV->setTentative(!offset_v_same); +} + +void LLPanelFace::Selection::connect() +{ + if (!mSelectConnection.connected()) + { + mSelectConnection = LLSelectMgr::instance().mUpdateSignal.connect(boost::bind(&LLPanelFace::Selection::onSelectionChanged, this)); + } +} + +bool LLPanelFace::Selection::update() +{ + const bool selection_changed = compareSelection(); + if (selection_changed) + { + clearObjectUpdatePending(); + } + else if (isObjectUpdatePending()) + { + return false; + } + + const bool changed = mChanged; + mChanged = false; + return changed; +} + +void LLPanelFace::Selection::setObjectUpdatePending(const LLUUID &object_id, S32 side) +{ + mPendingObjectID = object_id; + mPendingSide = side; +} + +void LLPanelFace::Selection::onObjectUpdated(const LLUUID& object_id, S32 side) +{ + if (object_id == mSelectedObjectID && side == mSelectedSide) + { + mChanged = true; + clearObjectUpdatePending(); + } +} + +void LLPanelFace::Selection::clearObjectUpdatePending() +{ + mPendingObjectID = LLUUID::null; + mPendingSide = -1; +} + +bool LLPanelFace::Selection::compareSelection() +{ + if (!mNeedsSelectionCheck) + { + return false; + } + mNeedsSelectionCheck = false; + + const S32 old_object_count = mSelectedObjectCount; + const LLUUID old_object_id = mSelectedObjectID; + const S32 old_side = mSelectedSide; + + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + LLSelectNode* node = selection->getFirstNode(); + if (node) + { + LLViewerObject* object = node->getObject(); + mSelectedObjectCount = selection->getObjectCount(); + mSelectedObjectID = object->getID(); + mSelectedSide = node->getLastSelectedTE(); + } + else + { + mSelectedObjectCount = 0; + mSelectedObjectID = LLUUID::null; + mSelectedSide = -1; + } + + const bool selection_changed = old_object_count != mSelectedObjectCount || old_object_id != mSelectedObjectID || old_side != mSelectedSide; + mChanged = mChanged || selection_changed; + return selection_changed; } void LLPanelFace::onCommitGLTFTextureScaleU(LLUICtrl* ctrl) -- cgit v1.2.3 From f313a762fcfa69a0259a7db90283bbd03b4107fb Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 28 Nov 2022 17:19:06 -0800 Subject: SL-18732: Fix texture transform controls not updating when switching which texture to edit --- indra/newview/llpanelface.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b7e92bf315..21c824ff5c 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -2803,6 +2803,7 @@ void LLPanelFace::onCommitPbrType(LLUICtrl* ctrl, void* userdata) // and generally reflecting old state when switching tabs or objects // self->updateUI(); + self->setMaterialOverridesFromSelection(); } // static -- cgit v1.2.3 From bfcb07270ed7036c87a4ece7fa1f5416123fff85 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 29 Nov 2022 15:20:44 -0800 Subject: SL-18732: Review feedback --- indra/newview/llpanelface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 21c824ff5c..3d72865f69 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -276,7 +276,7 @@ BOOL LLPanelFace::postBuild() getChild("gltfTextureOffsetU")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetU, this, _1), nullptr); getChild("gltfTextureOffsetV")->setCommitCallback(boost::bind(&LLPanelFace::onCommitGLTFTextureOffsetV, this, _1), nullptr); - LLGLTFMaterialList::addUpdateCallback(&LLPanelFace::onMaterialOverrideReceived); + LLGLTFMaterialList::addSelectionUpdateCallback(&LLPanelFace::onMaterialOverrideReceived); sMaterialOverrideSelection.connect(); childSetAction("button align",&LLPanelFace::onClickAutoFix,this); @@ -2056,7 +2056,7 @@ void LLPanelFace::unloadMedia() // static void LLPanelFace::onMaterialOverrideReceived(const LLUUID& object_id, S32 side) { - sMaterialOverrideSelection.onObjectUpdated(object_id, side); + sMaterialOverrideSelection.onSelectedObjectUpdated(object_id, side); } ////////////////////////////////////////////////////////////////////////////// @@ -4771,7 +4771,7 @@ void LLPanelFace::Selection::setObjectUpdatePending(const LLUUID &object_id, S32 mPendingSide = side; } -void LLPanelFace::Selection::onObjectUpdated(const LLUUID& object_id, S32 side) +void LLPanelFace::Selection::onSelectedObjectUpdated(const LLUUID& object_id, S32 side) { if (object_id == mSelectedObjectID && side == mSelectedSide) { -- cgit v1.2.3 From 51d5748d64cf90896f2c4945e8d13dd98a9be65b Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Wed, 30 Nov 2022 16:05:50 -0800 Subject: SL-18746: Disable transparency control in build floater when the prim has a GLTF material --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 3d72865f69..2b1862304a 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1064,7 +1064,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 transparency = (1.f - color.mV[VALPHA]) * 100.f; getChild("ColorTrans")->setValue(editable ? transparency : 0); - getChildView("ColorTrans")->setEnabled(editable); + getChildView("ColorTrans")->setEnabled(editable && has_material); // Specular map LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); -- cgit v1.2.3 From 3812fb0f41723ea359ecffaefa2ca10e83ae679f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 2 Dec 2022 12:19:18 +0200 Subject: SL-18768 Disabled PBR texture transform when no PBR is set --- indra/newview/llpanelface.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 2b1862304a..92e92ac6a6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1818,11 +1818,11 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, LLUICtrl* gltfCtrlTextureOffsetU = getChild("gltfTextureOffsetU"); LLUICtrl* gltfCtrlTextureOffsetV = getChild("gltfTextureOffsetV"); - 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); + gltfCtrlTextureScaleU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); + gltfCtrlTextureScaleV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); + gltfCtrlTextureRotation->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); + gltfCtrlTextureOffsetU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); + gltfCtrlTextureOffsetV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); // Control values are set in setMaterialOverridesFromSelection } -- cgit v1.2.3 From 1d5332b23265f567e4b9ac5364c95f3837f63b71 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 2 Dec 2022 12:36:26 +0200 Subject: SL-18448 When initing views and object has pbr, open pbr in texture tab --- indra/newview/llpanelface.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 92e92ac6a6..8848accab0 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -996,8 +996,18 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (mComboMatMedia->getCurrentIndex() < MATMEDIA_MATERIAL) { - mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); + // When selecting an object with a pbr and UI combo is not set, + // set to pbr option, otherwise to a texture (material) + if (has_pbr_material) + { + mComboMatMedia->selectNthItem(MATMEDIA_PBR); + } + else + { + mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); + } } + mComboMatMedia->setEnabled(editable); LLRadioGroup* radio_mat_type = getChild("radio_material_type"); -- cgit v1.2.3 From 3290f16f29e503115b7eaeb2005cfdbba42668dd Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 4 Jan 2023 13:23:47 +0200 Subject: SL-18854 Fix drag'n drop of plain textures on faces in PBR mode When in PBR 'mode', defaulted texture drops to diffuse channel --- indra/newview/llpanelface.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 8848accab0..0b18bdc6e6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -193,8 +193,6 @@ std::string USE_TEXTURE; LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit() { - - LLRender::eTexIndex channel_to_edit = LLRender::DIFFUSE_MAP; if (mComboMatMedia) { @@ -216,6 +214,17 @@ LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit() return channel_to_edit; } +LLRender::eTexIndex LLPanelFace::getTextureDropChannel() +{ + if (mComboMatMedia && mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL) + { + LLRadioGroup* radio_mat_type = getChild("radio_material_type"); + return LLRender::eTexIndex(radio_mat_type->getSelectedIndex()); + } + + return LLRender::eTexIndex(MATTYPE_DIFFUSE); +} + // Things the UI provides... // LLUUID LLPanelFace::getCurrentNormalMap() { return getChild("bumpytexture control")->getImageAssetID(); } @@ -1560,7 +1569,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) enabled = editable && has_pbr_material; material_type = radio_pbr_type->getSelectedIndex(); } - LLSelectMgr::getInstance()->setTextureChannel(LLRender::eTexIndex(material_type)); switch (material_type) { -- cgit v1.2.3 From 693925ef23ef41e3927a9654a7f423d0e24ce19a Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 13 Dec 2022 10:41:21 -0800 Subject: SL-18820: Fix applying material clearing transform overrides. Loosen some asserts to allow non-default transform overrides. --- indra/newview/llpanelface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 0b18bdc6e6..cf02f3c4e4 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4527,8 +4527,8 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) tep->setGLTFRenderMaterial(nullptr); tep->setGLTFMaterialOverride(nullptr); - // blank out any override data on the server - LLGLTFMaterialList::queueApply(objectp->getID(), te, LLUUID::null); + // blank out most override data on the server + LLGLTFMaterialList::queueApply(objectp, te, LLUUID::null); } // Texture map -- cgit v1.2.3 From a3f43b4b73cc8fbd48a0574ebd74bbe660f8af50 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 23 Jan 2023 19:17:46 +0200 Subject: SL-19014 Sanitize the override data sent for faces without GLTF materials --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index cf02f3c4e4..cb09ec9fbf 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -152,7 +152,7 @@ void LLPanelFace::updateSelectedGLTFMaterials(std::functiongetGLTFMaterialOverride(); } mFunc(&new_override); - LLGLTFMaterialList::queueModify(object->getID(), face, &new_override); + LLGLTFMaterialList::queueModify(object, face, &new_override); return true; } -- cgit v1.2.3 From a549140fd072c0bf03047fa1809d4ea4b89b5a12 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 14 Feb 2023 00:12:09 +0200 Subject: SL-19183 PBR mapping scale values start on zero --- indra/newview/llpanelface.cpp | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index cb09ec9fbf..ce086f2520 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1829,6 +1829,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); const bool show_texture_info = texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; + const bool new_state = show_texture_info && has_pbr_capabilities && has_pbr_material; LLUICtrl* gltfCtrlTextureScaleU = getChild("gltfTextureScaleU"); LLUICtrl* gltfCtrlTextureScaleV = getChild("gltfTextureScaleV"); @@ -1836,13 +1837,15 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, LLUICtrl* gltfCtrlTextureOffsetU = getChild("gltfTextureOffsetU"); LLUICtrl* gltfCtrlTextureOffsetV = getChild("gltfTextureOffsetV"); - gltfCtrlTextureScaleU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); - gltfCtrlTextureScaleV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); - gltfCtrlTextureRotation->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); - gltfCtrlTextureOffsetU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); - gltfCtrlTextureOffsetV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material); + gltfCtrlTextureScaleU->setEnabled(new_state); + gltfCtrlTextureScaleV->setEnabled(new_state); + gltfCtrlTextureRotation->setEnabled(new_state); + gltfCtrlTextureOffsetU->setEnabled(new_state); + gltfCtrlTextureOffsetV->setEnabled(new_state); - // Control values are set in setMaterialOverridesFromSelection + // Control values will be set once per frame in + // setMaterialOverridesFromSelection + sMaterialOverrideSelection.setDirty(); } } @@ -2821,7 +2824,6 @@ void LLPanelFace::onCommitPbrType(LLUICtrl* ctrl, void* userdata) // and generally reflecting old state when switching tabs or objects // self->updateUI(); - self->setMaterialOverridesFromSelection(); } // static @@ -4768,17 +4770,7 @@ void LLPanelFace::Selection::connect() bool LLPanelFace::Selection::update() { - const bool selection_changed = compareSelection(); - if (selection_changed) - { - clearObjectUpdatePending(); - } - else if (isObjectUpdatePending()) - { - return false; - } - - const bool changed = mChanged; + const bool changed = mChanged || compareSelection(); mChanged = false; return changed; } @@ -4794,16 +4786,9 @@ void LLPanelFace::Selection::onSelectedObjectUpdated(const LLUUID& object_id, S3 if (object_id == mSelectedObjectID && side == mSelectedSide) { mChanged = true; - clearObjectUpdatePending(); } } -void LLPanelFace::Selection::clearObjectUpdatePending() -{ - mPendingObjectID = LLUUID::null; - mPendingSide = -1; -} - bool LLPanelFace::Selection::compareSelection() { if (!mNeedsSelectionCheck) -- cgit v1.2.3 From 917932549fe40f02bf393f22ec1af12aa2245264 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 14 Feb 2023 13:52:33 -0800 Subject: SL-19002: Stop sending material IDs from client via material params and just call queueApply/queueModify --- indra/newview/llpanelface.cpp | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index cb09ec9fbf..54256ae646 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -3823,34 +3823,12 @@ private: struct LLPanelFaceUpdateFunctor : public LLSelectedObjectFunctor { - LLPanelFaceUpdateFunctor(bool update_media, bool update_pbr) + LLPanelFaceUpdateFunctor(bool update_media) : mUpdateMedia(update_media) - , mUpdatePbr(update_pbr) {} virtual bool apply(LLViewerObject* object) { - if (mUpdatePbr) - { - // setRenderMaterialId is supposed to create it - LLRenderMaterialParams* param_block = (LLRenderMaterialParams*)object->getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL); - if (param_block) - { - if (param_block->isEmpty()) - { - object->setHasRenderMaterialParams(false); - } - else if (object->hasRenderMaterialParams()) - { - object->parameterChanged(LLNetworkData::PARAMS_RENDER_MATERIAL, true); - } - else - { - object->setHasRenderMaterialParams(true); - } - } - } - object->sendTEUpdate(); if (mUpdateMedia) @@ -3865,7 +3843,6 @@ struct LLPanelFaceUpdateFunctor : public LLSelectedObjectFunctor } private: bool mUpdateMedia; - bool mUpdatePbr; }; struct LLPanelFaceNavigateHomeFunctor : public LLSelectedTEFunctor @@ -4001,7 +3978,7 @@ void LLPanelFace::onPasteColor() LLPanelFacePasteTexFunctor paste_func(this, PASTE_COLOR); selected_objects->applyToTEs(&paste_func); - LLPanelFaceUpdateFunctor sendfunc(false, false); + LLPanelFaceUpdateFunctor sendfunc(false); selected_objects->applyToObjects(&sendfunc); } @@ -4362,7 +4339,7 @@ void LLPanelFace::onPasteTexture() LLPanelFacePasteTexFunctor paste_func(this, PASTE_TEXTURE); selected_objects->applyToTEs(&paste_func); - LLPanelFaceUpdateFunctor sendfunc(true, true); + LLPanelFaceUpdateFunctor sendfunc(true); selected_objects->applyToObjects(&sendfunc); LLGLTFMaterialList::flushUpdates(); -- cgit v1.2.3 From ad590887cc1bd950c189f71b4edd52c012d02e7a Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Wed, 22 Mar 2023 15:26:21 -0700 Subject: SL-19399: Allow editing all PBR texture transforms at once with Complete material radio --- indra/newview/llpanelface.cpp | 101 ++++++++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 34 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index cb7bc7b5df..5cffef5f6d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1827,9 +1827,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, if (show_pbr) { const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); - const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); - const bool show_texture_info = texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; - const bool new_state = show_texture_info && has_pbr_capabilities && has_pbr_material; + const bool new_state = has_pbr_capabilities && has_pbr_material; LLUICtrl* gltfCtrlTextureScaleU = getChild("gltfTextureScaleU"); LLUICtrl* gltfCtrlTextureScaleV = getChild("gltfTextureScaleV"); @@ -1858,11 +1856,6 @@ void LLPanelFace::updateVisibilityGLTF() const U32 pbr_type = radio_pbr_type->getSelectedIndex(); const bool show_pbr_render_material_id = show_pbr && (pbr_type == PBRTYPE_RENDER_MATERIAL_ID); - const bool show_pbr_base_color = show_pbr && (pbr_type == PBRTYPE_BASE_COLOR); - const bool show_pbr_normal = show_pbr && (pbr_type == PBRTYPE_NORMAL); - const bool show_pbr_metallic_roughness = show_pbr && (pbr_type == PBRTYPE_METALLIC_ROUGHNESS); - const bool show_pbr_emissive = show_pbr && (pbr_type == PBRTYPE_EMISSIVE); - const bool show_pbr_transform = show_pbr_base_color || show_pbr_normal || show_pbr_metallic_roughness || show_pbr_emissive; getChildView("pbr_control")->setVisible(show_pbr_render_material_id); @@ -1870,11 +1863,11 @@ void LLPanelFace::updateVisibilityGLTF() getChildView("edit_selected_pbr")->setVisible(show_pbr_render_material_id); getChildView("save_selected_pbr")->setVisible(show_pbr_render_material_id); - getChildView("gltfTextureScaleU")->setVisible(show_pbr_transform); - getChildView("gltfTextureScaleV")->setVisible(show_pbr_transform); - getChildView("gltfTextureRotation")->setVisible(show_pbr_transform); - getChildView("gltfTextureOffsetU")->setVisible(show_pbr_transform); - getChildView("gltfTextureOffsetV")->setVisible(show_pbr_transform); + getChildView("gltfTextureScaleU")->setVisible(show_pbr); + getChildView("gltfTextureScaleV")->setVisible(show_pbr); + getChildView("gltfTextureRotation")->setVisible(show_pbr); + getChildView("gltfTextureOffsetU")->setVisible(show_pbr); + getChildView("gltfTextureOffsetV")->setVisible(show_pbr); } void LLPanelFace::updateCopyTexButton() @@ -4654,7 +4647,8 @@ void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::fun { U32 texture_info_start; U32 texture_info_end; - if (gSavedSettings.getBOOL("SyncMaterialSettings")) + const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + if (gSavedSettings.getBOOL("SyncMaterialSettings") || texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT) { texture_info_start = 0; texture_info_end = LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; @@ -4685,11 +4679,20 @@ void LLPanelFace::setMaterialOverridesFromSelection() { const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); + U32 texture_info_start; + U32 texture_info_end; if (texture_info == LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT) { - return; + texture_info_start = 0; + texture_info_end = LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT; + } + else + { + texture_info_start = texture_info; + texture_info_end = texture_info + 1; } + bool read_transform = true; LLGLTFMaterial::TextureTransform transform; bool scale_u_same = true; bool scale_v_same = true; @@ -4697,26 +4700,56 @@ void LLPanelFace::setMaterialOverridesFromSelection() bool offset_u_same = true; bool offset_v_same = true; - readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mScale[VX] : 0.f; - }, transform.mScale[VX], scale_u_same, true, 1e-3f); - readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mScale[VY] : 0.f; - }, transform.mScale[VY], scale_v_same, true, 1e-3f); - readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + for (U32 i = texture_info_start; i < texture_info_end; ++i) { - return mat ? mat->mTextureTransform[texture_info].mRotation : 0.f; - }, transform.mRotation, rotation_same, true, 1e-3f); - readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mOffset[VX] : 0.f; - }, transform.mOffset[VX], offset_u_same, true, 1e-3f); - readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) - { - return mat ? mat->mTextureTransform[texture_info].mOffset[VY] : 0.f; - }, transform.mOffset[VY], offset_v_same, true, 1e-3f); + LLGLTFMaterial::TextureTransform this_transform; + bool this_scale_u_same = true; + bool this_scale_v_same = true; + bool this_rotation_same = true; + bool this_offset_u_same = true; + bool this_offset_v_same = true; + + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[i].mScale[VX] : 0.f; + }, this_transform.mScale[VX], this_scale_u_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[i].mScale[VY] : 0.f; + }, this_transform.mScale[VY], this_scale_v_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[i].mRotation : 0.f; + }, this_transform.mRotation, this_rotation_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[i].mOffset[VX] : 0.f; + }, this_transform.mOffset[VX], this_offset_u_same, true, 1e-3f); + readSelectedGLTFMaterial([&](const LLGLTFMaterial* mat) + { + return mat ? mat->mTextureTransform[i].mOffset[VY] : 0.f; + }, this_transform.mOffset[VY], this_offset_v_same, true, 1e-3f); + + scale_u_same = scale_u_same && this_scale_u_same; + scale_v_same = scale_v_same && this_scale_v_same; + rotation_same = rotation_same && this_rotation_same; + offset_u_same = offset_u_same && this_offset_u_same; + offset_v_same = offset_v_same && this_offset_v_same; + + if (read_transform) + { + read_transform = false; + transform = this_transform; + } + else + { + scale_u_same = scale_u_same && (this_transform.mScale[VX] == transform.mScale[VX]); + scale_v_same = scale_v_same && (this_transform.mScale[VY] == transform.mScale[VY]); + rotation_same = rotation_same && (this_transform.mRotation == transform.mRotation); + offset_u_same = offset_u_same && (this_transform.mOffset[VX] == transform.mOffset[VX]); + offset_v_same = offset_v_same && (this_transform.mOffset[VY] == transform.mOffset[VY]); + } + } LLUICtrl* gltfCtrlTextureScaleU = getChild("gltfTextureScaleU"); LLUICtrl* gltfCtrlTextureScaleV = getChild("gltfTextureScaleV"); -- cgit v1.2.3 From 1ba1159a3627520d2dfc6ab099808d6e01be5fc3 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Wed, 22 Mar 2023 15:53:08 -0700 Subject: SL-19399: Reorganize controls for PBR material editing in the build floater in more sensible way. Ignore "Lock repeat" in PBR mode as it's redundant --- indra/newview/llpanelface.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 5cffef5f6d..25b191aad1 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1282,7 +1282,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLCheckBoxCtrl* cb_planar_align = getChild("checkbox planar align"); align_planar = (cb_planar_align && cb_planar_align->get()); - bool enabled = (editable && isIdenticalPlanarTexgen() && (!pbr_selected || texture_info_selected)); + bool enabled = (editable && isIdenticalPlanarTexgen() && !texture_info_selected); childSetValue("checkbox planar align", align_planar && enabled); childSetVisible("checkbox planar align", enabled); childSetEnabled("checkbox planar align", enabled); @@ -2724,14 +2724,14 @@ void LLPanelFace::updateVisibility() const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); - const bool show_texture_info = show_pbr && texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; + const bool show_pbr_asset = show_pbr && texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; radio_mat_type->setVisible(show_material); // Shared material controls - getChildView("checkbox_sync_settings")->setVisible(show_material || show_media || show_texture_info); - getChildView("tex gen")->setVisible(show_material || show_media || show_texture_info); - getChildView("combobox texgen")->setVisible(show_material || show_media || show_texture_info); + getChildView("checkbox_sync_settings")->setVisible(show_material || show_media); + getChildView("tex gen")->setVisible(show_material || show_media || show_pbr_asset); + getChildView("combobox texgen")->setVisible(show_material || show_media || show_pbr_asset); getChildView("button align textures")->setVisible(show_material || show_media); // Media controls @@ -4648,7 +4648,7 @@ void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::fun U32 texture_info_start; U32 texture_info_end; const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type); - if (gSavedSettings.getBOOL("SyncMaterialSettings") || texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT) + if (texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT) { texture_info_start = 0; texture_info_end = LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; -- cgit v1.2.3 From 5721bdbc4d1138bb251cac9a504221ce04c23407 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Wed, 22 Mar 2023 17:56:55 -0700 Subject: SL-19399: Cleanup --- indra/newview/llpanelface.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 25b191aad1..dd3fdf91d9 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1826,7 +1826,6 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); if (show_pbr) { - const U32 pbr_type = findChild("radio_pbr_type")->getSelectedIndex(); const bool new_state = has_pbr_capabilities && has_pbr_material; LLUICtrl* gltfCtrlTextureScaleU = getChild("gltfTextureScaleU"); -- cgit v1.2.3 From a256a18884ae8e4bc6297ca59fbd5936089ad59c Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 15 May 2023 13:49:20 -0500 Subject: SL-19674 Disable "Blinn-Phong" when a PBR material is applied to make it clear that those buttons are inoperable until you remove the PBR material. --- indra/newview/llpanelface.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index dd3fdf91d9..7d6015f557 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1534,6 +1534,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("checkbox fullbright")->setValue((S32)(fullbright_flag != 0)); getChildView("checkbox fullbright")->setEnabled(editable && !has_pbr_material); getChild("checkbox fullbright")->setTentative(!identical_fullbright); + getChild("combobox matmedia")->setEnabledByValue("Materials", !has_pbr_material); } // Repeats per meter -- cgit v1.2.3 From ba4b596894e8eb9b9eb51169b9b3f88c21173c29 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 11 Jul 2023 01:24:22 +0300 Subject: SL-19141 Fixed applying a no-copy texture to two objects failing silently --- indra/newview/llpanelface.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7d6015f557..702a8a82e2 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -520,7 +520,11 @@ void LLPanelFace::sendTexture() { id = mTextureCtrl->getImageAssetID(); } - LLSelectMgr::getInstance()->selectionSetImage(id); + if (!LLSelectMgr::getInstance()->selectionSetImage(id)) + { + // need to refresh value in texture ctrl + refresh(); + } } } @@ -3032,7 +3036,11 @@ void LLPanelFace::onCommitPbr(const LLSD& data) { id = pbr_ctrl->getImageAssetID(); } - LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id); + if (!LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id)) + { + // If failed to set material, refresh pbr_ctrl's value + refresh(); + } } } @@ -3056,8 +3064,14 @@ void LLPanelFace::onSelectPbr(const LLSD& data) { id = pbr_ctrl->getImageAssetID(); } - LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id); - LLSelectedTEMaterial::setMaterialID(this, id); + if (LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id)) + { + LLSelectedTEMaterial::setMaterialID(this, id); + } + else + { + refresh(); + } } } -- cgit v1.2.3 From 4b268a5d6add40b7d948485f062ca60e77062bc8 Mon Sep 17 00:00:00 2001 From: Brad Linden Date: Mon, 17 Jul 2023 15:32:28 -0700 Subject: Delete unprintable chars that accidentally got into the merge in kdiff3 for DRTVWR-559 --- indra/newview/llpanelface.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index e9586d478f..ff21438085 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1024,7 +1024,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mComboMatMedia->setEnabled(editable); LLRadioGroup* radio_mat_type = getChild("radio_material_type"); - if (radio_mat_type->getSelectedIndex() < MATTYPE_DIFFUSE) { radio_mat_type->selectNthItem(MATTYPE_DIFFUSE); -- cgit v1.2.3 From 5e344813dc9bb4e5ecb8187642f97377c157955f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 27 Jul 2023 23:06:26 +0300 Subject: SL-18396 PBR and blinn phong should not be allowed to be edited together --- indra/newview/llpanelface.cpp | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index ff21438085..83a330af37 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1000,7 +1000,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); bool has_pbr_material; - updateUIGLTF(objectp, has_pbr_material, force_set_values); + bool has_faces_without_pbr; + updateUIGLTF(objectp, has_pbr_material, has_faces_without_pbr, force_set_values); const bool has_material = !has_pbr_material; @@ -1536,7 +1537,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("checkbox fullbright")->setValue((S32)(fullbright_flag != 0)); getChildView("checkbox fullbright")->setEnabled(editable && !has_pbr_material); getChild("checkbox fullbright")->setTentative(!identical_fullbright); - getChild("combobox matmedia")->setEnabledByValue("Materials", !has_pbr_material); + mComboMatMedia->setEnabledByValue("Materials", !has_pbr_material); } // Repeats per meter @@ -1800,7 +1801,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } } -void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, bool force_set_values) +void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, bool& has_faces_without_pbr, bool force_set_values) { has_pbr_material = false; @@ -1813,9 +1814,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, { LLUUID pbr_id; bool identical_pbr; - LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr); - - has_pbr_material = pbr_id.notNull(); + LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr); pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); pbr_ctrl->setEnabled(editable && has_pbr_capabilities); @@ -1823,13 +1822,13 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& 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); + getChildView("edit_selected_pbr")->setEnabled(editable && has_pbr_material && !has_faces_without_pbr && has_pbr_capabilities); + getChildView("save_selected_pbr")->setEnabled(objectp->permCopy() && has_pbr_material && !has_faces_without_pbr && has_pbr_capabilities); const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); if (show_pbr) { - const bool new_state = has_pbr_capabilities && has_pbr_material; + const bool new_state = has_pbr_capabilities && has_pbr_material && !has_faces_without_pbr; LLUICtrl* gltfCtrlTextureScaleU = getChild("gltfTextureScaleU"); LLUICtrl* gltfCtrlTextureScaleV = getChild("gltfTextureScaleV"); @@ -5057,16 +5056,34 @@ void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical) identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); } -void LLPanelFace::LLSelectedTE::getPbrMaterialId(LLUUID& id, bool& identical) +void LLPanelFace::LLSelectedTE::getPbrMaterialId(LLUUID& id, bool& identical, bool& has_faces_with_pbr, bool& has_faces_without_pbr) { struct LLSelectedTEGetmatId : public LLSelectedTEGetFunctor { + LLSelectedTEGetmatId() + : mHasFacesWithoutPBR(false) + , mHasFacesWithPBR(false) + { + } LLUUID get(LLViewerObject* object, S32 te_index) { - return object->getRenderMaterialID(te_index); + LLUUID pbr_id = object->getRenderMaterialID(te_index); + if (pbr_id.isNull()) + { + mHasFacesWithoutPBR = true; + } + else + { + mHasFacesWithPBR = true; + } + return pbr_id; } + bool mHasFacesWithoutPBR; + bool mHasFacesWithPBR; } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, id); + has_faces_with_pbr = func.mHasFacesWithPBR; + has_faces_without_pbr = func.mHasFacesWithoutPBR; } void LLPanelFace::LLSelectedTEMaterial::getCurrent(LLMaterialPtr& material_ptr, bool& identical_material) -- cgit v1.2.3 From 4705515e785b56165f1b936d4e2baec6a2836b6c Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Thu, 3 Aug 2023 20:29:30 +0300 Subject: SL-19303 switch automatically between Materials/PBR/Media based on current values --- indra/newview/llpanelface.cpp | 70 ++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 24 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 83a330af37..b5ed4f50af 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1022,6 +1022,52 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } } + // *NOTE: The "identical" variable is currently only used to decide if + // the texgen control should be tentative - this is not used by GLTF + // materials. -Cosmic;2022-11-09 + bool identical = true; // true because it is anded below + bool identical_diffuse = false; + bool identical_norm = false; + bool identical_spec = false; + + LLTextureCtrl *texture_ctrl = getChild("texture control"); + LLTextureCtrl *shinytexture_ctrl = getChild("shinytexture control"); + LLTextureCtrl *bumpytexture_ctrl = getChild("bumpytexture control"); + + LLUUID id; + LLUUID normmap_id; + LLUUID specmap_id; + + LLSelectedTE::getTexId(id, identical_diffuse); + LLSelectedTEMaterial::getNormalID(normmap_id, identical_norm); + LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); + + static S32 selected_te = -1; + if ((LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()) && + !LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected()) + { + S32 new_selection = LLSelectMgr::getInstance()->getSelection()->getFirstNode()->getLastSelectedTE(); + if (new_selection != selected_te) + { + bool te_has_media = objectp->getTE(new_selection) && objectp->getTE(new_selection)->hasMedia(); + bool te_has_pbr = objectp->getRenderMaterialID(new_selection).notNull(); + + if (te_has_pbr && !((mComboMatMedia->getCurrentIndex() == MATMEDIA_MEDIA) && te_has_media)) + { + mComboMatMedia->selectNthItem(MATMEDIA_PBR); + } + else if (te_has_media) + { + mComboMatMedia->selectNthItem(MATMEDIA_MEDIA); + } + else if (id.notNull() || normmap_id.notNull() || specmap_id.notNull()) + { + mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); + } + selected_te = new_selection; + } + } + mComboMatMedia->setEnabled(editable); LLRadioGroup* radio_mat_type = getChild("radio_material_type"); @@ -1045,22 +1091,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) updateVisibility(); - // *NOTE: The "identical" variable is currently only used to decide if - // the texgen control should be tentative - this is not used by GLTF - // materials. -Cosmic;2022-11-09 - bool identical = true; // true because it is anded below - bool identical_diffuse = false; - bool identical_norm = false; - bool identical_spec = false; - - LLTextureCtrl* texture_ctrl = getChild("texture control"); - LLTextureCtrl* shinytexture_ctrl = getChild("shinytexture control"); - LLTextureCtrl* bumpytexture_ctrl = getChild("bumpytexture control"); - - LLUUID id; - LLUUID normmap_id; - LLUUID specmap_id; - // Color swatch { getChildView("color label")->setEnabled(editable); @@ -1090,9 +1120,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChild("ColorTrans")->setValue(editable ? transparency : 0); getChildView("ColorTrans")->setEnabled(editable && has_material); - // Specular map - LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); - U8 shiny = 0; bool identical_shiny = false; @@ -1158,11 +1185,6 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // Texture { - LLSelectedTE::getTexId(id,identical_diffuse); - - // Normal map - LLSelectedTEMaterial::getNormalID(normmap_id, identical_norm); - mIsAlpha = FALSE; LLGLenum image_format = GL_RGB; bool identical_image_format = false; -- cgit v1.2.3 From 87c00d8daa25ea284c85bdd19e044c1127eca927 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 10 Aug 2023 00:45:25 +0300 Subject: SL-20133 Shift clicking selected face leaves Editor's Texture tab in a weird state --- indra/newview/llpanelface.cpp | 58 +++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 21 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b5ed4f50af..7075752a50 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -991,7 +991,8 @@ void LLPanelFace::getState() void LLPanelFace::updateUI(bool force_set_values /*false*/) { //set state of UI to match state of texture entry(ies) (calls setEnabled, setValue, etc, but NOT setVisible) - LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(); + LLViewerObject* objectp = node ? node->getObject() : NULL; if (objectp && objectp->getPCode() == LL_PCODE_VOLUME @@ -1046,7 +1047,17 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if ((LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()) && !LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected()) { - S32 new_selection = LLSelectMgr::getInstance()->getSelection()->getFirstNode()->getLastSelectedTE(); + S32 new_selection = -1; // Don't use getLastSelectedTE, it could have been deselected + S32 num_tes = llmin((S32)objectp->getNumTEs(), (S32)objectp->getNumFaces()); + for (S32 te = 0; te < num_tes; ++te) + { + if (node->isTESelected(te)) + { + new_selection = te; + break; + } + } + if (new_selection != selected_te) { bool te_has_media = objectp->getTE(new_selection) && objectp->getTE(new_selection)->hasMedia(); @@ -4698,13 +4709,6 @@ void LLPanelFace::updateGLTFTextureTransform(float value, U32 pbr_type, std::fun edit(&new_transform); } }); - - LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(); - if (node) - { - LLViewerObject* object = node->getObject(); - sMaterialOverrideSelection.setObjectUpdatePending(object->getID(), node->getLastSelectedTE()); - } } void LLPanelFace::setMaterialOverridesFromSelection() @@ -4817,17 +4821,22 @@ bool LLPanelFace::Selection::update() return changed; } -void LLPanelFace::Selection::setObjectUpdatePending(const LLUUID &object_id, S32 side) -{ - mPendingObjectID = object_id; - mPendingSide = side; -} - void LLPanelFace::Selection::onSelectedObjectUpdated(const LLUUID& object_id, S32 side) { - if (object_id == mSelectedObjectID && side == mSelectedSide) + if (object_id == mSelectedObjectID) { - mChanged = true; + if (side == mLastSelectedSide) + { + mChanged = true; + } + else if (mLastSelectedSide == -1) // if last selected face was deselected + { + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(); + if (node && node->isTESelected(side)) + { + mChanged = true; + } + } } } @@ -4840,8 +4849,9 @@ bool LLPanelFace::Selection::compareSelection() mNeedsSelectionCheck = false; const S32 old_object_count = mSelectedObjectCount; + const S32 old_te_count = mSelectedTECount; const LLUUID old_object_id = mSelectedObjectID; - const S32 old_side = mSelectedSide; + const S32 old_side = mLastSelectedSide; LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); LLSelectNode* node = selection->getFirstNode(); @@ -4849,17 +4859,23 @@ bool LLPanelFace::Selection::compareSelection() { LLViewerObject* object = node->getObject(); mSelectedObjectCount = selection->getObjectCount(); + mSelectedTECount = selection->getTECount(); mSelectedObjectID = object->getID(); - mSelectedSide = node->getLastSelectedTE(); + mLastSelectedSide = node->getLastSelectedTE(); } else { mSelectedObjectCount = 0; + mSelectedTECount = 0; mSelectedObjectID = LLUUID::null; - mSelectedSide = -1; + mLastSelectedSide = -1; } - const bool selection_changed = old_object_count != mSelectedObjectCount || old_object_id != mSelectedObjectID || old_side != mSelectedSide; + const bool selection_changed = + old_object_count != mSelectedObjectCount + || old_te_count != mSelectedTECount + || old_object_id != mSelectedObjectID + || old_side != mLastSelectedSide; mChanged = mChanged || selection_changed; return selection_changed; } -- cgit v1.2.3 From d8e4572b901b429439f991703f2bc12f81e03901 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 9 Aug 2023 22:26:24 +0300 Subject: SL-20039 "Save to inventory" should only allow saving identical faces --- indra/newview/llpanelface.cpp | 53 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7075752a50..837217387f 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1840,13 +1840,13 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, const bool editable = objectp->permModify() && !objectp->isPermanentEnforced(); bool has_pbr_capabilities = LLMaterialEditor::capabilitiesAvailable(); + bool identical_pbr = true; // pbr material LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); if (pbr_ctrl) { LLUUID pbr_id; - bool identical_pbr; LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr); pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); @@ -1856,7 +1856,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, getChildView("pbr_from_inventory")->setEnabled(editable && has_pbr_capabilities); getChildView("edit_selected_pbr")->setEnabled(editable && has_pbr_material && !has_faces_without_pbr && has_pbr_capabilities); - getChildView("save_selected_pbr")->setEnabled(objectp->permCopy() && has_pbr_material && !has_faces_without_pbr && has_pbr_capabilities); + getChildView("save_selected_pbr")->setEnabled(objectp->permCopy() && has_pbr_material && identical_pbr && has_pbr_capabilities); const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); if (show_pbr) @@ -5096,14 +5096,18 @@ void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical) void LLPanelFace::LLSelectedTE::getPbrMaterialId(LLUUID& id, bool& identical, bool& has_faces_with_pbr, bool& has_faces_without_pbr) { - struct LLSelectedTEGetmatId : public LLSelectedTEGetFunctor + struct LLSelectedTEGetmatId : public LLSelectedTEFunctor { LLSelectedTEGetmatId() : mHasFacesWithoutPBR(false) , mHasFacesWithPBR(false) + , mIdenticalId(true) + , mIdenticalOverride(true) + , mInitialized(false) + , mMaterialOverride(LLGLTFMaterial::sDefault) { } - LLUUID get(LLViewerObject* object, S32 te_index) + bool apply(LLViewerObject* object, S32 te_index) override { LLUUID pbr_id = object->getRenderMaterialID(te_index); if (pbr_id.isNull()) @@ -5114,12 +5118,49 @@ void LLPanelFace::LLSelectedTE::getPbrMaterialId(LLUUID& id, bool& identical, bo { mHasFacesWithPBR = true; } - return pbr_id; + if (mInitialized) + { + if (mPBRId != pbr_id) + { + mIdenticalId = false; + } + + LLGLTFMaterial* te_override = object->getTE(te_index)->getGLTFMaterialOverride(); + if (te_override) + { + LLGLTFMaterial override = *te_override; + override.sanitizeAssetMaterial(); + mIdenticalOverride &= (override == mMaterialOverride); + } + else + { + mIdenticalOverride &= (mMaterialOverride == LLGLTFMaterial::sDefault); + } + } + else + { + mInitialized = true; + mPBRId = pbr_id; + LLGLTFMaterial* override = object->getTE(te_index)->getGLTFMaterialOverride(); + if (override) + { + mMaterialOverride = *override; + mMaterialOverride.sanitizeAssetMaterial(); + } + } + return true; } bool mHasFacesWithoutPBR; bool mHasFacesWithPBR; + bool mIdenticalId; + bool mIdenticalOverride; + bool mInitialized; + LLGLTFMaterial mMaterialOverride; + LLUUID mPBRId; } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, id); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); + id = func.mPBRId; + identical = func.mIdenticalId && func.mIdenticalOverride; has_faces_with_pbr = func.mHasFacesWithPBR; has_faces_without_pbr = func.mHasFacesWithoutPBR; } -- cgit v1.2.3 From e7e565dc6e7e0c666132ffffa4798b2cfc00d6a4 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 21 Jul 2023 13:01:11 -0700 Subject: SL-20024: Put material in object inventory when material is no-modify or no-transfer --- indra/newview/llpanelface.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 837217387f..b633ccc5d5 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -3093,12 +3093,7 @@ void LLPanelFace::onSelectPbr(const LLSD& data) { id = pbr_ctrl->getImageAssetID(); } - if (LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id)) - { - LLSelectedTEMaterial::setMaterialID(this, id); - } - else - { + if (!LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id)) refresh(); } } -- cgit v1.2.3 From a4030031f895f8497e106f0547eb29780d6ec4e9 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 21 Jul 2023 17:28:09 -0700 Subject: SL-20024: Do not show material preview for no-modify materials --- indra/newview/llpanelface.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b633ccc5d5..e91b14a453 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -3094,6 +3094,7 @@ void LLPanelFace::onSelectPbr(const LLSD& data) id = pbr_ctrl->getImageAssetID(); } if (!LLSelectMgr::getInstance()->selectionSetGLTFMaterial(id)) + { refresh(); } } @@ -4989,23 +4990,24 @@ void LLPanelFace::onPbrSelectionChanged(LLInventoryItem* itemp) LLSaleInfo sale_info; LLSelectMgr::instance().selectGetSaleInfo(sale_info); - bool can_copy = itemp->getPermissions().allowCopyBy(gAgentID); // do we have perm to copy this texture? - bool can_transfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID); // do we have perm to transfer this texture? - bool is_object_owner = gAgentID == obj_owner_id; // does object for which we are going to apply texture belong to the agent? - bool not_for_sale = !sale_info.isForSale(); // is object for which we are going to apply texture not for sale? + bool can_copy = itemp->getPermissions().allowCopyBy(gAgentID); // do we have perm to copy this material? + bool can_transfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgentID); // do we have perm to transfer this material? + bool can_modify = itemp->getPermissions().allowOperationBy(PERM_MODIFY, gAgentID); // do we have perm to transfer this material? + bool is_object_owner = gAgentID == obj_owner_id; // does object for which we are going to apply material belong to the agent? + bool not_for_sale = !sale_info.isForSale(); // is object for which we are going to apply material not for sale? - if (can_copy && can_transfer) + if (can_copy && can_transfer && can_modify) { pbr_ctrl->setCanApply(true, true); return; } - // if texture has (no-transfer) attribute it can be applied only for object which we own and is not for sale + // if material has (no-transfer) attribute it can be applied only for object which we own and is not for sale pbr_ctrl->setCanApply(false, can_transfer ? true : is_object_owner && not_for_sale); if (gSavedSettings.getBOOL("TextureLivePreview")) { - LLNotificationsUtil::add("LivePreviewUnavailable"); + LLNotificationsUtil::add("LivePreviewUnavailablePBR"); } } } -- cgit v1.2.3 From 7bf6103ad95c281c2ed680c9eb9b07cc584ddc91 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 25 Jul 2023 14:52:56 -0700 Subject: SL-20024: (WIP) (not tested) Improved behavior for saving material to inventory. Check perms, keep perms. --- indra/newview/llpanelface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index e91b14a453..b9daf19284 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1856,7 +1856,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, getChildView("pbr_from_inventory")->setEnabled(editable && has_pbr_capabilities); getChildView("edit_selected_pbr")->setEnabled(editable && has_pbr_material && !has_faces_without_pbr && has_pbr_capabilities); - getChildView("save_selected_pbr")->setEnabled(objectp->permCopy() && has_pbr_material && identical_pbr && has_pbr_capabilities); + getChildView("save_selected_pbr")->setEnabled(LLMaterialEditor::canSaveObjectsMaterial() && identical_pbr); const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); if (show_pbr) -- cgit v1.2.3 From a5d318567cc5c3e8f2f86fce1132f5883014e14e Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 28 Jul 2023 17:29:09 -0700 Subject: SL-20024: (WIP) (untested) Fix GLTF material permissions in some more edge cases --- indra/newview/llpanelface.cpp | 57 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b9daf19284..90271b75b2 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -51,6 +51,7 @@ #include "llinventorymodelbackgroundfetch.h" #include "llfloatermediasettings.h" #include "llfloaterreg.h" +#include "llfloatertools.h" #include "lllineeditor.h" #include "llmaterialmgr.h" #include "llmaterialeditor.h" @@ -77,6 +78,7 @@ #include "llviewerregion.h" #include "llviewerstats.h" #include "llvovolume.h" +#include "llvoinventorylistener.h" #include "lluictrlfactory.h" #include "llpluginclassmedia.h" #include "llviewertexturelist.h"// Update sel manager as to which channel we're editing so it can reflect the correct overlay UI @@ -1834,13 +1836,48 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } } +// One-off listener that updates the build floater UI when the prim inventory updates +class PBRPickerItemListener : public LLVOInventoryListener +{ +protected: + LLViewerObject* mObjectp; +public: + + PBRPickerItemListener(LLViewerObject* object) + : mObjectp(object) + { + registerVOInventoryListener(mObjectp, nullptr); + } + + const LLViewerObject* const getObject() { return mObjectp; } + + void inventoryChanged(LLViewerObject* object, + LLInventoryObject::object_list_t* inventory, + S32 serial_num, + void* user_data) override + { + if (gFloaterTools) + { + gFloaterTools->dirty(); + } + removeVOInventoryListener(); + } + + ~PBRPickerItemListener() + { + removeVOInventoryListener(); + } +}; + void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, bool& has_faces_without_pbr, bool force_set_values) { has_pbr_material = false; - const bool editable = objectp->permModify() && !objectp->isPermanentEnforced(); bool has_pbr_capabilities = LLMaterialEditor::capabilitiesAvailable(); bool identical_pbr = true; + const bool settable = has_pbr_capabilities && objectp->permModify() && !objectp->isPermanentEnforced(); + const bool editable = LLMaterialEditor::canModifyObjectsMaterial(); + const bool saveable = LLMaterialEditor::canSaveObjectsMaterial(); // pbr material LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); @@ -1850,13 +1887,23 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr); pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); - pbr_ctrl->setEnabled(editable && has_pbr_capabilities); + pbr_ctrl->setEnabled(settable); pbr_ctrl->setImageAssetID(pbr_id); } - getChildView("pbr_from_inventory")->setEnabled(editable && has_pbr_capabilities); - getChildView("edit_selected_pbr")->setEnabled(editable && has_pbr_material && !has_faces_without_pbr && has_pbr_capabilities); - getChildView("save_selected_pbr")->setEnabled(LLMaterialEditor::canSaveObjectsMaterial() && identical_pbr); + const bool inventory_pending = objectp->isInventoryPending(); + getChildView("pbr_from_inventory")->setEnabled(settable); + getChildView("edit_selected_pbr")->setEnabled(editable && !inventory_pending && !has_faces_without_pbr); + getChildView("save_selected_pbr")->setEnabled(saveable && !inventory_pending && identical_pbr); + // TODO: Vet inventory updates and memory management + if (inventory_pending && (!mInventoryListener || mInventoryListener->getObject() != objectp)) + { + mInventoryListener = std::make_unique(objectp); + } + else + { + mInventoryListener = nullptr; + } const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); if (show_pbr) -- cgit v1.2.3 From 27842d0c5f34b03f6ce16ebbff0e7cb39d3a4fd8 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 31 Jul 2023 16:30:50 -0700 Subject: SL-20024: Fix material edit/save buttons on build floater sometimes not re-enabling after object inventory load --- indra/newview/llpanelface.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 90271b75b2..790c693a3d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1841,6 +1841,7 @@ class PBRPickerItemListener : public LLVOInventoryListener { protected: LLViewerObject* mObjectp; + bool mChangePending = true; public: PBRPickerItemListener(LLViewerObject* object) @@ -1849,7 +1850,10 @@ public: registerVOInventoryListener(mObjectp, nullptr); } - const LLViewerObject* const getObject() { return mObjectp; } + const bool isListeningFor(const LLViewerObject* objectp) const + { + return mChangePending && (objectp == mObjectp); + } void inventoryChanged(LLViewerObject* object, LLInventoryObject::object_list_t* inventory, @@ -1861,11 +1865,13 @@ public: gFloaterTools->dirty(); } removeVOInventoryListener(); + mChangePending = false; } ~PBRPickerItemListener() { removeVOInventoryListener(); + mChangePending = false; } }; @@ -1893,12 +1899,16 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, const bool inventory_pending = objectp->isInventoryPending(); getChildView("pbr_from_inventory")->setEnabled(settable); + // TODO: Put message on these two buttons when material permissions are still loading getChildView("edit_selected_pbr")->setEnabled(editable && !inventory_pending && !has_faces_without_pbr); getChildView("save_selected_pbr")->setEnabled(saveable && !inventory_pending && identical_pbr); - // TODO: Vet inventory updates and memory management - if (inventory_pending && (!mInventoryListener || mInventoryListener->getObject() != objectp)) + if (inventory_pending) { - mInventoryListener = std::make_unique(objectp); + // Reuse the same listener when possible + if (!mInventoryListener || !mInventoryListener->isListeningFor(objectp)) + { + mInventoryListener = std::make_unique(objectp); + } } else { -- cgit v1.2.3 From 6c8ced0edd9e2b86914e3e316ba65ae9492d3e6f Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 1 Aug 2023 12:36:49 -0700 Subject: SL-20024: Show loading message when inventory permissions are loading --- indra/newview/llpanelface.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 790c693a3d..21651899db 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1102,7 +1102,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("checkbox_sync_settings")->setEnabled(editable); childSetValue("checkbox_sync_settings", gSavedSettings.getBOOL("SyncMaterialSettings")); - updateVisibility(); + updateVisibility(objectp); // Color swatch { @@ -1899,7 +1899,6 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, const bool inventory_pending = objectp->isInventoryPending(); getChildView("pbr_from_inventory")->setEnabled(settable); - // TODO: Put message on these two buttons when material permissions are still loading getChildView("edit_selected_pbr")->setEnabled(editable && !inventory_pending && !has_faces_without_pbr); getChildView("save_selected_pbr")->setEnabled(saveable && !inventory_pending && identical_pbr); if (inventory_pending) @@ -1938,9 +1937,10 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, } } -void LLPanelFace::updateVisibilityGLTF() +void LLPanelFace::updateVisibilityGLTF(LLViewerObject* objectp /*= nullptr */) { const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); + const bool inventory_pending = objectp && objectp->isInventoryPending(); LLRadioGroup* radio_pbr_type = findChild("radio_pbr_type"); radio_pbr_type->setVisible(show_pbr); @@ -1951,8 +1951,9 @@ void LLPanelFace::updateVisibilityGLTF() getChildView("pbr_control")->setVisible(show_pbr_render_material_id); getChildView("pbr_from_inventory")->setVisible(show_pbr_render_material_id); - getChildView("edit_selected_pbr")->setVisible(show_pbr_render_material_id); - getChildView("save_selected_pbr")->setVisible(show_pbr_render_material_id); + getChildView("edit_selected_pbr")->setVisible(show_pbr_render_material_id && !inventory_pending); + getChildView("save_selected_pbr")->setVisible(show_pbr_render_material_id && !inventory_pending); + getChildView("material_permissions_loading_label")->setVisible(show_pbr_render_material_id && inventory_pending); getChildView("gltfTextureScaleU")->setVisible(show_pbr); getChildView("gltfTextureScaleV")->setVisible(show_pbr); @@ -2793,7 +2794,7 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) self->refreshMedia(); } -void LLPanelFace::updateVisibility() +void LLPanelFace::updateVisibility(LLViewerObject* objectp /* = nullptr */) { LLRadioGroup* radio_mat_type = findChild("radio_material_type"); LLRadioGroup* radio_pbr_type = findChild("radio_pbr_type"); @@ -2884,7 +2885,7 @@ void LLPanelFace::updateVisibility() getChild("rptctrl")->setVisible(show_material || show_media); // PBR controls - updateVisibilityGLTF(); + updateVisibilityGLTF(objectp); } // static -- cgit v1.2.3 From 466914e122f201e62d8e969dcc684791e06333d3 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 11 Aug 2023 17:18:06 -0700 Subject: SL-20024: Double-check object inventory is not pending when save button pressed --- indra/newview/llpanelface.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 21651899db..8f09136ccf 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1897,11 +1897,10 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, pbr_ctrl->setImageAssetID(pbr_id); } - const bool inventory_pending = objectp->isInventoryPending(); getChildView("pbr_from_inventory")->setEnabled(settable); - getChildView("edit_selected_pbr")->setEnabled(editable && !inventory_pending && !has_faces_without_pbr); - getChildView("save_selected_pbr")->setEnabled(saveable && !inventory_pending && identical_pbr); - if (inventory_pending) + getChildView("edit_selected_pbr")->setEnabled(editable && !has_faces_without_pbr); + getChildView("save_selected_pbr")->setEnabled(saveable && identical_pbr); + if (objectp->isInventoryPending()) { // Reuse the same listener when possible if (!mInventoryListener || !mInventoryListener->isListeningFor(objectp)) -- cgit v1.2.3 From ef33902f220df35727ba54ee8bc3ed02bc53d6be Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 18 Aug 2023 19:59:14 +0300 Subject: SL-20145 GLTF specific feature notification --- indra/newview/llpanelface.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 8f09136ccf..b502fa3546 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -492,6 +492,15 @@ LLPanelFace::~LLPanelFace() unloadMedia(); } +void LLPanelFace::onVisibilityChange(BOOL new_visibility) +{ + if (new_visibility) + { + gAgent.showLatestFeatureNotification("gltf"); + } + LLPanel::onVisibilityChange(new_visibility); +} + void LLPanelFace::draw() { updateCopyTexButton(); -- cgit v1.2.3 From 05c8ef3f3c002e71805bb04e9eddc3280630fca1 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 1 Sep 2023 17:36:00 -0700 Subject: SL-20167: Grey out the clipboard when copying the material to clipboard is not allowed --- indra/newview/llpanelface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b502fa3546..d86956e370 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1975,7 +1975,8 @@ void LLPanelFace::updateCopyTexButton() LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); mMenuClipboardTexture->setEnabled(objectp && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify() && !objectp->isPermanentEnforced() && !objectp->isInventoryPending() - && (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1)); + && (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1) + && LLMaterialEditor::canClipboardObjectsMaterial()); std::string tooltip = (objectp && objectp->isInventoryPending()) ? LLTrans::getString("LoadingContents") : getString("paste_options"); mMenuClipboardTexture->setToolTip(tooltip); } @@ -4147,7 +4148,8 @@ void LLPanelFace::onCopyTexture() || objectp->getPCode() != LL_PCODE_VOLUME || !objectp->permModify() || objectp->isPermanentEnforced() - || selected_count > 1) + || selected_count > 1 + || !LLMaterialEditor::canClipboardObjectsMaterial()) { return; } -- cgit v1.2.3 From ab66df94cb7c4cc9a4530ea547aaf81dddec34de Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Wed, 6 Sep 2023 11:02:31 -0700 Subject: SL-20167: Also check permission on paste to be certain --- indra/newview/llpanelface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index d86956e370..df464bc7e5 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4344,7 +4344,8 @@ void LLPanelFace::onPasteTexture() || objectp->getPCode() != LL_PCODE_VOLUME || !objectp->permModify() || objectp->isPermanentEnforced() - || selected_count > 1) + || selected_count > 1 + || !LLMaterialEditor::canClipboardObjectsMaterial()) { // not supposed to happen LL_WARNS() << "Failed to paste texture due to missing or wrong selection" << LL_ENDL; -- cgit v1.2.3 From 97ee8b207bf43a8acb3f2702d26eb5f3b7471e45 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 19 Sep 2023 00:54:14 +0300 Subject: SL-5522 Fix applying textuers and materials with limited restrictions to attachments 1. Texture picker now updates filter's permissions based on selection 2. Various panels now properly check permissions --- indra/newview/llpanelface.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index df464bc7e5..e1f08915fa 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1010,6 +1010,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) && objectp->permModify()) { BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); + BOOL attachment = objectp->isAttachment(); bool has_pbr_material; bool has_faces_without_pbr; @@ -1306,6 +1307,18 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) texture_ctrl->setBakeTextureEnabled(TRUE); } + + if (attachment) + { + // attachments are in world and in inventory, + // server doesn't support changing permissions + // in such case + texture_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + } + else + { + texture_ctrl->setImmediateFilterPermMask(PERM_NONE); + } } if (shinytexture_ctrl) @@ -1313,6 +1326,15 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) shinytexture_ctrl->setTentative( !identical_spec ); shinytexture_ctrl->setEnabled( editable && !has_pbr_material); shinytexture_ctrl->setImageAssetID( specmap_id ); + + if (attachment) + { + shinytexture_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + } + else + { + shinytexture_ctrl->setImmediateFilterPermMask(PERM_NONE); + } } if (bumpytexture_ctrl) @@ -1320,6 +1342,15 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) bumpytexture_ctrl->setTentative( !identical_norm ); bumpytexture_ctrl->setEnabled( editable && !has_pbr_material); bumpytexture_ctrl->setImageAssetID( normmap_id ); + + if (attachment) + { + bumpytexture_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + } + else + { + bumpytexture_ctrl->setImmediateFilterPermMask(PERM_NONE); + } } } @@ -1904,6 +1935,15 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); pbr_ctrl->setEnabled(settable); pbr_ctrl->setImageAssetID(pbr_id); + + if (objectp->isAttachment()) + { + pbr_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); + } + else + { + pbr_ctrl->setImmediateFilterPermMask(PERM_NONE); + } } getChildView("pbr_from_inventory")->setEnabled(settable); -- cgit v1.2.3 From 6e32993c8787e7ba569d5a9ebcdb994c2ba03671 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Tue, 26 Sep 2023 13:59:31 +0300 Subject: SL-20338 FIXED Texture tab Material drop-down does not change if same numbered face is selected --- indra/newview/llpanelface.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index e1f08915fa..1428f7fe23 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1056,6 +1056,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTEMaterial::getSpecularID(specmap_id, identical_spec); static S32 selected_te = -1; + static LLUUID prev_obj_id; if ((LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()) && !LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected()) { @@ -1070,7 +1071,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } } - if (new_selection != selected_te) + if ((new_selection != selected_te) + || (prev_obj_id != objectp->getID())) { bool te_has_media = objectp->getTE(new_selection) && objectp->getTE(new_selection)->hasMedia(); bool te_has_pbr = objectp->getRenderMaterialID(new_selection).notNull(); @@ -1088,6 +1090,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); } selected_te = new_selection; + prev_obj_id = objectp->getID(); } } -- cgit v1.2.3 From 1b493d56905a2d3875648196ac1bc39fc71e895a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 27 Sep 2023 21:11:01 +0300 Subject: SL-20343 Material floater was disconnected from object's face --- indra/newview/llpanelface.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 1428f7fe23..cb28fb4770 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -515,6 +515,7 @@ void LLPanelFace::draw() if (sMaterialOverrideSelection.update()) { setMaterialOverridesFromSelection(); + LLMaterialEditor::updateLive(); } } -- cgit v1.2.3 From e154fee226b4a33d5b55f3cebf1667e5d0604db5 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Mon, 30 Oct 2023 16:40:04 +0200 Subject: SL-20541 Reorder radio buttons in Edit tools Texture tab to match order in a Material --- indra/newview/llpanelface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index cb28fb4770..9150b89de3 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -113,9 +113,9 @@ const S32 BUMPY_TEXTURE = 18; // use supplied normal map const S32 SHINY_TEXTURE = 4; // use supplied specular map const S32 PBRTYPE_RENDER_MATERIAL_ID = 0; // Render Material ID const S32 PBRTYPE_BASE_COLOR = 1; // PBR Base Color -const S32 PBRTYPE_NORMAL = 2; // PBR Normal -const S32 PBRTYPE_METALLIC_ROUGHNESS = 3; // PBR Metallic -const S32 PBRTYPE_EMISSIVE = 4; // PBR Emissive +const S32 PBRTYPE_METALLIC_ROUGHNESS = 2; // PBR Metallic +const S32 PBRTYPE_EMISSIVE = 3; // PBR Emissive +const S32 PBRTYPE_NORMAL = 4; // PBR Normal LLGLTFMaterial::TextureInfo texture_info_from_pbrtype(S32 pbr_type) { -- cgit v1.2.3 From 711354c2f526421b7cd2918f584731624a9995e5 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Thu, 2 Nov 2023 09:55:44 -0700 Subject: SL-20553: Save material button in build floater now depends on agent inventory rather than object inventory --- indra/newview/llpanelface.cpp | 65 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9150b89de3..02c00e7f87 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1880,15 +1880,55 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } } +// One-off listener that updates the build floater UI when the agent inventory adds or removes an item +class PBRPickerAgentListener : public LLInventoryObserver +{ +protected: + bool mChangePending = true; +public: + PBRPickerAgentListener() : LLInventoryObserver() + { + gInventory.addObserver(this); + } + + const bool isListening() + { + return mChangePending; + } + + void changed(U32 mask) override + { + if (!(mask & (ADD | REMOVE))) + { + return; + } + + if (gFloaterTools) + { + gFloaterTools->dirty(); + } + gInventory.removeObserver(this); + mChangePending = false; + } + + ~PBRPickerAgentListener() override + { + gInventory.removeObserver(this); + mChangePending = false; + + LLInventoryObserver::~LLInventoryObserver(); + } +}; + // One-off listener that updates the build floater UI when the prim inventory updates -class PBRPickerItemListener : public LLVOInventoryListener +class PBRPickerObjectListener : public LLVOInventoryListener { protected: LLViewerObject* mObjectp; bool mChangePending = true; public: - PBRPickerItemListener(LLViewerObject* object) + PBRPickerObjectListener(LLViewerObject* object) : mObjectp(object) { registerVOInventoryListener(mObjectp, nullptr); @@ -1912,7 +1952,7 @@ public: mChangePending = false; } - ~PBRPickerItemListener() + ~PBRPickerObjectListener() { removeVOInventoryListener(); mChangePending = false; @@ -1931,9 +1971,9 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, // pbr material LLTextureCtrl* pbr_ctrl = findChild("pbr_control"); + LLUUID pbr_id; if (pbr_ctrl) { - LLUUID pbr_id; LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr); pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); @@ -1956,14 +1996,25 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, if (objectp->isInventoryPending()) { // Reuse the same listener when possible - if (!mInventoryListener || !mInventoryListener->isListeningFor(objectp)) + if (!mVOInventoryListener || !mVOInventoryListener->isListeningFor(objectp)) { - mInventoryListener = std::make_unique(objectp); + mVOInventoryListener = std::make_unique(objectp); } } else { - mInventoryListener = nullptr; + mVOInventoryListener = nullptr; + } + if (!identical_pbr || pbr_id.isNull() || pbr_id == LLGLTFMaterialList::BLANK_MATERIAL_ASSET_ID) + { + mAgentInventoryListener = nullptr; + } + else + { + if (!mAgentInventoryListener || !mAgentInventoryListener->isListening()) + { + mAgentInventoryListener = std::make_unique(); + } } const bool show_pbr = mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR && mComboMatMedia->getEnabled(); -- cgit v1.2.3 From ba1f87b36e91668b6f87bc996b06db79f2763901 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Fri, 17 Nov 2023 13:26:08 -0800 Subject: SL-20553: Fix crash in ~PBRPickerAgentListener --- indra/newview/llpanelface.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 02c00e7f87..bf54d17111 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1915,8 +1915,6 @@ public: { gInventory.removeObserver(this); mChangePending = false; - - LLInventoryObserver::~LLInventoryObserver(); } }; -- cgit v1.2.3 From b96ca755b36737eb07645df7b172be002d9509f2 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Wed, 29 Nov 2023 16:46:10 +0200 Subject: SL-20647 don't allow dragging 'no mod' material into the picker of an attached object --- indra/newview/llpanelface.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index bf54d17111..e7b856f743 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1981,6 +1981,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, if (objectp->isAttachment()) { pbr_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); + pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); } else { -- cgit v1.2.3 From 88aefc95eace0bb8ea21cb44514d41d98bdf74cc Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Thu, 30 Nov 2023 17:47:46 +0200 Subject: SL-20655 FIXED Texture permissions not enforced in Material floaters --- indra/newview/llpanelface.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index e7b856f743..ffcc4be290 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1980,8 +1980,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, if (objectp->isAttachment()) { - pbr_ctrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); - pbr_ctrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); + pbr_ctrl->setFilterPermissionMasks(PERM_COPY | PERM_TRANSFER | PERM_MODIFY); } else { -- cgit v1.2.3 From 7398efb1f4ccf36f9c107e920f38c3096cca2f2f Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Fri, 8 Dec 2023 20:15:47 +0200 Subject: SL-20701 FIXED Build tool texture tab shows incorrect material parameters in some cases --- indra/newview/llpanelface.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index ffcc4be290..f0f66831cb 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1094,7 +1094,21 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) prev_obj_id = objectp->getID(); } } - + else + { + if (prev_obj_id != objectp->getID()) + { + if (has_pbr_material && (mComboMatMedia->getCurrentIndex() == MATMEDIA_MATERIAL)) + { + mComboMatMedia->selectNthItem(MATMEDIA_PBR); + } + else if (!has_pbr_material && (mComboMatMedia->getCurrentIndex() == MATMEDIA_PBR)) + { + mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL); + } + prev_obj_id = objectp->getID(); + } + } mComboMatMedia->setEnabled(editable); LLRadioGroup* radio_mat_type = getChild("radio_material_type"); -- cgit v1.2.3 From 2d3b52d02ee72d94c6299220c05e5f5343979da3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 13 Dec 2023 00:48:05 +0200 Subject: SL-20715 Mapping mode and specular color not copied correctly and fixed diffuse alpha --- indra/newview/llpanelface.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index f0f66831cb..91cc177fd5 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4290,6 +4290,7 @@ void LLPanelFace::onCopyTexture() te_data["te"]["bumpmap"] = tep->getBumpmap(); te_data["te"]["bumpshiny"] = tep->getBumpShiny(); te_data["te"]["bumpfullbright"] = tep->getBumpShinyFullbright(); + te_data["te"]["texgen"] = tep->getTexGen(); te_data["te"]["pbr"] = objectp->getRenderMaterialID(te); if (tep->getGLTFMaterialOverride() != nullptr) { @@ -4685,6 +4686,11 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) { objectp->setTEBumpShinyFullbright(te, (U8)te_data["te"]["bumpfullbright"].asInteger()); } + if (te_data["te"].has("texgen")) + { + objectp->setTETexGen(te, (U8)te_data["te"]["texgen"].asInteger()); + } + // PBR/GLTF if (te_data["te"].has("pbr")) { @@ -4796,11 +4802,11 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) LLSelectedTEMaterial::setSpecularOffsetX(this, (F32)te_data["material"]["SpecOffX"].asReal(), te, object_id); LLSelectedTEMaterial::setSpecularOffsetY(this, (F32)te_data["material"]["SpecOffY"].asReal(), te, object_id); LLSelectedTEMaterial::setSpecularRotation(this, (F32)te_data["material"]["SpecRot"].asReal(), te, object_id); - LLColor4 spec_color(te_data["material"]["SpecColor"]); + LLColor4U spec_color(te_data["material"]["SpecColor"]); LLSelectedTEMaterial::setSpecularLightColor(this, spec_color, te); LLSelectedTEMaterial::setSpecularLightExponent(this, (U8)te_data["material"]["SpecExp"].asInteger(), te, object_id); LLSelectedTEMaterial::setEnvironmentIntensity(this, (U8)te_data["material"]["EnvIntensity"].asInteger(), te, object_id); - LLSelectedTEMaterial::setDiffuseAlphaMode(this, (U8)te_data["material"]["SpecRot"].asInteger(), te, object_id); + LLSelectedTEMaterial::setDiffuseAlphaMode(this, (U8)te_data["material"]["DiffuseAlphaMode"].asInteger(), te, object_id); if (te_data.has("te") && te_data["te"].has("shiny")) { objectp->setTEShiny(te, (U8)te_data["te"]["shiny"].asInteger()); -- cgit v1.2.3 From 1b1457154d644ce1da448445aef773666eca4a0f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 14 Dec 2023 17:41:57 +0200 Subject: SL-20715 Mask cutoff not copied corretly in build tools --- indra/newview/llpanelface.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 91cc177fd5..5f8071d3eb 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -4759,8 +4759,6 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) { LLUUID object_id = objectp->getID(); - LLSelectedTEMaterial::setAlphaMaskCutoff(this, (U8)te_data["material"]["SpecRot"].asInteger(), te, object_id); - // Normal // Replace placeholders with target's if (te_data["material"].has("NormMapNoCopy")) @@ -4807,6 +4805,7 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) LLSelectedTEMaterial::setSpecularLightExponent(this, (U8)te_data["material"]["SpecExp"].asInteger(), te, object_id); LLSelectedTEMaterial::setEnvironmentIntensity(this, (U8)te_data["material"]["EnvIntensity"].asInteger(), te, object_id); LLSelectedTEMaterial::setDiffuseAlphaMode(this, (U8)te_data["material"]["DiffuseAlphaMode"].asInteger(), te, object_id); + LLSelectedTEMaterial::setAlphaMaskCutoff(this, (U8)te_data["material"]["AlphaMaskCutoff"].asInteger(), te, object_id); if (te_data.has("te") && te_data["te"].has("shiny")) { objectp->setTEShiny(te, (U8)te_data["te"]["shiny"].asInteger()); -- cgit v1.2.3