コード例 #1
0
void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata )
{
	LLScrollingPanelParam* self = (LLScrollingPanelParam*) userdata;

	F32 elapsed_time = self->mMouseDownTimer.getElapsedTimeF32();

	if (isAgentAvatarValid())
	{
		LLVisualParamHint* hint = self->mHintMax;

		if (elapsed_time < PARAM_STEP_TIME_THRESHOLD)
		{
			// step in direction
			F32 current_weight = self->mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );
			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)
			{
				if (slider->getMinValue() < new_percent
					&& new_percent < slider->getMaxValue())
				{
					self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight, FALSE);
					self->mWearable->writeToAvatar();
					slider->setValue( self->weightToPercent( new_weight ) );
				}
			}
		}
	}

	LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax );
}
コード例 #2
0
void LLScrollingPanelParam::onHintMouseDown( bool max )
{
	LLVisualParamHint* hint = max ? mHintMax : mHintMin;
	LLViewerVisualParam* param = hint->getVisualParam();

	if(!mWearable || !param)
	{
		return;
	}

	// morph towards this result
	F32 current_weight = mWearable->getVisualParamWeight( hint->getVisualParam()->getID() );

	// if we have maxed out on this morph, we shouldn't be able to click it
	if( hint->getVisualParamWeight() != current_weight )
	{
		mMouseDownTimer.reset();
		mLastHeldTime = 0.f;
	}
}
コード例 #3
0
void LLScrollingPanelParam::onHintHeldDown( bool max )
{
	LLVisualParamHint* hint = max ? mHintMax : mHintMin;
	LLViewerVisualParam* param = hint->getVisualParam();

	if(!mWearable || !param)
	{
		return;
	}

	F32 current_weight = mWearable->getVisualParamWeight( param->getID() );

	if (current_weight != hint->getVisualParamWeight() )
	{
		const F32 FULL_BLEND_TIME = 2.f;
		F32 elapsed_time = mMouseDownTimer.getElapsedTimeF32() - mLastHeldTime;
		mLastHeldTime += elapsed_time;

		F32 new_weight;
		if (current_weight > hint->getVisualParamWeight() )
		{
			new_weight = current_weight - (elapsed_time / FULL_BLEND_TIME);
		}
		else
		{
			new_weight = current_weight + (elapsed_time / FULL_BLEND_TIME);
		}

		// 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)
		{
			if (slider->getMinValue() < new_percent
				&& new_percent < slider->getMaxValue())
			{
				mWearable->setVisualParamWeight(param->getID(), new_weight, FALSE);
				mWearable->writeToAvatar();
				gAgentAvatarp->updateVisualParams();

				slider->setValue( weightToPercent( new_weight ) );
			}
		}
	}
}
コード例 #4
0
void LLScrollingPanelParam::onHintMouseUp( bool max )
{
	F32 elapsed_time = mMouseDownTimer.getElapsedTimeF32();

	if (isAgentAvatarValid())
	{
		LLVisualParamHint* hint			= max ? mHintMax : mHintMin;

		if (elapsed_time < PARAM_STEP_TIME_THRESHOLD)
		{
			LLViewerVisualParam* param = hint->getVisualParam();

			if(mWearable)
			{
				// step in direction
				F32 current_weight = mWearable->getVisualParamWeight( param->getID() );
				F32 range = mHintMax->getVisualParamWeight() - mHintMin->getVisualParamWeight();
				//if min, range should be negative.
				if(!max)
					range *= -1.f;
				// step a fraction in the negative direction
				F32 new_weight = current_weight + (range / 10.f);
				F32 new_percent = weightToPercent(new_weight);
				LLSliderCtrl* slider = getChild<LLSliderCtrl>("param slider");
				if (slider)
				{
					if (slider->getMinValue() < new_percent
						&& new_percent < slider->getMaxValue())
					{
						mWearable->setVisualParamWeight(param->getID(), new_weight, FALSE);
						mWearable->writeToAvatar();
						slider->setValue( weightToPercent( new_weight ) );
					}
				}
			}
		}
	}

	LLVisualParamHint::requestHintUpdates( mHintMin, mHintMax );
}