예제 #1
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
void tAbstractSideBar::AnimateTo( int offset )
{
    if( m_pAnimationTimer == 0 )
    {
        m_pAnimationTimer = new tTimeLineDecelerate( 300, this );
        m_pAnimationTimer->setFrameRange( 0, m_cNumberOfAnimationSteps );
        m_pAnimationTimer->setUpdateInterval( 20 );
        Connect( m_pAnimationTimer, SIGNAL( finished() ), this, SLOT( OnAnimationFinished() ) );
    }

    m_pAnimationTimer->stop();

    if( m_pAnimationController == 0 )
    {
        m_pAnimationController = new QGraphicsItemAnimation( this );
        m_pAnimationController->setTimeLine( m_pAnimationTimer );
        m_pAnimationController->setItem( this );
    }

    //m_SideBarPosition = pos;

    // flip for RHS
    offset *= m_Orientation == eOR_Leftside ? 1 : -1;

    // always animate from the current position
    m_pAnimationController->setPosAt( 0, this->pos() );
    m_pAnimationController->setPosAt( 1, m_OriginPos + QPointF( offset, 0 ) );

    m_pAnimationTimer->start();
    m_IsAnimating = true;
    emit Animating( true );
}
예제 #2
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
void tAbstractSideBar::OnAnimationFinished()
{
    m_IsAnimating = false;
    if( m_Hidden )
    {
        hide();
    }
    emit Animating( false );
}
예제 #3
0
void BaseLimitCtrl::SetValue(TimeValue in_t, void *in_val, int in_commit, GetSetMethod in_method)
{
	if(GetLocked()==false)
	{
		if (IsEnabled()) {
			if (in_method == CTRL_RELATIVE)
				GetTypedValueAbsolute(in_t, in_val);
			ClampTypedValue(in_t, in_val);
		}

		// Check if we have a controller assigned.  If so, SetValue on it, if it's not locked!
		Control *limitedCtrl = GetLimitedControl();
		if (limitedCtrl) {
			limitedCtrl->SetValue(in_t, in_val, in_commit, IsEnabled()? CTRL_ABSOLUTE: in_method);
		}
		else {
			// If in AutoKey or SetKey mode, ParamBlock::SetValue() and ParamBlock2::SetValue()
			// create a default controller (an fcurve) and then set key on that   
			// controller.  So if there is no limited controller, I'll do the same:
			// create one, and set key on it.
			if (GetSetKeyMode() || (Animating() && GetCOREInterface10()->GetAutoKeyDefaultKeyOn() && (in_t!=0) && (in_t!=GetCOREInterface10()->GetAutoKeyDefaultKeyTime()))) {
				// Create the proper default controller according to type
				Control *newLimitedCtrl = GetDefaultControlForDataType();
				if (newLimitedCtrl) {
					void* ptrVal = CreateTempValue();
					GetStaticValue(ptrVal, in_method);

					SetLimitedControl(newLimitedCtrl);
					if (GetSetKeyMode()) {
						ISetKey *skey = (ISetKey *)newLimitedCtrl->GetInterface(I_SETKEYCONTROL);
						if (skey)
							skey->SetCurrentValue(ptrVal);
						newLimitedCtrl->SetValue(in_t, in_val);
					}
					else {
						newLimitedCtrl->SetValue(TimeValue(GetCOREInterface10()->GetAutoKeyDefaultKeyTime()), ptrVal);
						newLimitedCtrl->SetValue(in_t, in_val);
					}
					DeleteTempValue(ptrVal);
				}
			}

			// Set the limit controller static value
			SetStaticValue(in_val, CTRL_ABSOLUTE);
		}
	}
}