summaryrefslogtreecommitdiff
path: root/indra/newview/llscrollingpanelparam.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-04-20 14:08:23 +0800
committerErik Kundiman <erik@megapahit.org>2024-04-20 14:08:23 +0800
commit23a35d763bca645ce628d80ebd939c979590724c (patch)
tree434e8413c209d8a29fe93ed17ea2717817660a7e /indra/newview/llscrollingpanelparam.cpp
parent1a4517e5af8f43433fc2547658615dce4073d9a3 (diff)
parent78174fc8658caeddfd8306ec19eb0e1c2975368e (diff)
Merge tag '7.1.5-release'
source for viewer 7.1.5.8443591509
Diffstat (limited to 'indra/newview/llscrollingpanelparam.cpp')
-rw-r--r--indra/newview/llscrollingpanelparam.cpp63
1 files changed, 19 insertions, 44 deletions
diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp
index bfa453a0ae..efd84eaa6d 100644
--- a/indra/newview/llscrollingpanelparam.cpp
+++ b/indra/newview/llscrollingpanelparam.cpp
@@ -259,19 +259,15 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint )
// Make sure we're not taking the slider out of bounds
// (this is where some simple UI limits are stored)
- F32 new_percent = weightToPercent(new_weight);
- LLSliderCtrl* slider = getChild<LLSliderCtrl>("param slider");
- if (slider)
+ F32 new_percent = weightToSlider(new_weight);
+ if (mSlider->getMinValue() < new_percent
+ && new_percent < mSlider->getMaxValue())
{
- if (slider->getMinValue() < new_percent
- && new_percent < slider->getMaxValue())
- {
- mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight);
- mWearable->writeToAvatar(gAgentAvatarp);
- gAgentAvatarp->updateVisualParams();
+ mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight);
+ mWearable->writeToAvatar(gAgentAvatarp);
+ gAgentAvatarp->updateVisualParams();
- slider->setValue( weightToPercent( new_weight ) );
- }
+ mSlider->setValue( weightToSlider( new_weight ) );
}
}
}
@@ -292,17 +288,13 @@ void LLScrollingPanelParam::onHintMinMouseUp( void* userdata )
F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight();
// step a fraction in the negative directiona
F32 new_weight = current_weight - (range / 10.f);
- F32 new_percent = self->weightToPercent(new_weight);
- LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
- if (slider)
+ F32 new_percent = self->weightToSlider(new_weight);
+ if (self->mSlider->getMinValue() < new_percent
+ && new_percent < self->mSlider->getMaxValue())
{
- if (slider->getMinValue() < new_percent
- && new_percent < slider->getMaxValue())
- {
- self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
- self->mWearable->writeToAvatar(gAgentAvatarp);
- slider->setValue( self->weightToPercent( new_weight ) );
- }
+ self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
+ self->mWearable->writeToAvatar(gAgentAvatarp);
+ self->mSlider->setValue( self->weightToSlider( new_weight ) );
}
}
@@ -326,33 +318,16 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata )
F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight();
// step a fraction in the negative direction
F32 new_weight = current_weight + (range / 10.f);
- F32 new_percent = self->weightToPercent(new_weight);
- LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
- if (slider)
+ F32 new_percent = self->weightToSlider(new_weight);
+ if (self->mSlider->getMinValue() < new_percent
+ && new_percent < self->mSlider->getMaxValue())
{
- if (slider->getMinValue() < new_percent
- && new_percent < slider->getMaxValue())
- {
- self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
- self->mWearable->writeToAvatar(gAgentAvatarp);
- slider->setValue( self->weightToPercent( new_weight ) );
- }
+ self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
+ self->mWearable->writeToAvatar(gAgentAvatarp);
+ self->mSlider->setValue( self->weightToSlider( new_weight ) );
}
}
}
LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax );
}
-
-
-F32 LLScrollingPanelParam::weightToPercent( F32 weight )
-{
- LLViewerVisualParam* param = mParam;
- return (weight - param->getMinWeight()) / (param->getMaxWeight() - param->getMinWeight()) * 100.f;
-}
-
-F32 LLScrollingPanelParam::percentToWeight( F32 percent )
-{
- LLViewerVisualParam* param = mParam;
- return percent / 100.f * (param->getMaxWeight() - param->getMinWeight()) + param->getMinWeight();
-}