diff options
author | Graham Madarasz (Graham) <graham@lindenlab.com> | 2013-04-09 09:24:58 -0700 |
---|---|---|
committer | Graham Madarasz (Graham) <graham@lindenlab.com> | 2013-04-09 09:24:58 -0700 |
commit | f7b7f4a5fb35b1d04a975ddd91c62062dee075cc (patch) | |
tree | 24580419b0e65280127bbbac1c7388e7e22f44a8 /indra | |
parent | ffc4981bb91d2b15fe577cf847187b96f253a0bb (diff) |
NORSPEC-87 NORSPEC-88 fix interaction between norm/spec scale (aka repeats) and repeats per meter control
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelface.cpp | 85 |
1 files changed, 77 insertions, 8 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index b20360ff4b..7a9087333c 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1455,7 +1455,10 @@ void LLPanelFace::getState() // Repeats per meter { - F32 repeats = 1.f; + F32 repeats_diff = 1.f; + F32 repeats_norm = 1.f; + F32 repeats_spec = 1.f; + struct f13 : public LLSelectedTEGetFunctor<F32> { F32 get(LLViewerObject* object, S32 face) @@ -1470,26 +1473,92 @@ void LLPanelFace::getState() return llmax(repeats_s, repeats_t); } - } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, repeats ); + } func_diff; + bool identical_diff_repeats = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_diff, repeats_diff ); + + struct f14 : public LLSelectedTEGetFunctor<F32> + { + F32 get(LLViewerObject* object, S32 face) + { + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + U32 s_axis = VX; + U32 t_axis = VY; + F32 repeats_s = 1.0f; + F32 repeats_t = 1.0f; + if (mat) + { + mat->getNormalRepeat(repeats_s, repeats_t); + repeats_s /= object->getScale().mV[s_axis]; + repeats_t /= object->getScale().mV[t_axis]; + } + return llmax(repeats_s, repeats_t); + } + + } func_norm; + BOOL identical_norm_repeats = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_norm, repeats_norm ); + + struct f15 : public LLSelectedTEGetFunctor<F32> + { + F32 get(LLViewerObject* object, S32 face) + { + LLMaterial* mat = object->getTE(face)->getMaterialParams().get(); + U32 s_axis = VX; + U32 t_axis = VY; + F32 repeats_s = 1.0f; + F32 repeats_t = 1.0f; + if (mat) + { + mat->getSpecularRepeat(repeats_s, repeats_t); + repeats_s /= object->getScale().mV[s_axis]; + repeats_t /= object->getScale().mV[t_axis]; + } + return llmax(repeats_s, repeats_t); + } + + } func_spec; + BOOL identical_spec_repeats = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_spec, repeats_spec ); - getChild<LLUICtrl>("rptctrl")->setValue(editable ? repeats : 0); - getChild<LLUICtrl>("rptctrl")->setTentative(!identical); LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen"); if (mComboTexGen) { S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; BOOL enabled = editable && (index != 1); + BOOL identical = true; + F32 repeats = 1.0f; + U32 material_type = combobox_mattype->getCurrentIndex(); switch (material_type) { default: - case MATTYPE_DIFFUSE: enabled = (editable && !id.isNull()); break; - case MATTYPE_SPECULAR: enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); break; - case MATTYPE_NORMAL: enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); break; + case MATTYPE_DIFFUSE: + { + enabled = editable && !id.isNull(); + identical = identical_diff_repeats; + repeats = repeats_diff; + } + break; + + case MATTYPE_SPECULAR: + { + enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); + identical = identical_spec_repeats; + repeats = repeats_spec; + } + break; + + case MATTYPE_NORMAL: + { + enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); + identical = identical_norm_repeats; + repeats = repeats_norm; + } + break; } + getChildView("rptctrl")->setEnabled(enabled); + getChild<LLUICtrl>("rptctrl")->setValue(editable ? repeats : 1.0f); + getChild<LLUICtrl>("rptctrl")->setTentative(!identical); } } |