diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-04-10 03:55:09 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-04-10 03:55:09 +0300 |
commit | 8fa956a16e616191e21bf001eabc4670453debcd (patch) | |
tree | aecadf995f0174cc41f7cb9846a1382a930d8f82 /indra/newview/llscrollingpanelparam.cpp | |
parent | 37392be4171303db08a4842b7882b4cb758a8f8d (diff) | |
parent | da9a1dcb55548a249ff7a1255f3e518696b81245 (diff) |
Merge branch 'main' into marchcat/b-merge
# Conflicts:
# indra/llrender/llgl.cpp
# indra/newview/lloutfitslist.cpp
Diffstat (limited to 'indra/newview/llscrollingpanelparam.cpp')
-rw-r--r-- | indra/newview/llscrollingpanelparam.cpp | 63 |
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(); -} |