Skip to content
Snippets Groups Projects
Commit ec41285f authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Merge branch 'main' into merge/materials_featurette

parents 76651f98 2c20148c
No related branches found
No related tags found
No related merge requests found
...@@ -2032,6 +2032,7 @@ ...@@ -2032,6 +2032,7 @@
scale="0 0 0" scale="0 0 0"
offset="-.005 0 0" /> offset="-.005 0 0" />
<bone <bone
name="mFaceEyeAltLeft" name="mFaceEyeAltLeft"
scale="0 0 0" scale="0 0 0"
......
...@@ -259,15 +259,19 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint ) ...@@ -259,15 +259,19 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint )
// Make sure we're not taking the slider out of bounds // Make sure we're not taking the slider out of bounds
// (this is where some simple UI limits are stored) // (this is where some simple UI limits are stored)
F32 new_percent = weightToSlider(new_weight); F32 new_percent = weightToPercent(new_weight);
if (mSlider->getMinValue() < new_percent LLSliderCtrl* slider = getChild<LLSliderCtrl>("param slider");
&& new_percent < mSlider->getMaxValue()) if (slider)
{
if (slider->getMinValue() < new_percent
&& new_percent < slider->getMaxValue())
{ {
mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight); mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight);
mWearable->writeToAvatar(gAgentAvatarp); mWearable->writeToAvatar(gAgentAvatarp);
gAgentAvatarp->updateVisualParams(); gAgentAvatarp->updateVisualParams();
mSlider->setValue( weightToSlider( new_weight ) ); slider->setValue( weightToPercent( new_weight ) );
}
} }
} }
} }
...@@ -288,13 +292,17 @@ void LLScrollingPanelParam::onHintMinMouseUp( void* userdata ) ...@@ -288,13 +292,17 @@ void LLScrollingPanelParam::onHintMinMouseUp( void* userdata )
F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight(); F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight();
// step a fraction in the negative directiona // step a fraction in the negative directiona
F32 new_weight = current_weight - (range / 10.f); F32 new_weight = current_weight - (range / 10.f);
F32 new_percent = self->weightToSlider(new_weight); F32 new_percent = self->weightToPercent(new_weight);
if (self->mSlider->getMinValue() < new_percent LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
&& new_percent < self->mSlider->getMaxValue()) if (slider)
{
if (slider->getMinValue() < new_percent
&& new_percent < slider->getMaxValue())
{ {
self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight); self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
self->mWearable->writeToAvatar(gAgentAvatarp); self->mWearable->writeToAvatar(gAgentAvatarp);
self->mSlider->setValue( self->weightToSlider( new_weight ) ); slider->setValue( self->weightToPercent( new_weight ) );
}
} }
} }
...@@ -318,16 +326,33 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata ) ...@@ -318,16 +326,33 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata )
F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight(); F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight();
// step a fraction in the negative direction // step a fraction in the negative direction
F32 new_weight = current_weight + (range / 10.f); F32 new_weight = current_weight + (range / 10.f);
F32 new_percent = self->weightToSlider(new_weight); F32 new_percent = self->weightToPercent(new_weight);
if (self->mSlider->getMinValue() < new_percent LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider");
&& new_percent < self->mSlider->getMaxValue()) if (slider)
{
if (slider->getMinValue() < new_percent
&& new_percent < slider->getMaxValue())
{ {
self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight); self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight);
self->mWearable->writeToAvatar(gAgentAvatarp); self->mWearable->writeToAvatar(gAgentAvatarp);
self->mSlider->setValue( self->weightToSlider( new_weight ) ); slider->setValue( self->weightToPercent( new_weight ) );
}
} }
} }
} }
LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax ); 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();
}
...@@ -61,6 +61,9 @@ class LLScrollingPanelParam : public LLScrollingPanelParamBase ...@@ -61,6 +61,9 @@ class LLScrollingPanelParam : public LLScrollingPanelParamBase
void onHintMouseDown( LLVisualParamHint* hint ); void onHintMouseDown( LLVisualParamHint* hint );
void onHintHeldDown( LLVisualParamHint* hint ); void onHintHeldDown( LLVisualParamHint* hint );
F32 weightToPercent( F32 weight );
F32 percentToWeight( F32 percent );
public: public:
// Constants for LLPanelVisualParam // Constants for LLPanelVisualParam
const static F32 PARAM_STEP_TIME_THRESHOLD; const static F32 PARAM_STEP_TIME_THRESHOLD;
......
...@@ -43,7 +43,6 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan ...@@ -43,7 +43,6 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan
LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints) LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints)
: LLScrollingPanel( panel_params ), : LLScrollingPanel( panel_params ),
mParam(param), mParam(param),
mSlider(nullptr),
mAllowModify(allow_modify), mAllowModify(allow_modify),
mWearable(wearable) mWearable(wearable)
{ {
...@@ -52,14 +51,12 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan ...@@ -52,14 +51,12 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan
else else
buildFromFile( "panel_scrolling_param_base.xml"); buildFromFile( "panel_scrolling_param_base.xml");
mSlider = getChild<LLSliderCtrl>("param slider"); getChild<LLUICtrl>("param slider")->setValue(weightToPercent(param->getWeight()));
mSlider->setMaxValue(100.f * (mParam->getMaxWeight() - mParam->getMinWeight()));
mSlider->setValue(weightToSlider(param->getWeight()));
std::string display_name = LLTrans::getString(param->getDisplayName()); std::string display_name = LLTrans::getString(param->getDisplayName());
mSlider->setLabelArg("[DESC]", display_name); getChild<LLUICtrl>("param slider")->setLabelArg("[DESC]", display_name);
mSlider->setEnabled(mAllowModify); getChildView("param slider")->setEnabled(mAllowModify);
mSlider->setCommitCallback(boost::bind(LLScrollingPanelParamBase::onSliderMoved, mSlider, this)); childSetCommitCallback("param slider", LLScrollingPanelParamBase::onSliderMoved, this);
setVisible(FALSE); setVisible(FALSE);
setBorderVisible( FALSE ); setBorderVisible( FALSE );
...@@ -80,9 +77,9 @@ void LLScrollingPanelParamBase::updatePanel(BOOL allow_modify) ...@@ -80,9 +77,9 @@ void LLScrollingPanelParamBase::updatePanel(BOOL allow_modify)
} }
F32 current_weight = mWearable->getVisualParamWeight( param->getID() ); F32 current_weight = mWearable->getVisualParamWeight( param->getID() );
mSlider->setValue(weightToSlider( current_weight ) ); getChild<LLUICtrl>("param slider")->setValue(weightToPercent( current_weight ) );
mAllowModify = allow_modify; mAllowModify = allow_modify;
mSlider->setEnabled(mAllowModify); getChildView("param slider")->setEnabled(mAllowModify);
} }
// static // static
...@@ -93,7 +90,7 @@ void LLScrollingPanelParamBase::onSliderMoved(LLUICtrl* ctrl, void* userdata) ...@@ -93,7 +90,7 @@ void LLScrollingPanelParamBase::onSliderMoved(LLUICtrl* ctrl, void* userdata)
LLViewerVisualParam* param = self->mParam; LLViewerVisualParam* param = self->mParam;
F32 current_weight = self->mWearable->getVisualParamWeight( param->getID() ); 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 ) if (current_weight != new_weight )
{ {
self->mWearable->setVisualParamWeight( param->getID(), new_weight); self->mWearable->setVisualParamWeight( param->getID(), new_weight);
...@@ -102,12 +99,14 @@ void LLScrollingPanelParamBase::onSliderMoved(LLUICtrl* ctrl, void* userdata) ...@@ -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();
} }
...@@ -36,7 +36,6 @@ class LLViewerVisualParam; ...@@ -36,7 +36,6 @@ class LLViewerVisualParam;
class LLWearable; class LLWearable;
class LLVisualParamHint; class LLVisualParamHint;
class LLViewerVisualParam; class LLViewerVisualParam;
class LLSliderCtrl;
class LLJoint; class LLJoint;
class LLScrollingPanelParamBase : public LLScrollingPanel class LLScrollingPanelParamBase : public LLScrollingPanel
...@@ -50,13 +49,11 @@ class LLScrollingPanelParamBase : public LLScrollingPanel ...@@ -50,13 +49,11 @@ class LLScrollingPanelParamBase : public LLScrollingPanel
static void onSliderMoved(LLUICtrl* ctrl, void* userdata); static void onSliderMoved(LLUICtrl* ctrl, void* userdata);
F32 weightToSlider(F32 weight); F32 weightToPercent( F32 weight );
F32 sliderToWeight(F32 slider); F32 percentToWeight( F32 percent );
public: public:
LLViewerVisualParam* mParam; LLViewerVisualParam* mParam;
LLSliderCtrl* mSlider;
protected: protected:
BOOL mAllowModify; BOOL mAllowModify;
LLWearable *mWearable; LLWearable *mWearable;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment