summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelface.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelface.h')
-rw-r--r--indra/newview/llpanelface.h116
1 files changed, 59 insertions, 57 deletions
diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h
index 7c084cb0ab..0b40d7d41a 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,16 +252,16 @@ 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, 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,16 +325,17 @@ private:
return NULL;
}
LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* _edit;
- LLPanelFace* _panel;
- } editor(p, &edit);
- LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor);
+ 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,
ReturnType (LLMaterial::* const MaterialGetFunc)() const >
- static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value)
+ static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value, bool has_tolerance = false, DataType tolerance = DataType())
{
DataType data_value;
struct GetTEMaterialVal : public LLSelectedTEGetFunctor<DataType>
@@ -359,7 +360,7 @@ private:
}
DataType _default;
} GetFunc(default_value);
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_value);
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_value, has_tolerance, tolerance);
data_to_return = data_value;
}
@@ -367,7 +368,7 @@ private:
typename DataType,
typename ReturnType, // some kids just have to different...
ReturnType (LLTextureEntry::* const TEGetFunc)() const >
- static void getTEValue(DataType& data_to_return, bool& identical, DataType default_value)
+ static void getTEValue(DataType& data_to_return, bool& identical, DataType default_value, bool has_tolerance = false, DataType tolerance = DataType())
{
DataType data_value;
struct GetTEVal : public LLSelectedTEGetFunctor<DataType>
@@ -381,7 +382,7 @@ private:
}
DataType _default;
} GetTEValFunc(default_value);
- identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetTEValFunc, data_value );
+ identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetTEValFunc, data_value, has_tolerance, tolerance );
data_to_return = data_value;
}
@@ -414,6 +415,7 @@ private:
bool mUpdateInFlight;
bool mUpdatePending;
+public:
#if defined(DEF_GET_MAT_STATE)
#undef DEF_GET_MAT_STATE
#endif
@@ -426,29 +428,29 @@ private:
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,HasTolerance,Tolerance) \
+ static void MaterialMemberFunc(DataType& data, bool& identical, bool has_tolerance = HasTolerance, DataType tolerance = Tolerance) \
+ { \
+ getTEMaterialValue< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(data, identical, DefaultValue, has_tolerance, tolerance); \
+ }
+
+ // Mutators for selected TE material
+ //
+ #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)
+ //
+ #define DEF_GET_TE_STATE(DataType,ReturnType,TexEntryMemberFunc,DefaultValue,HasTolerance,Tolerance) \
+ static void TexEntryMemberFunc(DataType& data, bool& identical, bool has_tolerance = HasTolerance, DataType tolerance = Tolerance) \
+ { \
+ getTEValue< DataType, ReturnType, &LLTextureEntry::TexEntryMemberFunc >(data, identical, DefaultValue, has_tolerance, tolerance); \
+ }
class LLSelectedTEMaterial
{
@@ -458,19 +460,19 @@ private:
static void getMaxNormalRepeats(F32& repeats, bool& identical);
static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha);
- DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID,LLUUID::null)
- DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID,LLUUID::null)
- DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX,1.0f)
- DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY,1.0f)
- DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX,0.0f)
- DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetY,0.0f)
- DEF_GET_MAT_STATE(F32,F32,getSpecularRotation,0.0f)
+ DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID,LLUUID::null, false, LLUUID::null)
+ DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID,LLUUID::null, false, LLUUID::null)
+ DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX,1.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY,1.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX,0.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetY,0.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getSpecularRotation,0.0f, true, 0.001f)
- DEF_GET_MAT_STATE(F32,F32,getNormalRepeatX,1.0f)
- DEF_GET_MAT_STATE(F32,F32,getNormalRepeatY,1.0f)
- DEF_GET_MAT_STATE(F32,F32,getNormalOffsetX,0.0f)
- DEF_GET_MAT_STATE(F32,F32,getNormalOffsetY,0.0f)
- DEF_GET_MAT_STATE(F32,F32,getNormalRotation,0.0f)
+ DEF_GET_MAT_STATE(F32,F32,getNormalRepeatX,1.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getNormalRepeatY,1.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getNormalOffsetX,0.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getNormalOffsetY,0.0f, true, 0.001f)
+ DEF_GET_MAT_STATE(F32,F32,getNormalRotation,0.0f, true, 0.001f)
DEF_EDIT_MAT_STATE(U8,U8,setDiffuseAlphaMode);
DEF_EDIT_MAT_STATE(U8,U8,setAlphaMaskCutoff);
@@ -506,17 +508,17 @@ private:
static void getObjectScaleT(F32& scale_t, bool& identical);
static void getMaxDiffuseRepeats(F32& repeats, bool& identical);
- DEF_GET_TE_STATE(U8,U8,getBumpmap,0)
- DEF_GET_TE_STATE(U8,U8,getShiny,0)
- DEF_GET_TE_STATE(U8,U8,getFullbright,0)
- DEF_GET_TE_STATE(F32,F32,getRotation,0.0f)
- DEF_GET_TE_STATE(F32,F32,getOffsetS,0.0f)
- DEF_GET_TE_STATE(F32,F32,getOffsetT,0.0f)
- DEF_GET_TE_STATE(F32,F32,getScaleS,1.0f)
- DEF_GET_TE_STATE(F32,F32,getScaleT,1.0f)
- DEF_GET_TE_STATE(F32,F32,getGlow,0.0f)
- DEF_GET_TE_STATE(LLTextureEntry::e_texgen,LLTextureEntry::e_texgen,getTexGen,LLTextureEntry::TEX_GEN_DEFAULT)
- DEF_GET_TE_STATE(LLColor4,const LLColor4&,getColor,LLColor4::white)
+ DEF_GET_TE_STATE(U8,U8,getBumpmap,0, false, 0)
+ DEF_GET_TE_STATE(U8,U8,getShiny,0, false, 0)
+ DEF_GET_TE_STATE(U8,U8,getFullbright,0, false, 0)
+ DEF_GET_TE_STATE(F32,F32,getRotation,0.0f, true, 0.001f)
+ DEF_GET_TE_STATE(F32,F32,getOffsetS,0.0f, true, 0.001f)
+ DEF_GET_TE_STATE(F32,F32,getOffsetT,0.0f, true, 0.001f)
+ DEF_GET_TE_STATE(F32,F32,getScaleS,1.0f, true, 0.001f)
+ DEF_GET_TE_STATE(F32,F32,getScaleT,1.0f, true, 0.001f)
+ DEF_GET_TE_STATE(F32,F32,getGlow,0.0f, true, 0.001f)
+ DEF_GET_TE_STATE(LLTextureEntry::e_texgen,LLTextureEntry::e_texgen,getTexGen,LLTextureEntry::TEX_GEN_DEFAULT, false, LLTextureEntry::TEX_GEN_DEFAULT)
+ DEF_GET_TE_STATE(LLColor4,const LLColor4&,getColor,LLColor4::white, false, LLColor4::black);
};
};