From f3952f9a8dc368c991d9aaac174bfee5a0dd90e9 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 7 Aug 2013 13:35:08 -0700 Subject: NORSPEC-329 fix mangling of diffuse alpha mode by material edits when only one face really has alpha --- indra/newview/llpanelface.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 834ad9e14c..06a45644d0 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -255,7 +255,20 @@ private: // Determine correct alpha mode for current diffuse texture // (i.e. does it have an alpha channel that makes alpha mode useful) // - U8 default_alpha_mode = (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + // _panel->isAlpha() "lies" when one face has alpha and the rest do not (NORSPEC-329) + // need to get per-face answer to this question for sane alpha mode retention on updates. + // + U8 default_alpha_mode = object->isImageAlphaBlended(face) ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + + if (!current_material.isNull()) + { + default_alpha_mode = current_material->getDiffuseAlphaMode(); + } + + // Insure we don't inherit the default of blend by accident... + // this will be stomped by a legit request to change the alpha mode by the apply() below + // + new_material->setDiffuseAlphaMode(default_alpha_mode); // Do "It"! // -- cgit v1.2.3 From e156e3ff32469d5efdfd4fb96969b8cc4bc056b8 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 7 Aug 2013 15:37:53 -0700 Subject: NORSPEC-343 protect against edits that would set non-alpha faces to diffuse alpha mode blend --- indra/newview/llpanelface.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 06a45644d0..86642e5635 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -258,7 +258,8 @@ private: // _panel->isAlpha() "lies" when one face has alpha and the rest do not (NORSPEC-329) // need to get per-face answer to this question for sane alpha mode retention on updates. // - U8 default_alpha_mode = object->isImageAlphaBlended(face) ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + bool is_alpha_face = object->isImageAlphaBlended(face); + U8 default_alpha_mode = is_alpha_face ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; if (!current_material.isNull()) { @@ -278,6 +279,11 @@ private: LLUUID new_normal_map_id = new_material->getNormalID(); LLUUID new_spec_map_id = new_material->getSpecularID(); + if ((new_alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) && !is_alpha_face) + { + new_alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + } + bool is_default_blend_mode = (new_alpha_mode == default_alpha_mode); bool is_need_material = !is_default_blend_mode || !new_normal_map_id.isNull() || !new_spec_map_id.isNull(); -- cgit v1.2.3 From 9c1b45b16763d452a3c9175186217d005a9cfd2b Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 7 Aug 2013 17:23:23 -0700 Subject: NORSPEC-343 fix oversight and actually apply override to new material when no alpha is present --- indra/newview/llpanelface.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 86642e5635..562d293d56 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -282,6 +282,7 @@ private: if ((new_alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) && !is_alpha_face) { new_alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + new_material->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); } bool is_default_blend_mode = (new_alpha_mode == default_alpha_mode); -- cgit v1.2.3 From 61129c73c97accf297943d6bc5beea3c09579084 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 12 Aug 2013 10:12:09 -0700 Subject: NORSPEC-346 fix knock-on causing alpha mask edits to cause materials to get removed and revert to alpha blend --- indra/newview/llpanelface.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelface.h') diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 562d293d56..46b3375f64 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -259,8 +259,13 @@ private: // need to get per-face answer to this question for sane alpha mode retention on updates. // bool is_alpha_face = object->isImageAlphaBlended(face); - U8 default_alpha_mode = is_alpha_face ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + // need to keep this original answer for valid comparisons in logic below + // + U8 original_default_alpha_mode = is_alpha_face ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + + U8 default_alpha_mode = original_default_alpha_mode; + if (!current_material.isNull()) { default_alpha_mode = current_material->getDiffuseAlphaMode(); @@ -285,7 +290,7 @@ private: new_material->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); } - bool is_default_blend_mode = (new_alpha_mode == default_alpha_mode); + bool is_default_blend_mode = (new_alpha_mode == original_default_alpha_mode); bool is_need_material = !is_default_blend_mode || !new_normal_map_id.isNull() || !new_spec_map_id.isNull(); if (!is_need_material) -- cgit v1.2.3