summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-07-30 22:38:30 +0100
committerGraham Linden <graham@lindenlab.com>2018-07-30 22:38:30 +0100
commit60d256e80f019e77afef941bc02eb65be6f9bc6d (patch)
tree76875bc02bdd45fdfabf423057d8dec67783b83c
parentba31900ea80dd0bdb29fa8f4100f992489b25a1e (diff)
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.
-rw-r--r--indra/llprimitive/llmaterial.cpp16
-rw-r--r--indra/newview/llpanelface.cpp18
-rw-r--r--indra/newview/llpanelface.h52
-rw-r--r--indra/newview/llselectmgr.cpp30
-rw-r--r--indra/newview/llselectmgr.h2
5 files changed, 61 insertions, 57 deletions
diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp
index 3f84bbf517..a219ac1450 100644
--- a/indra/llprimitive/llmaterial.cpp
+++ b/indra/llprimitive/llmaterial.cpp
@@ -374,28 +374,28 @@ void LLMaterial::fromLLSD(const LLSD& material_data)
S32 normalOffsetXInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_OFFSET_X_FIELD, LLSD::TypeInteger);
S32 normalOffsetYInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD, LLSD::TypeInteger);
S32 normalRotInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_ROTATION_FIELD, LLSD::TypeInteger);
+ S32 normalRepeatXInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD, LLSD::TypeInteger);
+ S32 normalRepeatYInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD, LLSD::TypeInteger);
mNormalOffsetX = F32(normalOffsetXInt) / MATERIALS_MULTIPLIER;
mNormalOffsetY = F32(normalOffsetYInt) / MATERIALS_MULTIPLIER;
mNormalRotation = F32(normalRotInt) / MATERIALS_MULTIPLIER;
-
- mNormalOffsetY = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
- mNormalRepeatX = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
- mNormalRepeatY = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
+ mNormalRepeatX = F32(normalRepeatXInt) / MATERIALS_MULTIPLIER;
+ mNormalRepeatY = F32(normalRepeatYInt) / MATERIALS_MULTIPLIER;
mSpecularID = getMaterialField<LLSD::UUID>(material_data, MATERIALS_CAP_SPECULAR_MAP_FIELD, LLSD::TypeUUID);
S32 specularOffsetXInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_OFFSET_X_FIELD, LLSD::TypeInteger);
S32 specularOffsetYInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD, LLSD::TypeInteger);
S32 specularRotInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD, LLSD::TypeInteger);
+ S32 specularRepeatXInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD, LLSD::TypeInteger);
+ S32 specularRepeatYInt = getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD, LLSD::TypeInteger);
mSpecularOffsetX = F32(specularOffsetXInt) / MATERIALS_MULTIPLIER;
mSpecularOffsetY = F32(specularOffsetYInt) / MATERIALS_MULTIPLIER;
mSpecularRotation = F32(specularRotInt) / MATERIALS_MULTIPLIER;
-
- mSpecularRepeatX = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
- mSpecularRepeatY = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
- mSpecularRotation = ((F32)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD, LLSD::TypeInteger)) / MATERIALS_MULTIPLIER;
+ mSpecularRepeatX = F32(specularRepeatXInt) / MATERIALS_MULTIPLIER;
+ mSpecularRepeatY = F32(specularRepeatYInt) / MATERIALS_MULTIPLIER;
mSpecularLightColor.setValue(getMaterialField<LLSD>(material_data, MATERIALS_CAP_SPECULAR_COLOR_FIELD, LLSD::TypeArray));
mSpecularLightExponent = (U8)getMaterialField<LLSD::Integer>(material_data, MATERIALS_CAP_SPECULAR_EXP_FIELD, LLSD::TypeInteger);
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();
}
diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h
index 7820af8bcd..c6f4c2f826 100644
--- a/indra/newview/llpanelface.h
+++ b/indra/newview/llpanelface.h
@@ -179,7 +179,7 @@ protected:
static void syncRepeatY(LLPanelFace* self, F32 scaleV);
static void syncOffsetX(LLPanelFace* self, F32 offsetU);
static void syncOffsetY(LLPanelFace* self, F32 offsetV);
- static void syncMaterialRot(LLPanelFace* self, F32 rot);
+ static void syncMaterialRot(LLPanelFace* self, F32 rot, int te = -1);
static void onCommitMaterialShinyScaleX( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialShinyScaleY( LLUICtrl* ctrl, void* userdata);
@@ -252,7 +252,7 @@ private:
typename DataType,
typename SetValueType,
void (LLMaterial::*MaterialEditFunc)(SetValueType data) >
- static void edit(LLPanelFace* p, DataType data)
+ static void edit(LLPanelFace* p, DataType data, int te = -1)
{
LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc > edit(data);
struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor
@@ -327,7 +327,7 @@ private:
LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* _edit;
LLPanelFace* _panel;
} editor(p, &edit);
- LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor);
+ LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor, te);
}
template<
@@ -427,29 +427,29 @@ public:
DEF_EDIT_MAT_STATE
#endif
- // Accessors for selected TE material state
- //
- #define DEF_GET_MAT_STATE(DataType,ReturnType,MaterialMemberFunc,DefaultValue) \
- static void MaterialMemberFunc(DataType& data, bool& identical) \
- { \
- getTEMaterialValue< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(data, identical,DefaultValue); \
- }
-
- // Mutators for selected TE material
- //
- #define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \
- static void MaterialMemberFunc(LLPanelFace* p,DataType data) \
- { \
- edit< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(p,data); \
- }
-
- // Accessors for selected TE state proper (legacy settings etc)
- //
- #define DEF_GET_TE_STATE(DataType,ReturnType,TexEntryMemberFunc,DefaultValue) \
- static void TexEntryMemberFunc(DataType& data, bool& identical) \
- { \
- getTEValue< DataType, ReturnType, &LLTextureEntry::TexEntryMemberFunc >(data, identical,DefaultValue); \
- }
+ // Accessors for selected TE material state
+ //
+ #define DEF_GET_MAT_STATE(DataType,ReturnType,MaterialMemberFunc,DefaultValue) \
+ static void MaterialMemberFunc(DataType& data, bool& identical) \
+ { \
+ getTEMaterialValue< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(data, identical,DefaultValue); \
+ }
+
+ // 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); \
+ }
+
+ // Accessors for selected TE state proper (legacy settings etc)
+ //
+ #define DEF_GET_TE_STATE(DataType,ReturnType,TexEntryMemberFunc,DefaultValue) \
+ static void TexEntryMemberFunc(DataType& data, bool& identical) \
+ { \
+ getTEValue< DataType, ReturnType, &LLTextureEntry::TexEntryMemberFunc >(data, identical,DefaultValue); \
+ }
class LLSelectedTEMaterial
{
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index ddae109030..53f09ab62d 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2080,29 +2080,33 @@ void LLSelectMgr::selectionSetGlow(F32 glow)
mSelectedObjects->applyToObjects( &func2 );
}
-void LLSelectMgr::selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func)
+void LLSelectMgr::selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func, int te)
{
struct f1 : public LLSelectedTEFunctor
{
LLMaterialPtr mMaterial;
- f1(LLSelectedTEMaterialFunctor* material_func) : _material_func(material_func) {}
+ f1(LLSelectedTEMaterialFunctor* material_func, int te) : _material_func(material_func), _specific_te(te) {}
- bool apply(LLViewerObject* object, S32 face)
+ bool apply(LLViewerObject* object, S32 te)
{
- if (object && object->permModify() && _material_func)
- {
- LLTextureEntry* tep = object->getTE(face);
- if (tep)
- {
- LLMaterialPtr current_material = tep->getMaterialParams();
- _material_func->apply(object, face, tep, current_material);
- }
- }
+ if (_specific_te == -1 || (te == _specific_te))
+ {
+ if (object && object->permModify() && _material_func)
+ {
+ LLTextureEntry* tep = object->getTE(te);
+ if (tep)
+ {
+ LLMaterialPtr current_material = tep->getMaterialParams();
+ _material_func->apply(object, te, tep, current_material);
+ }
+ }
+ }
return true;
}
LLSelectedTEMaterialFunctor* _material_func;
- } func1(material_func);
+ int _specific_te;
+ } func1(material_func, te);
mSelectedObjects->applyToTEs( &func1 );
struct f2 : public LLSelectedObjectFunctor
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index e965dd80d5..25ee8619d7 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -591,7 +591,7 @@ public:
void selectionSetClickAction(U8 action);
void selectionSetIncludeInSearch(bool include_in_search);
void selectionSetGlow(const F32 glow);
- void selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func);
+ void selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func, int specific_te = -1);
void selectionRemoveMaterial();
void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE);