summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorruslantproductengine <ruslantproductengine@lindenlab.com>2019-02-04 18:14:03 +0200
committerruslantproductengine <ruslantproductengine@lindenlab.com>2019-02-04 18:14:03 +0200
commit986567a6542603887c66daea7459b18f42267544 (patch)
treeac5c0937d69407b187c4a58da050ee40db61cb47 /indra/newview
parent4c0f6f5825bdd833d0bad05bf431c29acba45ae0 (diff)
SL-5570 - Align planar faces" does not work on normal or specular maps
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelface.cpp66
-rw-r--r--indra/newview/llpanelface.h23
2 files changed, 65 insertions, 24 deletions
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<LLSpinCtrl>("TexOffsetU");
LLSpinCtrl* ctrlTexOffsetT = mPanel->getChild<LLSpinCtrl>("TexOffsetV");
LLSpinCtrl* ctrlTexRotation = mPanel->getChild<LLSpinCtrl>("TexRot");
- LLComboBox* comboTexGen = mPanel->getChild<LLComboBox>("combobox texgen");
+ LLComboBox* comboTexGen = mPanel->getChild<LLComboBox>("combobox texgen");
+ LLCheckBoxCtrl* cb_planar_align = mPanel->getChild<LLCheckBoxCtrl>("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)