From c530b3d1519e0755bf8ba8a548815856291d905c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 2 Jul 2018 21:12:03 +0100 Subject: MAINT-3219 make align planar faces set normal and specular offsets and rotations in addition to the diffuse values --- indra/newview/llpanelface.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 01ce4470f0..1bd8692a0e 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -550,8 +550,14 @@ 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]); + LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, uv_offset.mV[VY]); + LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, uv_offset.mV[VX]); + LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, uv_offset.mV[VY]); + LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, uv_rot); + LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, uv_rot); } } if (!set_aligned) -- cgit v1.2.3 From 60d256e80f019e77afef941bc02eb65be6f9bc6d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 30 Jul 2018 22:38:30 +0100 Subject: MAINT-8915 Fix sync of material rotation and offset values when using aligned planar faces. Make it possible to set a specific TE's normal/spec offset/rotation values. Eliminate redundant conversions in LLSD -> struct handler. --- 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 1bd8692a0e..d2d75784e8 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -552,12 +552,12 @@ struct LLPanelFaceSetAlignedTEFunctor : public LLSelectedTEFunctor object->setTEOffset(te, uv_offset.mV[VX], uv_offset.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]); - LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, uv_offset.mV[VY]); - LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, uv_offset.mV[VX]); - LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, uv_offset.mV[VY]); - LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, uv_rot); - LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, 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); } } if (!set_aligned) @@ -2057,10 +2057,10 @@ void LLPanelFace::onCommitMaterialShinyScaleY(LLUICtrl* ctrl, void* userdata) } //static -void LLPanelFace::syncMaterialRot(LLPanelFace* self, F32 rot) +void LLPanelFace::syncMaterialRot(LLPanelFace* self, F32 rot, int te) { - LLSelectedTEMaterial::setNormalRotation(self,rot * DEG_TO_RAD); - LLSelectedTEMaterial::setSpecularRotation(self,rot * DEG_TO_RAD); + LLSelectedTEMaterial::setNormalRotation(self,rot * DEG_TO_RAD, te); + LLSelectedTEMaterial::setSpecularRotation(self,rot * DEG_TO_RAD, te); self->sendTextureInfo(); } -- cgit v1.2.3 From d748dbce457dabf6bc46eb22c5c5315f50af159c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 31 Jul 2018 17:35:42 +0100 Subject: MAINT-8909 Loosen precision when checking rotation and other false negatives when comparing faces to see if they can be considered planar aligned. This was causing fields to be marked tentative (grayed display) incorrectly. --- indra/newview/llpanelface.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'indra/newview/llpanelface.cpp') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index d2d75784e8..b71e98b102 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -605,12 +605,19 @@ struct LLPanelFaceGetIsAlignedTEFunctor : public LLSelectedTEFunctor tep->getOffset(&st_offset.mV[VX], &st_offset.mV[VY]); tep->getScale(&st_scale.mV[VX], &st_scale.mV[VY]); F32 st_rot = tep->getRotation(); + + bool eq_offset_x = is_approx_equal_fraction(st_offset.mV[VX], aligned_st_offset.mV[VX], 12); + bool eq_offset_y = is_approx_equal_fraction(st_offset.mV[VY], aligned_st_offset.mV[VY], 12); + bool eq_scale_x = is_approx_equal_fraction(st_scale.mV[VX], aligned_st_scale.mV[VX], 12); + bool eq_scale_y = is_approx_equal_fraction(st_scale.mV[VY], aligned_st_scale.mV[VY], 12); + bool eq_rot = is_approx_equal_fraction(st_rot, aligned_st_rot, 6); + // needs a fuzzy comparison, because of fp errors - if (is_approx_equal_fraction(st_offset.mV[VX], aligned_st_offset.mV[VX], 12) && - is_approx_equal_fraction(st_offset.mV[VY], aligned_st_offset.mV[VY], 12) && - is_approx_equal_fraction(st_scale.mV[VX], aligned_st_scale.mV[VX], 12) && - is_approx_equal_fraction(st_scale.mV[VY], aligned_st_scale.mV[VY], 12) && - is_approx_equal_fraction(st_rot, aligned_st_rot, 14)) + if (eq_offset_x && + eq_offset_y && + eq_scale_x && + eq_scale_y && + eq_rot) { return true; } @@ -973,9 +980,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 spec_scale_s = 1.f; F32 norm_scale_s = 1.f; - LLSelectedTE::getScaleS( diff_scale_s, identical_diff_scale_s); - LLSelectedTEMaterial::getSpecularRepeatX( spec_scale_s, identical_spec_scale_s); - LLSelectedTEMaterial::getNormalRepeatX( norm_scale_s, identical_norm_scale_s); + LLSelectedTE::getScaleS(diff_scale_s, identical_diff_scale_s); + LLSelectedTEMaterial::getSpecularRepeatX(spec_scale_s, identical_spec_scale_s); + LLSelectedTEMaterial::getNormalRepeatX(norm_scale_s, identical_norm_scale_s); diff_scale_s = editable ? diff_scale_s : 1.0f; diff_scale_s *= identical_planar_texgen ? 2.0f : 1.0f; @@ -2438,7 +2445,7 @@ void LLPanelFace::LLSelectedTE::getFace(LLFace*& face_to_return, bool& identical return (object->mDrawable) ? object->mDrawable->getFace(te): NULL; } } get_te_face_func; - identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, face_to_return); + identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, face_to_return, false, (LLFace*)nullptr); } void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, bool& identical_face) -- cgit v1.2.3 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 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 13 deletions(-) (limited to 'indra/newview/llpanelface.cpp') 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) -- cgit v1.2.3