Пример #1
0
void MixerCurve::ResetCurve()
{
    m_mixerUI->CurveMin->setValue(m_mixerUI->CurveMin->minimum());
    m_mixerUI->CurveMax->setValue(m_mixerUI->CurveMax->maximum());
    m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Linear"));

    initLinearCurve(MixerCurveWidget::NODE_NUMELEM, getCurveMax(), getCurveMin());

    UpdateSettingsTable();
}
Пример #2
0
void MixerCurve::GenerateCurve()
{
   double scale;
   double newValue;

   //get the user settings
   double value1 = getCurveMin();
   double value2 = getCurveMax();
   double value3 = getCurveStep();

   m_curve->setCommandText("StepValue", QString("%0").arg(value3));

   QString CurveType = m_mixerUI->CurveType->currentText();

   QList<double> points;

   for (int i=0; i<MixerCurveWidget::NODE_NUMELEM; i++)
   {
       scale =((double)i/(double)(MixerCurveWidget::NODE_NUMELEM - 1));

       if ( CurveType.compare("Flat")==0)
       {
           points.append(value3);
       }
       if ( CurveType.compare("Linear")==0)
       {
           newValue =value1 +(scale*(value2-value1));
           points.append(newValue);
       }
       if ( CurveType.compare("Step")==0)
       {
           if (scale*100<value3)
           {
               points.append(value1);
           }
           else
           {
               points.append(value2);
           }
       }
       if ( CurveType.compare("Exp")==0)
       {
           newValue =value1 +(((exp(scale*(value3/10))-1))/(exp((value3/10))-1)*(value2-value1));
           points.append(newValue);
       }
       if ( CurveType.compare("Log")==0)
       {
           newValue = value1 +(((log(scale*(value3*2)+1))/(log(1+(value3*2))))*(value2-value1));
           points.append(newValue);
       }
   }

   setCurve(&points);
}