From 986567a6542603887c66daea7459b18f42267544 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Mon, 4 Feb 2019 18:14:03 +0200 Subject: SL-5570 - Align planar faces" does not work on normal or specular maps --- indra/newview/llpanelface.cpp | 66 ++++++++++++++++++++++++++++++++++--------- indra/newview/llpanelface.h | 23 +++++++-------- 2 files changed, 65 insertions(+), 24 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 38f181c803..5e6a44c09d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -444,14 +444,17 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor LLSpinCtrl* ctrlTexOffsetS = mPanel->getChild("TexOffsetU"); LLSpinCtrl* ctrlTexOffsetT = mPanel->getChild("TexOffsetV"); LLSpinCtrl* ctrlTexRotation = mPanel->getChild("TexRot"); - LLComboBox* comboTexGen = mPanel->getChild("combobox texgen"); + LLComboBox* comboTexGen = mPanel->getChild("combobox texgen"); + LLCheckBoxCtrl* cb_planar_align = mPanel->getChild("checkbox planar align"); + bool align_planar = (cb_planar_align && cb_planar_align->get()); + llassert(comboTexGen); llassert(object); if (ctrlTexScaleS) { valid = !ctrlTexScaleS->getTentative(); // || !checkFlipScaleS->getTentative(); - if (valid) + if (valid || align_planar) { value = ctrlTexScaleS->get(); if (comboTexGen && @@ -460,13 +463,19 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor value *= 0.5f; } object->setTEScaleS( te, value ); + + if (align_planar) + { + LLPanelFace::LLSelectedTEMaterial::setNormalRepeatX(mPanel, value, te); + LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatX(mPanel, value, te); + } } } if (ctrlTexScaleT) { valid = !ctrlTexScaleT->getTentative(); // || !checkFlipScaleT->getTentative(); - if (valid) + if (valid || align_planar) { value = ctrlTexScaleT->get(); //if( checkFlipScaleT->get() ) @@ -479,36 +488,60 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor value *= 0.5f; } object->setTEScaleT( te, value ); + + if (align_planar) + { + LLPanelFace::LLSelectedTEMaterial::setNormalRepeatY(mPanel, value, te); + LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatY(mPanel, value, te); + } } } if (ctrlTexOffsetS) { valid = !ctrlTexOffsetS->getTentative(); - if (valid) + if (valid || align_planar) { value = ctrlTexOffsetS->get(); object->setTEOffsetS( te, value ); + + if (align_planar) + { + LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, value, te); + LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, value, te); + } } } if (ctrlTexOffsetT) { valid = !ctrlTexOffsetT->getTentative(); - if (valid) + if (valid || align_planar) { value = ctrlTexOffsetT->get(); object->setTEOffsetT( te, value ); + + if (align_planar) + { + LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, value, te); + LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, value, te); + } } } if (ctrlTexRotation) { valid = !ctrlTexRotation->getTentative(); - if (valid) + if (valid || align_planar) { value = ctrlTexRotation->get() * DEG_TO_RAD; object->setTERotation( te, value ); + + if (align_planar) + { + LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, value, te); + LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, value, te); + } } } return true; @@ -550,14 +583,21 @@ struct LLPanelFaceSetAlignedTEFunctor : public LLSelectedTEFunctor if (set_aligned) { object->setTEOffset(te, uv_offset.mV[VX], uv_offset.mV[VY]); - object->setTEScale(te, uv_scale.mV[VX], uv_scale.mV[VY]); + object->setTEScale(te, uv_scale.mV[VX], uv_scale.mV[VY]); object->setTERotation(te, uv_rot); - LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, uv_offset.mV[VX], te); - LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, uv_offset.mV[VY], te); - LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, uv_offset.mV[VX], te); - LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, uv_offset.mV[VY], te); - LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, uv_rot, te); - LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, uv_rot, te); + + LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, uv_rot, te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, uv_rot, te, object->getID()); + + LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, uv_offset.mV[VX], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, uv_offset.mV[VY], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setNormalRepeatX(mPanel, uv_scale.mV[VX], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setNormalRepeatY(mPanel, uv_scale.mV[VY], te, object->getID()); + + LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, uv_offset.mV[VX], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, uv_offset.mV[VY], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatX(mPanel, uv_scale.mV[VX], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatY(mPanel, uv_scale.mV[VY], te, object->getID()); } } if (!set_aligned) diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 4937966034..0b40d7d41a 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -252,16 +252,16 @@ private: typename DataType, typename SetValueType, void (LLMaterial::*MaterialEditFunc)(SetValueType data) > - static void edit(LLPanelFace* p, DataType data, int te = -1) + static void edit(LLPanelFace* p, DataType data, int te = -1, const LLUUID &only_for_object_id = LLUUID()) { LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc > edit(data); struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor { - LLSelectedTEEditMaterial(LLPanelFace* panel, LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* editp) : _panel(panel), _edit(editp) {} + LLSelectedTEEditMaterial(LLPanelFace* panel, LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* editp, const LLUUID &only_for_object_id) : _panel(panel), _edit(editp), _only_for_object_id(only_for_object_id) {} virtual ~LLSelectedTEEditMaterial() {}; virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material) { - if (_edit) + if (_edit && (_only_for_object_id.isNull() || _only_for_object_id == object->getID())) { LLMaterialPtr new_material = _panel->createDefaultMaterial(current_material); llassert_always(new_material); @@ -325,14 +325,15 @@ private: return NULL; } LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* _edit; - LLPanelFace* _panel; - } editor(p, &edit); - LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor, te); + LLPanelFace *_panel; + const LLUUID & _only_for_object_id; + } editor(p, &edit, only_for_object_id); + LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor, te); } template< typename DataType, - typename ReturnType, + typename ReturnType, ReturnType (LLMaterial::* const MaterialGetFunc)() const > static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value, bool has_tolerance = false, DataType tolerance = DataType()) { @@ -437,10 +438,10 @@ public: // Mutators for selected TE material // - #define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ - static void MaterialMemberFunc(LLPanelFace* p, DataType data, int te = -1) \ - { \ - edit< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(p, data, te); \ + #define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ + static void MaterialMemberFunc(LLPanelFace* p, DataType data, int te = -1, const LLUUID &only_for_object_id = LLUUID()) \ + { \ + edit< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(p, data, te, only_for_object_id); \ } // Accessors for selected TE state proper (legacy settings etc) -- cgit v1.2.3