diff options
author | Dave Parks <davep@lindenlab.com> | 2022-09-22 17:27:41 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-09-22 17:27:41 -0500 |
commit | 0afc237de2b3c8286efda25f9ca72aa710bc81ef (patch) | |
tree | 9cb3dd377963500eae8899723a4f6294f952235e /indra/newview | |
parent | e5d463ca200bdfa93b8c65e588d490c2f23e3918 (diff) | |
parent | 524e5f06b7665cf7b26f451998a418d2cfe9ae13 (diff) |
Merge branch 'DRTVWR-559' of ssh://bitbucket.org/lindenlab/viewer into DRTVWR-559
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llmaterialeditor.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llpanelface.cpp | 37 | ||||
-rw-r--r-- | indra/newview/llpanelvolume.cpp | 21 | ||||
-rw-r--r-- | indra/newview/llselectmgr.cpp | 25 | ||||
-rw-r--r-- | indra/newview/lltooldraganddrop.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 74 | ||||
-rw-r--r-- | indra/newview/llviewerobject.h | 5 |
7 files changed, 143 insertions, 53 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index bdc66a85fc..4efbf19572 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -32,6 +32,9 @@ #include "llagentbenefits.h" #include "llappviewer.h" #include "llcombobox.h" +#include "llfloaterreg.h" +#include "llfilesystem.h" +#include "llgltfmateriallist.h" #include "llinventorymodel.h" #include "llnotificationsutil.h" #include "lltexturectrl.h" @@ -47,8 +50,6 @@ #include "llvovolume.h" #include "roles_constants.h" #include "llviewerobjectlist.h" -#include "llfloaterreg.h" -#include "llfilesystem.h" #include "llsdserialize.h" #include "llimagej2c.h" #include "llviewertexturelist.h" @@ -1525,8 +1526,8 @@ void LLMaterialEditor::importMaterial() class LLRemderMaterialFunctor : public LLSelectedTEFunctor { public: - LLRemderMaterialFunctor(LLGLTFMaterial *mat, const LLUUID &id) - : mMat(mat), mMatId(id) + LLRemderMaterialFunctor(const LLUUID &id) + : mMatId(id) { } @@ -1535,24 +1536,23 @@ public: if (objectp && objectp->permModify() && objectp->getVolume()) { LLVOVolume* vobjp = (LLVOVolume*)objectp; - vobjp->setRenderMaterialID(te, mMatId); - vobjp->getTE(te)->setGLTFMaterial(mMat); + vobjp->setRenderMaterialID(te, mMatId, false /*preview only*/); vobjp->updateTEMaterialTextures(te); } return true; } private: - LLPointer<LLGLTFMaterial> mMat; LLUUID mMatId; }; void LLMaterialEditor::applyToSelection() { + // Placehodler. Will be removed once override systems gets finished. LLPointer<LLGLTFMaterial> mat = new LLGLTFMaterial(); getGLTFMaterial(mat); const LLUUID placeholder("984e183e-7811-4b05-a502-d79c6f978a98"); - LLUUID asset_id = mAssetID.notNull() ? mAssetID : placeholder; - LLRemderMaterialFunctor mat_func(mat, asset_id); + gGLTFMaterialList.addMaterial(placeholder, mat); + LLRemderMaterialFunctor mat_func(placeholder); LLObjectSelectionHandle selected_objects = LLSelectMgr::getInstance()->getSelection(); selected_objects->applyToTEs(&mat_func); } 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<LLVOVolume*>(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")) diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index b50b652966..7ddce19bd0 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -1091,6 +1091,14 @@ void LLPanelVolume::onCopyLight() } } + if (volobjp && volobjp->isReflectionProbe()) + { + clipboard["reflection_probe"]["is_box"] = volobjp->getReflectionProbeIsBox(); + clipboard["reflection_probe"]["ambiance"] = volobjp->getReflectionProbeAmbiance(); + clipboard["reflection_probe"]["near_clip"] = volobjp->getReflectionProbeNearClip(); + clipboard["reflection_probe"]["dynamic"] = volobjp->getReflectionProbeIsDynamic(); + } + mClipboardParams["light"] = clipboard; } @@ -1138,6 +1146,19 @@ void LLPanelVolume::onPasteLight() spot_params.mV[2] = (F32)clipboard["spot"]["ambiance"].asReal(); volobjp->setSpotLightParams(spot_params); } + + if (clipboard.has("reflection_probe")) + { + volobjp->setIsReflectionProbe(TRUE); + volobjp->setReflectionProbeIsBox(clipboard["reflection_probe"]["is_box"].asBoolean()); + volobjp->setReflectionProbeAmbiance((F32)clipboard["reflection_probe"]["ambiance"].asReal()); + volobjp->setReflectionProbeNearClip((F32)clipboard["reflection_probe"]["near_clip"].asReal()); + volobjp->setReflectionProbeIsDynamic(clipboard["reflection_probe"]["dynamic"].asBoolean()); + } + else + { + volobjp->setIsReflectionProbe(false); + } } } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 99835d4e5a..8f674afc24 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -2198,30 +2198,7 @@ void LLSelectMgr::selectionRevertGLTFMaterials() if (nodep && te < (S32)nodep->mSavedGLTFMaterials.size()) { LLUUID asset_id = nodep->mSavedGLTFMaterials[te]; - LLTextureEntry* tep = objectp->getTE(te); - if (asset_id.notNull()) - { - tep->setGLTFMaterial(gGLTFMaterialList.getMaterial(asset_id)); - - if (!objectp->hasRenderMaterialParams()) - { - // make sure param section exists - objectp->setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, TRUE, false /*prevent an immediate update*/); - } - } - else - { - tep->setGLTFMaterial(nullptr); - } - - objectp->faceMappingChanged(); - gPipeline.markTextured(objectp->mDrawable); - - LLRenderMaterialParams* param_block = (LLRenderMaterialParams*)objectp->getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL); - if (param_block) - { - param_block->setMaterial(te, asset_id); - } + objectp->setRenderMaterialID(te, asset_id, false /*wait for bulk update*/); } return true; } diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 282c84d7fc..be42e6f2b2 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1109,19 +1109,9 @@ void LLToolDragAndDrop::dropMaterialAllFaces(LLViewerObject* hit_obj, { return; } - - S32 num_faces = hit_obj->getNumTEs(); - for (S32 face = 0; face < num_faces; face++) - { - // update viewer side material in anticipation of update from simulator - - // TODO: fix this! - // Calling setRenderMaterialID multiple times sends material param - // updates multiple times and can create race condition. - // Send update only once! - hit_obj->setRenderMaterialID(face, asset_id); - dialog_refresh_all(); - } + + hit_obj->setRenderMaterialIDs(asset_id); + dialog_refresh_all(); // send the update to the simulator hit_obj->sendTEUpdate(); } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 022c191a65..f9c8f396a2 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -7075,7 +7075,7 @@ const LLUUID& LLViewerObject::getRenderMaterialID(U8 te) const return LLUUID::null; } -void LLViewerObject::setRenderMaterialID(U8 te, const LLUUID& id) +void LLViewerObject::setRenderMaterialID(U8 te, const LLUUID& id, bool update_server) { if (id.notNull()) { @@ -7084,7 +7084,12 @@ void LLViewerObject::setRenderMaterialID(U8 te, const LLUUID& id) if (!hasRenderMaterialParams()) { // make sure param section exists - setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, TRUE, false /*prevent an immediate update*/); + // but do not update server to avoid race conditions + ExtraParameter* param = getExtraParameterEntryCreate(LLNetworkData::PARAMS_RENDER_MATERIAL); + if (param) + { + param->in_use = true; + } } } else @@ -7102,6 +7107,71 @@ void LLViewerObject::setRenderMaterialID(U8 te, const LLUUID& id) if (param_block->isEmpty()) { // might be empty if id is null + if (hasRenderMaterialParams()) + { + if (update_server) + { + setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, FALSE, true); + } + else + { + ExtraParameter* param = getExtraParameterEntryCreate(LLNetworkData::PARAMS_RENDER_MATERIAL); + if (param) + { + param->in_use = false; + } + } + } + } + else if (update_server) + { + parameterChanged(LLNetworkData::PARAMS_RENDER_MATERIAL, true); + } + } +} + +void LLViewerObject::setRenderMaterialIDs(const LLUUID& id) +{ + if (id.notNull()) + { + if (!hasRenderMaterialParams()) + { + // make sure param section exists + // but do not update server to avoid race conditions + ExtraParameter* param = getExtraParameterEntryCreate(LLNetworkData::PARAMS_RENDER_MATERIAL); + if (param) + { + param->in_use = true; + } + } + } + + LLRenderMaterialParams* param_block = nullptr; + if (hasRenderMaterialParams()) + { + param_block = (LLRenderMaterialParams*)getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL); + } + + LLGLTFMaterial* material = id.isNull() ? nullptr : gGLTFMaterialList.getMaterial(id); + const S32 num_tes = llmin((S32)getNumTEs(), (S32)getNumFaces()); + + for (S32 te = 0; te < num_tes; te++) + { + getTE(te)->setGLTFMaterial(material); + + if (param_block) + { + param_block->setMaterial(te, id); + } + } + + faceMappingChanged(); + gPipeline.markTextured(mDrawable); + + if (param_block) + { + if (param_block->isEmpty()) + { setHasRenderMaterialParams(false); } else diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 680cfb9639..32f03c7869 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -184,8 +184,8 @@ public: void setHasRenderMaterialParams(bool has_params); const LLUUID& getRenderMaterialID(U8 te) const; - void setRenderMaterialID(U8 te, const LLUUID& id); - void setRenderMaterialIDs(const LLRenderMaterialParams* material_params, bool local_origin); + void setRenderMaterialID(U8 te, const LLUUID& id, bool update_server = true); + void setRenderMaterialIDs(const LLUUID& id); virtual BOOL isHUDAttachment() const { return FALSE; } virtual BOOL isTempAttachment() const; @@ -220,6 +220,7 @@ public: F32 getRotTime() { return mRotTime; } private: void resetRotTime(); + void setRenderMaterialIDs(const LLRenderMaterialParams* material_params, bool local_origin); public: void resetRot(); void applyAngularVelocity(F32 dt); |