@@ -3750,18 +3750,8 @@ void LLPanelFace::onCommitRepeatsPerMeter()
3750
3750
if (gSavedSettings .getBOOL (" SyncMaterialSettings" ))
3751
3751
{
3752
3752
LLSelectMgr::getInstance ()->selectionTexScaleAutofit (repeats_per_meter);
3753
-
3754
- mBumpyScaleU ->setValue (obj_scale_s * repeats_per_meter);
3755
- mBumpyScaleV ->setValue (obj_scale_t * repeats_per_meter);
3756
-
3757
- LLSelectedTEMaterial::setNormalRepeatX (this , obj_scale_s * repeats_per_meter);
3758
- LLSelectedTEMaterial::setNormalRepeatY (this , obj_scale_t * repeats_per_meter);
3759
-
3760
- mShinyScaleU ->setValue (obj_scale_s * repeats_per_meter);
3761
- mShinyScaleV ->setValue (obj_scale_t * repeats_per_meter);
3762
-
3763
- LLSelectedTEMaterial::setSpecularRepeatX (this , obj_scale_s * repeats_per_meter);
3764
- LLSelectedTEMaterial::setSpecularRepeatY (this , obj_scale_t * repeats_per_meter);
3753
+ LLSelectedTEMaterial::selectionNormalScaleAutofit (this , repeats_per_meter);
3754
+ LLSelectedTEMaterial::selectionSpecularScaleAutofit (this , repeats_per_meter);
3765
3755
}
3766
3756
else
3767
3757
{
@@ -3772,18 +3762,10 @@ void LLPanelFace::onCommitRepeatsPerMeter()
3772
3762
LLSelectMgr::getInstance ()->selectionTexScaleAutofit (repeats_per_meter);
3773
3763
break ;
3774
3764
case MATTYPE_NORMAL:
3775
- mBumpyScaleU ->setValue (obj_scale_s * repeats_per_meter);
3776
- mBumpyScaleV ->setValue (obj_scale_t * repeats_per_meter);
3777
-
3778
- LLSelectedTEMaterial::setNormalRepeatX (this , obj_scale_s * repeats_per_meter);
3779
- LLSelectedTEMaterial::setNormalRepeatY (this , obj_scale_t * repeats_per_meter);
3765
+ LLSelectedTEMaterial::selectionNormalScaleAutofit (this , repeats_per_meter);
3780
3766
break ;
3781
3767
case MATTYPE_SPECULAR:
3782
- mBumpyScaleU ->setValue (obj_scale_s * repeats_per_meter);
3783
- mBumpyScaleV ->setValue (obj_scale_t * repeats_per_meter);
3784
-
3785
- LLSelectedTEMaterial::setSpecularRepeatX (this , obj_scale_s * repeats_per_meter);
3786
- LLSelectedTEMaterial::setSpecularRepeatY (this , obj_scale_t * repeats_per_meter);
3768
+ LLSelectedTEMaterial::selectionSpecularScaleAutofit (this , repeats_per_meter);
3787
3769
break ;
3788
3770
default :
3789
3771
llassert (false );
@@ -5366,6 +5348,62 @@ void LLPanelFace::LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(U8& diffuse_a
5366
5348
identical = LLSelectMgr::getInstance ()->getSelection ()->getSelectedTEValue ( &get_diff_mode, diffuse_alpha_mode);
5367
5349
}
5368
5350
5351
+ void LLPanelFace::LLSelectedTEMaterial::selectionNormalScaleAutofit (LLPanelFace* panel_face, F32 repeats_per_meter)
5352
+ {
5353
+ struct f : public LLSelectedTEFunctor
5354
+ {
5355
+ LLPanelFace* mFacePanel ;
5356
+ F32 mRepeatsPerMeter ;
5357
+ f (LLPanelFace* face_panel, const F32& repeats_per_meter) : mFacePanel (face_panel), mRepeatsPerMeter (repeats_per_meter) {}
5358
+ bool apply (LLViewerObject* object, S32 te)
5359
+ {
5360
+ if (object->permModify ())
5361
+ {
5362
+ // Compute S,T to axis mapping
5363
+ U32 s_axis, t_axis;
5364
+ if (!LLPrimitive::getTESTAxes (te, &s_axis, &t_axis))
5365
+ return true ;
5366
+
5367
+ F32 new_s = object->getScale ().mV [s_axis] * mRepeatsPerMeter ;
5368
+ F32 new_t = object->getScale ().mV [t_axis] * mRepeatsPerMeter ;
5369
+
5370
+ setNormalRepeatX (mFacePanel , new_s, te);
5371
+ setNormalRepeatY (mFacePanel , new_t , te);
5372
+ }
5373
+ return true ;
5374
+ }
5375
+ } setfunc (panel_face, repeats_per_meter);
5376
+ LLSelectMgr::getInstance ()->getSelection ()->applyToTEs (&setfunc);
5377
+ }
5378
+
5379
+ void LLPanelFace::LLSelectedTEMaterial::selectionSpecularScaleAutofit (LLPanelFace* panel_face, F32 repeats_per_meter)
5380
+ {
5381
+ struct f : public LLSelectedTEFunctor
5382
+ {
5383
+ LLPanelFace* mFacePanel ;
5384
+ F32 mRepeatsPerMeter ;
5385
+ f (LLPanelFace* face_panel, const F32& repeats_per_meter) : mFacePanel (face_panel), mRepeatsPerMeter (repeats_per_meter) {}
5386
+ bool apply (LLViewerObject* object, S32 te)
5387
+ {
5388
+ if (object->permModify ())
5389
+ {
5390
+ // Compute S,T to axis mapping
5391
+ U32 s_axis, t_axis;
5392
+ if (!LLPrimitive::getTESTAxes (te, &s_axis, &t_axis))
5393
+ return true ;
5394
+
5395
+ F32 new_s = object->getScale ().mV [s_axis] * mRepeatsPerMeter ;
5396
+ F32 new_t = object->getScale ().mV [t_axis] * mRepeatsPerMeter ;
5397
+
5398
+ setSpecularRepeatX (mFacePanel , new_s, te);
5399
+ setSpecularRepeatY (mFacePanel , new_t , te);
5400
+ }
5401
+ return true ;
5402
+ }
5403
+ } setfunc (panel_face, repeats_per_meter);
5404
+ LLSelectMgr::getInstance ()->getSelection ()->applyToTEs (&setfunc);
5405
+ }
5406
+
5369
5407
void LLPanelFace::LLSelectedTE::getObjectScaleS (F32& scale_s, bool & identical)
5370
5408
{
5371
5409
struct LLSelectedTEGetObjectScaleS : public LLSelectedTEGetFunctor <F32>
0 commit comments