Skip to content

Commit

Permalink
Revert "SL-20140 Setting shape hand size to 36 won't save"
Browse files Browse the repository at this point in the history
This reverts commit 810a3d2.
  • Loading branch information
RyeMutt committed Apr 19, 2024
1 parent 1ccc185 commit 2c20148
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 47 deletions.
17 changes: 9 additions & 8 deletions indra/newview/character/avatar_lad.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,7 @@
value_min="-1"
value_max="1">
<param_skeleton>

<bone
name="mEyeLeft"
scale="0 0 0"
Expand All @@ -2031,8 +2031,9 @@
name="mEyeRight"
scale="0 0 0"
offset="-.005 0 0" />

<bone


<bone
name="mFaceEyeAltLeft"
scale="0 0 0"
offset="-.005 0 0" />
Expand All @@ -2041,7 +2042,7 @@
name="mFaceEyeAltRight"
scale="0 0 0"
offset="-.005 0 0" />

<bone
name="mFaceEyeLidLowerRight"
scale="0 0.3 0.7"
Expand All @@ -2052,7 +2053,7 @@
scale="0 0.3 0.7"
offset="0 0 0" />

<bone
<bone
name="mFaceEyeLidUpperRight"
scale="0 0.3 0.7"
offset=" 0 0 0" />
Expand All @@ -2061,17 +2062,17 @@
name="mFaceEyeLidUpperLeft"
scale="0 0.3 0.7"
offset=" 0 0 0" />

<bone
name="mFaceEyecornerInnerLeft"
scale="0 0 0"
offset="-0.005 -0.008 0.0" />

<bone
name="mFaceEyecornerInnerRight"
scale="0 0 0"
offset="-0.005 0.008 0.0" />

</param_skeleton>
</param>

Expand Down
63 changes: 44 additions & 19 deletions indra/newview/llscrollingpanelparam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,19 @@ 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 = weightToSlider(new_weight);
if (mSlider->getMinValue() < new_percent
&& new_percent < mSlider->getMaxValue())
F32 new_percent = weightToPercent(new_weight);
LLSliderCtrl* slider = getChild<LLSliderCtrl>("param slider");
if (slider)
{
mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight);
mWearable->writeToAvatar(gAgentAvatarp);
gAgentAvatarp->updateVisualParams();
if (slider->getMinValue() < new_percent
&& new_percent < slider->getMaxValue())
{
mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight);
mWearable->writeToAvatar(gAgentAvatarp);
gAgentAvatarp->updateVisualParams();

mSlider->setValue( weightToSlider( new_weight ) );
slider->setValue( weightToPercent( new_weight ) );
}
}
}
}
Expand All @@ -288,13 +292,17 @@ 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->weightToSlider(new_weight);
if (self->mSlider->getMinValue() < new_percent
&& new_percent < self->mSlider->getMaxValue())
F32 new_percent = self->weightToPercent(new_weight);
LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
if (slider)
{
self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
self->mWearable->writeToAvatar(gAgentAvatarp);
self->mSlider->setValue( self->weightToSlider( new_weight ) );
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 ) );
}
}
}

Expand All @@ -318,16 +326,33 @@ 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->weightToSlider(new_weight);
if (self->mSlider->getMinValue() < new_percent
&& new_percent < self->mSlider->getMaxValue())
F32 new_percent = self->weightToPercent(new_weight);
LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
if (slider)
{
self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
self->mWearable->writeToAvatar(gAgentAvatarp);
self->mSlider->setValue( self->weightToSlider( new_weight ) );
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 ) );
}
}
}
}

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();
}
3 changes: 3 additions & 0 deletions indra/newview/llscrollingpanelparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class LLScrollingPanelParam : public LLScrollingPanelParamBase
void onHintMouseDown( LLVisualParamHint* hint );
void onHintHeldDown( LLVisualParamHint* hint );

F32 weightToPercent( F32 weight );
F32 percentToWeight( F32 percent );

public:
// Constants for LLPanelVisualParam
const static F32 PARAM_STEP_TIME_THRESHOLD;
Expand Down
29 changes: 14 additions & 15 deletions indra/newview/llscrollingpanelparambase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,20 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan
LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints)
: LLScrollingPanel( panel_params ),
mParam(param),
mSlider(nullptr),
mAllowModify(allow_modify),
mWearable(wearable)
{
if (use_hints)
buildFromFile( "panel_scrolling_param.xml");
else
buildFromFile( "panel_scrolling_param_base.xml");

mSlider = getChild<LLSliderCtrl>("param slider");
mSlider->setMaxValue(100.f * (mParam->getMaxWeight() - mParam->getMinWeight()));
mSlider->setValue(weightToSlider(param->getWeight()));

getChild<LLUICtrl>("param slider")->setValue(weightToPercent(param->getWeight()));

std::string display_name = LLTrans::getString(param->getDisplayName());
mSlider->setLabelArg("[DESC]", display_name);
mSlider->setEnabled(mAllowModify);
mSlider->setCommitCallback(boost::bind(LLScrollingPanelParamBase::onSliderMoved, mSlider, this));
getChild<LLUICtrl>("param slider")->setLabelArg("[DESC]", display_name);
getChildView("param slider")->setEnabled(mAllowModify);
childSetCommitCallback("param slider", LLScrollingPanelParamBase::onSliderMoved, this);

setVisible(FALSE);
setBorderVisible( FALSE );
Expand All @@ -80,9 +77,9 @@ void LLScrollingPanelParamBase::updatePanel(BOOL allow_modify)
}

F32 current_weight = mWearable->getVisualParamWeight( param->getID() );
mSlider->setValue(weightToSlider( current_weight ) );
getChild<LLUICtrl>("param slider")->setValue(weightToPercent( current_weight ) );
mAllowModify = allow_modify;
mSlider->setEnabled(mAllowModify);
getChildView("param slider")->setEnabled(mAllowModify);
}

// static
Expand All @@ -93,7 +90,7 @@ void LLScrollingPanelParamBase::onSliderMoved(LLUICtrl* ctrl, void* userdata)
LLViewerVisualParam* param = self->mParam;

F32 current_weight = self->mWearable->getVisualParamWeight( param->getID() );
F32 new_weight = self->sliderToWeight( (F32)slider->getValue().asReal() );
F32 new_weight = self->percentToWeight( (F32)slider->getValue().asReal() );
if (current_weight != new_weight )
{
self->mWearable->setVisualParamWeight( param->getID(), new_weight);
Expand All @@ -102,12 +99,14 @@ void LLScrollingPanelParamBase::onSliderMoved(LLUICtrl* ctrl, void* userdata)
}
}

F32 LLScrollingPanelParamBase::weightToSlider(F32 weight)
F32 LLScrollingPanelParamBase::weightToPercent( F32 weight )
{
return (weight - mParam->getMinWeight()) * 100.f;
LLViewerVisualParam* param = mParam;
return (weight - param->getMinWeight()) / (param->getMaxWeight() - param->getMinWeight()) * 100.f;
}

F32 LLScrollingPanelParamBase::sliderToWeight(F32 slider)
F32 LLScrollingPanelParamBase::percentToWeight( F32 percent )
{
return slider / 100.f + mParam->getMinWeight();
LLViewerVisualParam* param = mParam;
return percent / 100.f * (param->getMaxWeight() - param->getMinWeight()) + param->getMinWeight();
}
7 changes: 2 additions & 5 deletions indra/newview/llscrollingpanelparambase.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class LLViewerVisualParam;
class LLWearable;
class LLVisualParamHint;
class LLViewerVisualParam;
class LLSliderCtrl;
class LLJoint;

class LLScrollingPanelParamBase : public LLScrollingPanel
Expand All @@ -50,13 +49,11 @@ class LLScrollingPanelParamBase : public LLScrollingPanel

static void onSliderMoved(LLUICtrl* ctrl, void* userdata);

F32 weightToSlider(F32 weight);
F32 sliderToWeight(F32 slider);
F32 weightToPercent( F32 weight );
F32 percentToWeight( F32 percent );

public:
LLViewerVisualParam* mParam;
LLSliderCtrl* mSlider;

protected:
BOOL mAllowModify;
LLWearable *mWearable;
Expand Down

0 comments on commit 2c20148

Please sign in to comment.