Skip to content
Snippets Groups Projects
Commit 986567a6 authored by ruslantproductengine's avatar ruslantproductengine
Browse files

SL-5570 - Align planar faces" does not work on normal or specular maps

parent 4c0f6f58
No related branches found
No related tags found
No related merge requests found
...@@ -444,14 +444,17 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor ...@@ -444,14 +444,17 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
LLSpinCtrl* ctrlTexOffsetS = mPanel->getChild<LLSpinCtrl>("TexOffsetU"); LLSpinCtrl* ctrlTexOffsetS = mPanel->getChild<LLSpinCtrl>("TexOffsetU");
LLSpinCtrl* ctrlTexOffsetT = mPanel->getChild<LLSpinCtrl>("TexOffsetV"); LLSpinCtrl* ctrlTexOffsetT = mPanel->getChild<LLSpinCtrl>("TexOffsetV");
LLSpinCtrl* ctrlTexRotation = mPanel->getChild<LLSpinCtrl>("TexRot"); 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(comboTexGen);
llassert(object); llassert(object);
if (ctrlTexScaleS) if (ctrlTexScaleS)
{ {
valid = !ctrlTexScaleS->getTentative(); // || !checkFlipScaleS->getTentative(); valid = !ctrlTexScaleS->getTentative(); // || !checkFlipScaleS->getTentative();
if (valid) if (valid || align_planar)
{ {
value = ctrlTexScaleS->get(); value = ctrlTexScaleS->get();
if (comboTexGen && if (comboTexGen &&
...@@ -460,13 +463,19 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor ...@@ -460,13 +463,19 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
value *= 0.5f; value *= 0.5f;
} }
object->setTEScaleS( te, value ); object->setTEScaleS( te, value );
if (align_planar)
{
LLPanelFace::LLSelectedTEMaterial::setNormalRepeatX(mPanel, value, te);
LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatX(mPanel, value, te);
}
} }
} }
if (ctrlTexScaleT) if (ctrlTexScaleT)
{ {
valid = !ctrlTexScaleT->getTentative(); // || !checkFlipScaleT->getTentative(); valid = !ctrlTexScaleT->getTentative(); // || !checkFlipScaleT->getTentative();
if (valid) if (valid || align_planar)
{ {
value = ctrlTexScaleT->get(); value = ctrlTexScaleT->get();
//if( checkFlipScaleT->get() ) //if( checkFlipScaleT->get() )
...@@ -479,36 +488,60 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor ...@@ -479,36 +488,60 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
value *= 0.5f; value *= 0.5f;
} }
object->setTEScaleT( te, value ); object->setTEScaleT( te, value );
if (align_planar)
{
LLPanelFace::LLSelectedTEMaterial::setNormalRepeatY(mPanel, value, te);
LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatY(mPanel, value, te);
}
} }
} }
if (ctrlTexOffsetS) if (ctrlTexOffsetS)
{ {
valid = !ctrlTexOffsetS->getTentative(); valid = !ctrlTexOffsetS->getTentative();
if (valid) if (valid || align_planar)
{ {
value = ctrlTexOffsetS->get(); value = ctrlTexOffsetS->get();
object->setTEOffsetS( te, value ); object->setTEOffsetS( te, value );
if (align_planar)
{
LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, value, te);
LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, value, te);
}
} }
} }
if (ctrlTexOffsetT) if (ctrlTexOffsetT)
{ {
valid = !ctrlTexOffsetT->getTentative(); valid = !ctrlTexOffsetT->getTentative();
if (valid) if (valid || align_planar)
{ {
value = ctrlTexOffsetT->get(); value = ctrlTexOffsetT->get();
object->setTEOffsetT( te, value ); object->setTEOffsetT( te, value );
if (align_planar)
{
LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, value, te);
LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, value, te);
}
} }
} }
if (ctrlTexRotation) if (ctrlTexRotation)
{ {
valid = !ctrlTexRotation->getTentative(); valid = !ctrlTexRotation->getTentative();
if (valid) if (valid || align_planar)
{ {
value = ctrlTexRotation->get() * DEG_TO_RAD; value = ctrlTexRotation->get() * DEG_TO_RAD;
object->setTERotation( te, value ); object->setTERotation( te, value );
if (align_planar)
{
LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, value, te);
LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, value, te);
}
} }
} }
return true; return true;
...@@ -550,14 +583,21 @@ struct LLPanelFaceSetAlignedTEFunctor : public LLSelectedTEFunctor ...@@ -550,14 +583,21 @@ struct LLPanelFaceSetAlignedTEFunctor : public LLSelectedTEFunctor
if (set_aligned) if (set_aligned)
{ {
object->setTEOffset(te, uv_offset.mV[VX], uv_offset.mV[VY]); 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); 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::setNormalRotation(mPanel, uv_rot, te, object->getID());
LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, uv_offset.mV[VX], te); LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, uv_rot, te, object->getID());
LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, uv_offset.mV[VY], te);
LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, uv_rot, te); LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, uv_offset.mV[VX], te, object->getID());
LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, uv_rot, te); 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) if (!set_aligned)
......
...@@ -252,16 +252,16 @@ class LLPanelFace : public LLPanel ...@@ -252,16 +252,16 @@ class LLPanelFace : public LLPanel
typename DataType, typename DataType,
typename SetValueType, typename SetValueType,
void (LLMaterial::*MaterialEditFunc)(SetValueType data) > 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); LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc > edit(data);
struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor 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 ~LLSelectedTEEditMaterial() {};
virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material) 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); LLMaterialPtr new_material = _panel->createDefaultMaterial(current_material);
llassert_always(new_material); llassert_always(new_material);
...@@ -325,14 +325,15 @@ class LLPanelFace : public LLPanel ...@@ -325,14 +325,15 @@ class LLPanelFace : public LLPanel
return NULL; return NULL;
} }
LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* _edit; LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* _edit;
LLPanelFace* _panel; LLPanelFace *_panel;
} editor(p, &edit); const LLUUID & _only_for_object_id;
LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor, te); } editor(p, &edit, only_for_object_id);
LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor, te);
} }
template< template<
typename DataType, typename DataType,
typename ReturnType, typename ReturnType,
ReturnType (LLMaterial::* const MaterialGetFunc)() const > ReturnType (LLMaterial::* const MaterialGetFunc)() const >
static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value, bool has_tolerance = false, DataType tolerance = DataType()) static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value, bool has_tolerance = false, DataType tolerance = DataType())
{ {
...@@ -437,10 +438,10 @@ class LLPanelFace : public LLPanel ...@@ -437,10 +438,10 @@ class LLPanelFace : public LLPanel
// Mutators for selected TE material // Mutators for selected TE material
// //
#define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ #define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \
static void MaterialMemberFunc(LLPanelFace* p, DataType data, int te = -1) \ 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); \ edit< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(p, data, te, only_for_object_id); \
} }
// Accessors for selected TE state proper (legacy settings etc) // Accessors for selected TE state proper (legacy settings etc)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment