diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-07-27 23:06:26 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-07-27 23:26:46 +0300 |
commit | 5e344813dc9bb4e5ecb8187642f97377c157955f (patch) | |
tree | 7a5daf4e64fed375b39329106def7a029c47827b /indra | |
parent | 119b02937ed42502549ba3dab2db48c6edef9425 (diff) |
SL-18396 PBR and blinn phong should not be allowed to be edited together
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelface.cpp | 39 | ||||
-rw-r--r-- | indra/newview/llpanelface.h | 4 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 14 |
3 files changed, 42 insertions, 15 deletions
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<LLUICtrl>("checkbox fullbright")->setValue((S32)(fullbright_flag != 0)); getChildView("checkbox fullbright")->setEnabled(editable && !has_pbr_material); getChild<LLUICtrl>("checkbox fullbright")->setTentative(!identical_fullbright); - getChild<LLComboBox>("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<LLUICtrl>("gltfTextureScaleU"); LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("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<LLUUID> { + 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) diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 4dfef5d9bc..7d567c7ce8 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -452,7 +452,7 @@ private: void onTextureSelectionChanged(LLInventoryItem* itemp); void onPbrSelectionChanged(LLInventoryItem* itemp); - void updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, bool force_set_values); + void updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, bool& has_faces_without_pbr, bool force_set_values); void updateVisibilityGLTF(); void updateSelectedGLTFMaterials(std::function<void(LLGLTFMaterial*)> func); @@ -595,7 +595,7 @@ public: static void getFace(class LLFace*& face_to_return, bool& identical_face); static void getImageFormat(LLGLenum& image_format_to_return, bool& identical_face); static void getTexId(LLUUID& id, bool& identical); - static void getPbrMaterialId(LLUUID& id, bool& identical); + static void getPbrMaterialId(LLUUID& id, bool& identical, bool& has_pbr, bool& has_faces_without_pbr); static void getObjectScaleS(F32& scale_s, bool& identical); static void getObjectScaleT(F32& scale_t, bool& identical); static void getMaxDiffuseRepeats(F32& repeats, bool& identical); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 6e5c268c00..ae04d536f1 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2800,7 +2800,12 @@ bool enable_object_inspect() struct LLSelectedTEGetmatIdAndPermissions : public LLSelectedTEFunctor { - LLSelectedTEGetmatIdAndPermissions() : mCanCopy(true), mCanModify(true), mCanTransfer(true) {} + LLSelectedTEGetmatIdAndPermissions() + : mCanCopy(true) + , mCanModify(true) + , mCanTransfer(true) + , mHasNonPbrFaces(false) + {} bool apply(LLViewerObject* objectp, S32 te_index) { mCanCopy &= (bool)objectp->permCopy(); @@ -2811,11 +2816,16 @@ struct LLSelectedTEGetmatIdAndPermissions : public LLSelectedTEFunctor { mMaterialId = mat_id; } + else + { + mHasNonPbrFaces = true; + } return true; } bool mCanCopy; bool mCanModify; bool mCanTransfer; + bool mHasNonPbrFaces; LLUUID mMaterialId; }; @@ -2828,7 +2838,7 @@ bool enable_object_edit_gltf_material() LLSelectedTEGetmatIdAndPermissions func; LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); - return func.mCanModify && func.mMaterialId.notNull(); + return func.mCanModify && !func.mHasNonPbrFaces; } bool enable_object_open() |